diff options
Diffstat (limited to 'include/clang/Sema/IdentifierResolver.h')
-rw-r--r-- | include/clang/Sema/IdentifierResolver.h | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/include/clang/Sema/IdentifierResolver.h b/include/clang/Sema/IdentifierResolver.h index 85d8ad22bfb0..dff013423aa9 100644 --- a/include/clang/Sema/IdentifierResolver.h +++ b/include/clang/Sema/IdentifierResolver.h @@ -16,6 +16,7 @@ #define LLVM_CLANG_AST_SEMA_IDENTIFIERRESOLVER_H #include "clang/Basic/IdentifierTable.h" +#include "llvm/ADT/SmallVector.h" namespace clang { @@ -23,9 +24,11 @@ class ASTContext; class Decl; class DeclContext; class DeclarationName; +class ExternalPreprocessorSource; class NamedDecl; +class Preprocessor; class Scope; - + /// IdentifierResolver - Keeps track of shadowed decls on enclosing /// scopes. It manages the shadowing chains of declaration names and /// implements efficient decl lookup based on a declaration name. @@ -141,10 +144,10 @@ public: }; /// begin - Returns an iterator for decls with the name 'Name'. - static iterator begin(DeclarationName Name); + iterator begin(DeclarationName Name); /// end - Returns an iterator that has 'finished'. - static iterator end() { + iterator end() { return iterator(); } @@ -175,23 +178,29 @@ public: /// position. void InsertDeclAfter(iterator Pos, NamedDecl *D); - /// \brief Link the declaration into the chain of declarations for - /// the given identifier. + /// \brief Try to add the given declaration to the top level scope, if it + /// (or a redeclaration of it) hasn't already been added. /// - /// This is a lower-level routine used by the AST reader to link a - /// declaration into a specific IdentifierInfo before the - /// declaration actually has a name. - void AddDeclToIdentifierChain(IdentifierInfo *II, NamedDecl *D); - - explicit IdentifierResolver(const LangOptions &LangOpt); + /// \param D The externally-produced declaration to add. + /// + /// \param Name The name of the externally-produced declaration. + /// + /// \returns true if the declaration was added, false otherwise. + bool tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name); + + explicit IdentifierResolver(Preprocessor &PP); ~IdentifierResolver(); private: const LangOptions &LangOpt; - + Preprocessor &PP; + class IdDeclInfoMap; IdDeclInfoMap *IdDeclInfos; + void updatingIdentifier(IdentifierInfo &II); + void readingIdentifier(IdentifierInfo &II); + /// FETokenInfo contains a Decl pointer if lower bit == 0. static inline bool isDeclPtr(void *Ptr) { return (reinterpret_cast<uintptr_t>(Ptr) & 0x1) == 0; |