Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 1050471

Browse files
committed
Remove the -cc1-level option "-pubnames-dump". Such things should stay
out of the tree and use the tooling infrastructure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154668 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent f53bc31 commit 1050471

File tree

7 files changed

+0
-108
lines changed

7 files changed

+0
-108
lines changed

include/clang/Driver/CC1Options.td

-3
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,6 @@ def ast_view : Flag<"-ast-view">,
428428
HelpText<"Build ASTs and view them with GraphViz">;
429429
def print_decl_contexts : Flag<"-print-decl-contexts">,
430430
HelpText<"Print DeclContexts and their Decls">;
431-
def pubnames_dump : Flag<"-pubnames-dump">,
432-
HelpText<"Print all of the public (global) names in the source, e.g., the "
433-
"names of all global declarations and macros">;
434431
def emit_module : Flag<"-emit-module">,
435432
HelpText<"Generate pre-compiled module file from a module map">;
436433
def emit_pth : Flag<"-emit-pth">,

include/clang/Frontend/FrontendActions.h

-9
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,6 @@ class PrintPreambleAction : public FrontendAction {
173173
virtual bool usesPreprocessorOnly() const { return true; }
174174
};
175175

176-
class PubnamesDumpAction : public ASTFrontendAction {
177-
protected:
178-
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
179-
StringRef InFile);
180-
181-
public:
182-
virtual bool hasCodeCompletionSupport() const { return false; }
183-
};
184-
185176
//===----------------------------------------------------------------------===//
186177
// Preprocessor Actions
187178
//===----------------------------------------------------------------------===//

include/clang/Frontend/FrontendOptions.h

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ namespace frontend {
4242
PrintDeclContext, ///< Print DeclContext and their Decls.
4343
PrintPreamble, ///< Print the "preamble" of the input file
4444
PrintPreprocessedInput, ///< -E mode.
45-
PubnamesDump, ///< Print all of the "public" names in the source.
4645
RewriteMacros, ///< Expand macros but not #includes.
4746
RewriteObjC, ///< ObjC->C Rewriter.
4847
RewriteTest, ///< Rewriter playground

lib/Frontend/CompilerInvocation.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ static const char *getActionName(frontend::ActionKind Kind) {
429429
case frontend::PrintDeclContext: return "-print-decl-contexts";
430430
case frontend::PrintPreamble: return "-print-preamble";
431431
case frontend::PrintPreprocessedInput: return "-E";
432-
case frontend::PubnamesDump: return "-pubnames-dump";
433432
case frontend::RewriteMacros: return "-rewrite-macros";
434433
case frontend::RewriteObjC: return "-rewrite-objc";
435434
case frontend::RewriteTest: return "-rewrite-test";
@@ -1369,8 +1368,6 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
13691368
Opts.ProgramAction = frontend::PrintPreamble; break;
13701369
case OPT_E:
13711370
Opts.ProgramAction = frontend::PrintPreprocessedInput; break;
1372-
case OPT_pubnames_dump:
1373-
Opts.ProgramAction = frontend::PubnamesDump; break;
13741371
case OPT_rewrite_macros:
13751372
Opts.ProgramAction = frontend::RewriteMacros; break;
13761373
case OPT_rewrite_objc:

lib/Frontend/FrontendActions.cpp

-72
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "llvm/Support/MemoryBuffer.h"
2626
#include "llvm/Support/raw_ostream.h"
2727
#include "llvm/Support/system_error.h"
28-
#include <set>
2928

3029
using namespace clang;
3130

@@ -355,77 +354,6 @@ ASTConsumer *SyntaxOnlyAction::CreateASTConsumer(CompilerInstance &CI,
355354
return new ASTConsumer();
356355
}
357356

358-
namespace {
359-
class PubnamesDumpConsumer : public ASTConsumer {
360-
Preprocessor &PP;
361-
362-
/// \brief Determine whether the given identifier provides a 'public' name.
363-
bool isPublicName(IdentifierInfo *II) {
364-
// If there are any top-level declarations associated with this
365-
// identifier, it is a public name.
366-
if (II->getFETokenInfo<void>())
367-
return true;
368-
369-
// If this identifier is the name of a non-builtin macro that isn't
370-
// defined on the command line or implicitly by the front end, it is a
371-
// public name.
372-
if (II->hasMacroDefinition()) {
373-
if (MacroInfo *M = PP.getMacroInfo(II))
374-
if (!M->isBuiltinMacro()) {
375-
SourceLocation Loc = M->getDefinitionLoc();
376-
FileID File = PP.getSourceManager().getFileID(Loc);
377-
if (PP.getSourceManager().getFileEntryForID(File))
378-
return true;
379-
}
380-
}
381-
382-
return false;
383-
}
384-
385-
public:
386-
PubnamesDumpConsumer(Preprocessor &PP) : PP(PP) { }
387-
388-
virtual void HandleTranslationUnit(ASTContext &Ctx) {
389-
std::set<StringRef> Pubnames;
390-
391-
// Add the names of any non-builtin macros.
392-
for (IdentifierTable::iterator I = Ctx.Idents.begin(),
393-
IEnd = Ctx.Idents.end();
394-
I != IEnd; ++I) {
395-
if (isPublicName(I->second))
396-
Pubnames.insert(I->first());
397-
}
398-
399-
// If there is an external identifier lookup source, consider those
400-
// identifiers as well.
401-
if (IdentifierInfoLookup *External
402-
= Ctx.Idents.getExternalIdentifierLookup()) {
403-
OwningPtr<IdentifierIterator> Iter(External->getIdentifiers());
404-
do {
405-
StringRef Name = Iter->Next();
406-
if (Name.empty())
407-
break;
408-
409-
if (isPublicName(PP.getIdentifierInfo(Name)))
410-
Pubnames.insert(Name);
411-
} while (true);
412-
}
413-
414-
// Print the names, in lexicographical order.
415-
for (std::set<StringRef>::iterator N = Pubnames.begin(),
416-
NEnd = Pubnames.end();
417-
N != NEnd; ++N) {
418-
llvm::outs() << *N << '\n';
419-
}
420-
}
421-
};
422-
}
423-
424-
ASTConsumer *PubnamesDumpAction::CreateASTConsumer(CompilerInstance &CI,
425-
StringRef InFile) {
426-
return new PubnamesDumpConsumer(CI.getPreprocessor());
427-
}
428-
429357
//===----------------------------------------------------------------------===//
430358
// Preprocessor Actions
431359
//===----------------------------------------------------------------------===//

lib/FrontendTool/ExecuteCompilerInvocation.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) {
7272
case PrintDeclContext: return new DeclContextPrintAction();
7373
case PrintPreamble: return new PrintPreambleAction();
7474
case PrintPreprocessedInput: return new PrintPreprocessedAction();
75-
case PubnamesDump: return new PubnamesDumpAction();
7675
case RewriteMacros: return new RewriteMacrosAction();
7776
case RewriteObjC: return new RewriteObjCAction();
7877
case RewriteTest: return new RewriteTestAction();

test/Misc/pubnames.c

-19
This file was deleted.

0 commit comments

Comments
 (0)