14 #ifndef LLVM_CLANG_AST_DECLCONTEXTINTERNALS_H 15 #define LLVM_CLANG_AST_DECLCONTEXTINTERNALS_H 21 #include "llvm/ADT/DenseMap.h" 22 #include "llvm/ADT/PointerIntPair.h" 23 #include "llvm/ADT/PointerUnion.h" 24 #include "llvm/ADT/SmallVector.h" 30 class DependentDiagnostic;
45 llvm::PointerUnion<NamedDecl *, DeclsAndHasExternalTy>
Data;
68 bool isNull()
const {
return Data.isNull(); }
103 "PointerUnion mangles the NamedDecl pointer!");
107 assert(!
isNull() &&
"removing from empty list");
109 assert(Singleton == D &&
"list is different singleton");
116 DeclsTy::iterator I = llvm::find(Vec, D);
117 assert(I != Vec.end() &&
"list does not contain decl");
120 assert(llvm::find(Vec, D) == Vec.end() &&
"list still contains decl");
129 if (Singleton->isFromASTFile())
133 Vec.erase(std::remove_if(Vec.begin(), Vec.end(),
134 [](
Decl *D) {
return D->isFromASTFile(); }),
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();
190 assert(!
isNull() &&
"don't AddSubsequentDecl when we have no decls");
218 DeclsTy::iterator I = Vec.begin();
220 while (I != Vec.end() &&
229 }
else if (!Vec.empty() && Vec.back()->hasTagIdentifierNamespace()) {
239 :
public llvm::SmallDenseMap<DeclarationName, StoredDeclsList, 4> {
247 llvm::PointerIntPair<StoredDeclsMap*, 1>
Previous;
263 #endif // LLVM_CLANG_AST_DECLCONTEXTINTERNALS_H void setHasExternalDecls()
void AddSubsequentDecl(NamedDecl *D)
AddSubsequentDecl - This is called on the second and later decl when it is not a redeclaration to mer...
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 ...
llvm::PointerIntPair< DeclsTy *, 1, bool > DeclsAndHasExternalTy
A collection of declarations, with a flag to indicate if we have further external declarations...
SmallVector< NamedDecl *, 4 > DeclsTy
When in vector form, this is what the Data pointer points to.
Decl - This represents one declaration (or definition), e.g.
unsigned getIdentifierNamespace() const
bool HandleRedeclaration(NamedDecl *D, bool IsKnownNewer)
HandleRedeclaration - If this is a redeclaration of an existing decl, replace the old one with D and ...
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.
bool hasTagIdentifierNamespace() const
DeclsAndHasExternalTy getAsVectorAndHasExternal() const
StoredDeclsList()=default
StoredDeclsList & operator=(StoredDeclsList &&RHS)
DeclsTy * getAsVector() const
bool hasExternalDecls() const
void removeExternalDecls()
Remove any declarations which were imported from an external AST source.
DeclContext::lookup_result getLookupResult()
getLookupResult - Return an array of all the decls that this list represents.
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.
NamedDecl * getAsDecl() const
An array of decls optimized for the common case of only containing one entry.
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
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)
DeclContextLookupResult lookup_result
This represents a decl that may have a name.
This declaration is a using declaration.