15 #ifndef LLVM_CLANG_AST_DECLCONTEXTINTERNALS_H 16 #define LLVM_CLANG_AST_DECLCONTEXTINTERNALS_H 22 #include "llvm/ADT/DenseMap.h" 23 #include "llvm/ADT/PointerIntPair.h" 24 #include "llvm/ADT/PointerUnion.h" 25 #include "llvm/ADT/SmallVector.h" 31 class DependentDiagnostic;
46 llvm::PointerUnion<NamedDecl *, DeclsAndHasExternalTy>
Data;
69 bool isNull()
const {
return Data.isNull(); }
104 "PointerUnion mangles the NamedDecl pointer!");
108 assert(!
isNull() &&
"removing from empty list");
110 assert(Singleton == D &&
"list is different singleton");
117 DeclsTy::iterator I = std::find(Vec.begin(), Vec.end(), D);
118 assert(I != Vec.end() &&
"list does not contain decl");
121 assert(std::find(Vec.begin(), Vec.end(), D)
122 == Vec.end() &&
"list still contains decl");
131 if (Singleton->isFromASTFile())
135 Vec.erase(std::remove_if(Vec.begin(), Vec.end(),
136 [](
Decl *D) {
return D->isFromASTFile(); }),
151 assert(!
isNull() &&
"Empty list isn't allowed");
157 assert(
getAsVector() &&
"Must have a vector at this point");
177 for (DeclsTy::iterator OD = Vec.begin(), ODEnd = Vec.end();
192 assert(!
isNull() &&
"don't AddSubsequentDecl when we have no decls");
220 DeclsTy::iterator I = Vec.begin();
222 while (I != Vec.end() &&
231 }
else if (!Vec.empty() && Vec.back()->hasTagIdentifierNamespace()) {
241 :
public llvm::SmallDenseMap<DeclarationName, StoredDeclsList, 4> {
249 llvm::PointerIntPair<StoredDeclsMap*, 1>
Previous;
265 #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.