aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/FrontendActions.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2012-05-03 16:53:59 +0000
committerDimitry Andric <dim@FreeBSD.org>2012-05-03 16:53:59 +0000
commit6b9a6e390fbb92c40eb9c6ac9e7abbd88dd7a767 (patch)
tree2e51705e103e92c7be1b21e8bd8ffd5b5d0e4d52 /lib/Frontend/FrontendActions.cpp
parentdbe13110f59f48b4dbb7552b3ac2935acdeece7f (diff)
downloadsrc-6b9a6e390fbb92c40eb9c6ac9e7abbd88dd7a767.tar.gz
src-6b9a6e390fbb92c40eb9c6ac9e7abbd88dd7a767.zip
Vendor import of clang release_31 branch r155985:vendor/clang/clang-release_31-r155985
Notes
Notes: svn path=/vendor/clang/dist/; revision=234973 svn path=/vendor/clang/clang-release_31-r155985/; revision=234974; tag=vendor/clang/clang-release_31-r155985
Diffstat (limited to 'lib/Frontend/FrontendActions.cpp')
-rw-r--r--lib/Frontend/FrontendActions.cpp72
1 files changed, 0 insertions, 72 deletions
diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp
index b4a439d4237e..737ee4a098bb 100644
--- a/lib/Frontend/FrontendActions.cpp
+++ b/lib/Frontend/FrontendActions.cpp
@@ -25,7 +25,6 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h"
-#include <set>
using namespace clang;
@@ -355,77 +354,6 @@ ASTConsumer *SyntaxOnlyAction::CreateASTConsumer(CompilerInstance &CI,
return new ASTConsumer();
}
-namespace {
- class PubnamesDumpConsumer : public ASTConsumer {
- Preprocessor &PP;
-
- /// \brief Determine whether the given identifier provides a 'public' name.
- bool isPublicName(IdentifierInfo *II) {
- // If there are any top-level declarations associated with this
- // identifier, it is a public name.
- if (II->getFETokenInfo<void>())
- return true;
-
- // If this identifier is the name of a non-builtin macro that isn't
- // defined on the command line or implicitly by the front end, it is a
- // public name.
- if (II->hasMacroDefinition()) {
- if (MacroInfo *M = PP.getMacroInfo(II))
- if (!M->isBuiltinMacro()) {
- SourceLocation Loc = M->getDefinitionLoc();
- FileID File = PP.getSourceManager().getFileID(Loc);
- if (PP.getSourceManager().getFileEntryForID(File))
- return true;
- }
- }
-
- return false;
- }
-
- public:
- PubnamesDumpConsumer(Preprocessor &PP) : PP(PP) { }
-
- virtual void HandleTranslationUnit(ASTContext &Ctx) {
- std::set<StringRef> Pubnames;
-
- // Add the names of any non-builtin macros.
- for (IdentifierTable::iterator I = Ctx.Idents.begin(),
- IEnd = Ctx.Idents.end();
- I != IEnd; ++I) {
- if (isPublicName(I->second))
- Pubnames.insert(I->first());
- }
-
- // If there is an external identifier lookup source, consider those
- // identifiers as well.
- if (IdentifierInfoLookup *External
- = Ctx.Idents.getExternalIdentifierLookup()) {
- OwningPtr<IdentifierIterator> Iter(External->getIdentifiers());
- do {
- StringRef Name = Iter->Next();
- if (Name.empty())
- break;
-
- if (isPublicName(PP.getIdentifierInfo(Name)))
- Pubnames.insert(Name);
- } while (true);
- }
-
- // Print the names, in lexicographical order.
- for (std::set<StringRef>::iterator N = Pubnames.begin(),
- NEnd = Pubnames.end();
- N != NEnd; ++N) {
- llvm::outs() << *N << '\n';
- }
- }
- };
-}
-
-ASTConsumer *PubnamesDumpAction::CreateASTConsumer(CompilerInstance &CI,
- StringRef InFile) {
- return new PubnamesDumpConsumer(CI.getPreprocessor());
-}
-
//===----------------------------------------------------------------------===//
// Preprocessor Actions
//===----------------------------------------------------------------------===//