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");
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(),
134 std::mem_fun(&Decl::isFromASTFile)),
149 assert(!
isNull() &&
"Empty list isn't allowed");
155 assert(
getAsVector() &&
"Must have a vector at this point");
191 assert(!
isNull() &&
"don't AddSubsequentDecl when we have no decls");
211 if (D->hasTagIdentifierNamespace())
218 else if (D->getIdentifierNamespace() & Decl::IDNS_Using) {
220 if (D->getIdentifierNamespace() != Decl::IDNS_Using) {
221 while (I != Vec.end() &&
222 (*I)->getIdentifierNamespace() == Decl::IDNS_Using)
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)
AddSubsequentDecl - This is called on the second and later decl when it is not a redeclaration to mer...
SmallVector< NamedDecl *, 4 > DeclsTy
When in vector form, this is what the Data pointer points to.
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 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.
StoredDeclsList & operator=(StoredDeclsList &&RHS)
detail::InMemoryDirectory::const_iterator I
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
DeclContext::lookup_result getLookupResult()
getLookupResult - Return an array of all the decls that this list represents.
DeclsAndHasExternalTy getAsVectorAndHasExternal() const
const TemplateArgument * iterator
DependentStoredDeclsMap()
DeclContextLookupResult lookup_result
An array of decls optimized for the common case of only containing one entry.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
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 ...
unsigned Map[Count]
The type of a lookup table which maps from language-specific address spaces to target-specific ones...
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)
NamedDecl - This represents a decl with a name.