14 #ifndef LLVM_CLANG_AST_DECLCONTEXTINTERNALS_H
15 #define LLVM_CLANG_AST_DECLCONTEXTINTERNALS_H
20 #include "llvm/ADT/DenseMap.h"
21 #include "llvm/ADT/PointerIntPair.h"
22 #include "llvm/ADT/PointerUnion.h"
23 #include "llvm/ADT/SmallVector.h"
28 class DependentDiagnostic;
44 llvm::PointerUnion<NamedDecl*, DeclsAndHasExternalTy>
Data;
102 "PointerUnion mangles the NamedDecl pointer!");
106 assert(!
isNull() &&
"removing from empty list");
108 assert(Singleton == D &&
"list is different singleton");
115 DeclsTy::iterator I = std::find(Vec.begin(), Vec.end(), D);
116 assert(I != Vec.end() &&
"list does not contain decl");
119 assert(std::find(Vec.begin(), Vec.end(), D)
120 == Vec.end() &&
"list still contains decl");
129 if (Singleton->isFromASTFile())
133 Vec.erase(std::remove_if(Vec.begin(), Vec.end(),
149 assert(!
isNull() &&
"Empty list isn't allowed");
155 assert(
getAsVector() &&
"Must have a vector at this point");
175 for (DeclsTy::iterator OD = Vec.begin(), ODEnd = Vec.end();
191 assert(!
isNull() &&
"don't AddSubsequentDecl when we have no decls");
219 DeclsTy::iterator I = Vec.begin();
221 while (I != Vec.end() &&
230 }
else if (!Vec.empty() && Vec.back()->hasTagIdentifierNamespace()) {
240 :
public llvm::SmallDenseMap<DeclarationName, StoredDeclsList, 4> {
248 llvm::PointerIntPair<StoredDeclsMap*, 1>
Previous;
void setHasExternalDecls()
void AddSubsequentDecl(NamedDecl *D)
SmallVector< NamedDecl *, 4 > DeclsTy
When in vector form, this is what the Data pointer points to.
bool HandleRedeclaration(NamedDecl *D, bool IsKnownNewer)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
The results of name lookup within a DeclContext. This is either a single result (with no stable stora...
bool declarationReplaces(NamedDecl *OldD, bool IsKnownNewer=true) const
Determine whether this declaration, if known to be well-formed within its context, will replace the declaration OldD if introduced into scope. A declaration will replace another declaration if, for example, it is a redeclaration of the same variable or function, but not if it is a declaration of a different kind (function vs. class) or an overloaded function.
unsigned getIdentifierNamespace() const
StoredDeclsList & operator=(StoredDeclsList &&RHS)
void removeExternalDecls()
Remove any declarations which were imported from an external AST source.
llvm::PointerIntPair< DeclsTy *, 1, bool > DeclsAndHasExternalTy
A collection of declarations, with a flag to indicate if we have further external declarations...
NamedDecl * getAsDecl() const
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
DeclContext::lookup_result getLookupResult()
bool hasTagIdentifierNamespace() const
DeclsAndHasExternalTy getAsVectorAndHasExternal() const
DependentStoredDeclsMap()
DeclContextLookupResult lookup_result
An array of decls optimized for the common case of only containing one entry.
DeclsTy * getAsVector() const
llvm::PointerUnion< NamedDecl *, DeclsAndHasExternalTy > Data
The stored data, which will be either a pointer to a NamedDecl, or a pointer to a vector with a flag ...
A dependently-generated diagnostic.
void setOnlyValue(NamedDecl *ND)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
StoredDeclsList(StoredDeclsList &&RHS)
bool hasExternalDecls() const
static void DestroyAll(StoredDeclsMap *Map, bool Dependent)