14 #ifndef LLVM_CLANG_AST_DECLBASE_H
15 #define LLVM_CLANG_AST_DECLBASE_H
20 #include "llvm/ADT/PointerUnion.h"
21 #include "llvm/ADT/iterator.h"
22 #include "llvm/ADT/iterator_range.h"
23 #include "llvm/Support/Compiler.h"
24 #include "llvm/Support/PrettyStackTrace.h"
27 class ASTMutationListener;
32 class DeclarationName;
33 class DependentDiagnostic;
38 class LinkageComputer;
39 class LinkageSpecDecl;
43 class ObjCCategoryDecl;
44 class ObjCCategoryImplDecl;
45 class ObjCContainerDecl;
47 class ObjCImplementationDecl;
48 class ObjCInterfaceDecl;
50 class ObjCProtocolDecl;
51 struct PrintingPolicy;
55 class TranslationUnitDecl;
56 class UsingDirectiveDecl;
77 #define DECL(DERIVED, BASE) DERIVED,
78 #define ABSTRACT_DECL(DECL)
79 #define DECL_RANGE(BASE, START, END) \
80 first##BASE = START, last##BASE = END,
81 #define LAST_DECL_RANGE(BASE, START, END) \
82 first##BASE = START, last##BASE = END
83 #include "clang/AST/DeclNodes.inc"
232 llvm::PointerUnion<DeclContext*, MultipleDC*> DeclCtx;
234 inline bool isInSemaDC()
const {
return DeclCtx.is<
DeclContext*>(); }
235 inline bool isOutOfSemaDC()
const {
return DeclCtx.is<MultipleDC*>(); }
236 inline MultipleDC *getMultipleDC()
const {
237 return DeclCtx.get<MultipleDC*>();
247 unsigned DeclKind : 8;
250 unsigned InvalidDecl : 1;
253 unsigned HasAttrs : 1;
257 unsigned Implicit : 1;
267 unsigned Referenced : 1;
270 static bool StatisticsEnabled;
317 bool AccessDeclContextSanity()
const;
323 Loc(L), DeclKind(DK), InvalidDecl(0),
329 if (StatisticsEnabled)
add(DK);
339 if (StatisticsEnabled)
add(DK);
383 return getSemanticDC();
384 return getMultipleDC()->SemanticDC;
413 assert(AccessDeclContextSanity());
417 assert(AccessDeclContextSanity());
458 template <
typename T>
460 if (!HasAttrs)
return;
463 Vec.erase(std::remove_if(Vec.begin(), Vec.end(), isa<T, Attr*>), Vec.end());
469 template <
typename T>
471 return llvm::iterator_range<specific_attr_iterator<T>>(
472 specific_attr_begin<T>(), specific_attr_end<T>());
475 template <
typename T>
479 template <
typename T>
512 bool isUsed(
bool CheckUsedAttr =
true)
const;
570 assert(
isFromASTFile() &&
"Only works on a deserialized declaration");
571 *((
unsigned*)
this - 2) =
ID;
630 return *((
const unsigned*)
this - 1);
638 return *((
const unsigned*)
this - 2);
644 Module *getOwningModuleSlow()
const;
655 return getOwningModuleSlow();
663 return reinterpret_cast<Module *
const *
>(
this)[-1];
667 "should not have a cached owning module");
668 reinterpret_cast<Module **
>(
this)[-1] = M;
699 return getSemanticDC();
700 return getMultipleDC()->LexicalDC;
777 assert(Current &&
"Advancing while iterator has reached end");
780 assert(Next &&
"Should return next redeclaration or itself, never null!");
781 Current = (Next != Starter) ? Next :
nullptr;
792 return x.Current == y.Current;
795 return x.Current != y.Current;
873 return (DeclKind >= Decl::firstFunction &&
874 DeclKind <= Decl::lastFunction) ||
875 DeclKind == FunctionTemplate;
895 "namespace is not ordinary");
924 "namespace includes neither ordinary nor tag");
928 "namespace includes other than ordinary or tag");
935 if (PerformFriendInjection ||
942 if (PerformFriendInjection ||
970 "visible non-member operators should be in ordinary namespace");
978 void print(raw_ostream &Out,
unsigned Indentation = 0,
979 bool PrintInstantiation =
false)
const;
981 unsigned Indentation = 0,
bool PrintInstantiation =
false)
const;
984 unsigned Indentation = 0);
989 void dump(raw_ostream &Out)
const;
1019 const Decl *TheDecl;
1022 const char *Message;
1026 : TheDecl(theDecl), Loc(L), SM(sm), Message(Msg) {}
1028 void print(raw_ostream &OS)
const override;
1041 static NamedDecl *
const SingleElementDummyList;
1046 : Result(Result), Single() {}
1048 : Result(SingleElementDummyList), Single(Single) {}
1051 typedef llvm::iterator_adaptor_base<
iterator, ResultTy::iterator,
1052 std::random_access_iterator_tag,
1055 value_type SingleElement;
1073 bool empty()
const {
return Result.empty(); }
1075 size_t size()
const {
return Single ? 1 : Result.size(); }
1083 Sliced.Single = Single;
1103 unsigned DeclKind : 8;
1108 mutable bool ExternalLexicalStorage : 1;
1113 mutable bool ExternalVisibleStorage : 1;
1119 mutable bool NeedToReconcileExternalVisibleStorage : 1;
1123 mutable bool HasLazyLocalLexicalLookups : 1;
1127 mutable bool HasLazyExternalLexicalLookups : 1;
1155 static std::pair<Decl *, Decl *>
1159 : DeclKind(K), ExternalLexicalStorage(
false),
1160 ExternalVisibleStorage(
false),
1161 NeedToReconcileExternalVisibleStorage(
false),
1162 HasLazyLocalLexicalLookups(
false), HasLazyExternalLexicalLookups(
false),
1175 return cast<Decl>(
this)->getDeclContext();
1191 return cast<Decl>(
this)->getLexicalDeclContext();
1204 return cast<Decl>(
this)->getASTContext();
1208 return DeclKind == Decl::Block;
1213 case Decl::ObjCCategory:
1214 case Decl::ObjCCategoryImpl:
1215 case Decl::ObjCImplementation:
1216 case Decl::ObjCInterface:
1217 case Decl::ObjCProtocol:
1226 case Decl::Captured:
1227 case Decl::ObjCMethod:
1230 return DeclKind >= Decl::firstFunction && DeclKind <= Decl::lastFunction;
1240 return DeclKind == Decl::TranslationUnit || DeclKind == Decl::Namespace;
1244 return DeclKind == Decl::TranslationUnit;
1248 return DeclKind >= Decl::firstRecord && DeclKind <= Decl::lastRecord;
1252 return DeclKind == Decl::Namespace;
1402 return x.Current == y.Current;
1405 return x.Current != y.Current;
1432 template<
typename SpecificDecl>
1442 void SkipToNextDecl() {
1443 while (*Current && !isa<SpecificDecl>(*Current))
1453 typedef std::iterator_traits<DeclContext::decl_iterator>::difference_type
1489 return x.Current == y.Current;
1494 return x.Current != y.Current;
1507 template<
typename SpecificDecl,
bool (SpecificDecl::*Acceptable)() const>
1517 void SkipToNextDecl() {
1519 (!isa<SpecificDecl>(*Current) ||
1520 (Acceptable && !(cast<SpecificDecl>(*Current)->*Acceptable)())))
1530 typedef std::iterator_traits<DeclContext::decl_iterator>::difference_type
1565 return x.Current == y.Current;
1570 return x.Current != y.Current;
1659 typedef llvm::iterator_range<all_lookups_iterator>
lookups_range;
1676 std::random_access_iterator_tag,
1689 typedef llvm::iterator_range<DeclContext::ddiag_iterator>
ddiag_range;
1703 "should only be called on primary context");
1704 HasLazyExternalLexicalLookups =
true;
1721 ExternalLexicalStorage = ES;
1731 ExternalVisibleStorage = ES;
1732 if (ES && LookupPtr)
1733 NeedToReconcileExternalVisibleStorage =
true;
1748 void dumpLookups(llvm::raw_ostream &OS,
bool DumpDecls =
false)
const;
1751 void reconcileExternalVisibleStorage()
const;
1752 bool LoadLexicalDeclsFromExternalStorage()
const;
1760 void makeDeclVisibleInContextInternal(
NamedDecl *D);
1765 void buildLookupImpl(
DeclContext *DCtx,
bool Internal);
1766 void makeDeclVisibleInContextWithFlags(
NamedDecl *D,
bool Internal,
1767 bool Rediscoverable);
1768 void makeDeclVisibleInContextImpl(
NamedDecl *D,
bool Internal);
1772 return getKind() == TemplateTypeParm ||
getKind() == NonTypeTemplateParm ||
1773 getKind() == TemplateTemplateParm;
1777 template <
class ToTy,
1778 bool IsKnownSubtype = ::std::is_base_of<DeclContext, ToTy>::value>
1790 template <
class ToTy>
1793 return static_cast<const ToTy*
>(Val);
1797 return static_cast<ToTy*
>(Val);
1807 template <
typename To>
1809 static bool doit(const ::clang::DeclContext &Val) {
1810 return To::classofKind(Val.getDeclKind());
1815 template<
class ToTy>
1816 struct cast_convert_val<ToTy,
1818 static const ToTy &
doit(const ::clang::DeclContext &Val) {
1822 template<
class ToTy>
1828 template<
class ToTy>
1829 struct cast_convert_val<ToTy,
1831 static const ToTy *
doit(const ::clang::DeclContext *Val) {
1832 return ::clang::cast_convert_decl_context<ToTy>::doit(Val);
1835 template<
class ToTy>
1838 return ::clang::cast_convert_decl_context<ToTy>::doit(Val);
1843 template<
class FromTy>
1845 static ::clang::DeclContext &
doit(
const FromTy &Val) {
1846 return *FromTy::castToDeclContext(&Val);
1850 template<
class FromTy>
1852 static ::clang::DeclContext *
doit(
const FromTy *Val) {
1853 return FromTy::castToDeclContext(Val);
1857 template<
class FromTy>
1859 static const ::clang::DeclContext &
doit(
const FromTy &Val) {
1860 return *FromTy::castToDeclContext(&Val);
1864 template<
class FromTy>
1866 static const ::clang::DeclContext *
doit(
const FromTy *Val) {
1867 return FromTy::castToDeclContext(Val);
decl_iterator noload_decls_end() const
SourceLocation getEnd() const
const value_type * pointer
const DeclContext * getLookupParent() const
ddiag_range ddiags() const
specific_decl_iterator & operator++()
void setImplicit(bool I=true)
redecl_iterator operator++(int)
bool isTransparentContext() const
bool isTemplateParameter() const
void updateOutOfDate(IdentifierInfo &II) const
Update a potentially out-of-date declaration.
static DeclContext * castToDeclContext(const Decl *)
UsingDirectiveDecl * operator*() const
bool isObjCContainer() const
llvm::iterator_range< redecl_iterator > redecl_range
specific_attr_iterator< T > specific_attr_begin() const
std::forward_iterator_tag iterator_category
bool isUnavailable(std::string *Message=nullptr) const
Determine whether this declaration is marked 'unavailable'.
static Decl * castFromDeclContext(const DeclContext *)
void setAttrs(const AttrVec &Attrs)
redecl_iterator redecls_end() const
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
const DeclContext * getParentFunctionOrMethod() const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext...
unsigned CacheValidAndLinkage
If 0, we have not computed the linkage of this declaration. Otherwise, it is the linkage + 1...
std::forward_iterator_tag iterator_category
friend bool operator==(const specific_decl_iterator &x, const specific_decl_iterator &y)
specific_decl_iterator(DeclContext::decl_iterator C)
void setModulePrivate(bool MP=true)
Specify whether this declaration was marked as being private to the module in which it was defined...
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
bool isInStdNamespace() const
bool isStdNamespace() const
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
bool isThisDeclarationReferenced() const
Whether this declaration was referenced. This should not be relied upon for anything other than debug...
StoredDeclsMap * getLookupPtr() const
Retrieve the internal representation of the lookup structure. This may omit some names if we are lazi...
bool isWeakImported() const
Determine whether this is a weak-imported symbol.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
static void printGroup(Decl **Begin, unsigned NumDecls, raw_ostream &Out, const PrintingPolicy &Policy, unsigned Indentation=0)
static ToTy * doit(DeclContext *Val)
SourceLocation getLocEnd() const LLVM_READONLY
Iterates over a filtered subrange of declarations stored in a DeclContext.
void localUncachedLookup(DeclarationName Name, SmallVectorImpl< NamedDecl * > &Results)
A simplistic name lookup mechanism that performs name lookup into this declaration context without co...
unsigned Access
Access - Used by C++ decls for the access specifier.
redecl_iterator & operator++()
Whether this declaration is private to the module in which it was defined.
llvm::iterator_adaptor_base< iterator, ResultTy::iterator, std::random_access_iterator_tag, NamedDecl *const > IteratorBase
AccessSpecifier getAccess() const
const Decl * getNextDeclInContext() const
std::ptrdiff_t difference_type
udir_range using_directives() const
const RecordDecl * getOuterLexicalRecordContext() const
friend bool operator!=(const specific_decl_iterator &x, const specific_decl_iterator &y)
Describes how types, statements, expressions, and declarations should be printed. ...
decl_iterator decls_end() const
static const ToTy * doit(const ::clang::DeclContext *Val)
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
Decl(Kind DK, EmptyShell Empty)
const value_type * pointer
void setHasExternalVisibleStorage(bool ES=true)
State whether this DeclContext has external storage for declarations visible in this context...
void removeDecl(Decl *D)
Removes a declaration from this context.
ASTMutationListener * getASTMutationListener() const
Provides common interface for the Decls that can be redeclared.
unsigned getMaxAlignment() const
bool isDeclInLexicalTraversal(const Decl *D) const
Determine whether the given declaration is stored in the list of declarations lexically within this c...
llvm::iterator_range< decl_iterator > decl_range
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 hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
specific_decl_iterator operator++(int)
bool isInIdentifierNamespace(unsigned NS) const
bool isReferenced() const
Whether any declaration of this entity was referenced.
all_lookups_iterator lookups_end() const
unsigned getIdentifierNamespace() const
bool isTranslationUnit() const
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
void setOwningModuleID(unsigned ID)
Set the owning module ID.
bool isInlineNamespace() const
SmallVector< Attr *, 2 > AttrVec
AttrVec - A vector of Attr, which is how they are stored on the AST.
unsigned FromASTFile
Whether this declaration was loaded from an AST file.
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
static std::pair< Decl *, Decl * > BuildDeclChain(ArrayRef< Decl * > Decls, bool FieldsAlreadyLoaded)
Build up a chain of declarations.
SpecificDecl * value_type
Describes a module or submodule.
friend bool operator!=(const filtered_decl_iterator &x, const filtered_decl_iterator &y)
iterator(pointer Pos, value_type Single=nullptr)
lookups_range noload_lookups() const
DeclContext * getEnclosingNamespaceContext()
Retrieve the nearest enclosing namespace context.
StoredDeclsMap * buildLookup()
Ensure the lookup structure is fully-built and return it.
filtered_decl_iterator(DeclContext::decl_iterator C)
A friend of a previously-undeclared entity.
bool containsDecl(Decl *D) const
Checks whether a declaration is in this context.
value_type operator->() const
void setMustBuildLookupTable()
Mark that there are external lexical declarations that we need to include in our lookup table (and th...
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
const Decl * getMostRecentDecl() const
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
DeclContext * getLexicalDeclContext()
bool hasLocalOwningModuleStorage() const
Labels, declared with 'x:' and referenced with 'goto x'.
void setLocalOwningModule(Module *M)
Module * getLocalOwningModule() const
Get the local owning module, if known. Returns nullptr if owner is not yet known or declaration is no...
value_type operator*() const
decl_iterator decls_begin() const
::clang::DeclContext * doit(const FromTy *Val)
virtual Decl * getMostRecentDeclImpl()
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
iterator::reference reference
bool isFunctionOrFunctionTemplate() const
Whether this declaration is a function or function template.
void addDeclInternal(Decl *D)
Add the declaration D into this context, but suppress searches for external declarations with the sam...
AvailabilityResult
Captures the result of checking the availability of a declaration.
bool isTemplateParameterPack() const
specific_attr_iterator< T > specific_attr_end() const
Decl * getNextDeclInContext()
bool canBeWeakImported(bool &IsDefinition) const
Determines whether this symbol can be weak-imported, e.g., whether it would be well-formed to add the...
AvailabilityResult getAvailability(std::string *Message=nullptr) const
Determine the availability of the given declaration.
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
decl_range noload_decls() const
unsigned getOwningModuleID() const
Retrieve the global ID of the module that owns this particular declaration.
SourceLocation getBodyRBrace() const
ID
Defines the set of possible language-specific address spaces.
lookups_range lookups() const
DeclContext * getLexicalParent()
const char * getDeclKindName() const
bool isLookupContext() const
Test whether the context supports looking up names.
static bool classofKind(Kind K)
static unsigned getIdentifierNamespaceForKind(Kind DK)
llvm::iterator_range< udir_iterator > udir_range
bool isTemplateDecl() const
returns true if this declaration is a template
bool Encloses(const DeclContext *DC) const
Determine whether this declaration context encloses the declaration context DC.
ASTContext & getParentASTContext() const
bool isTopLevelDeclInObjCContainer() const
Whether this declaration is a top-level declaration (function, global variable, etc.) that is lexically inside an objc container definition.
void setInvalidDecl(bool Invalid=true)
value_type operator->() const
bool isInAnonymousNamespace() const
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
bool isLocalExternDecl()
Determine whether this is a block-scope declaration with linkage. This will either be a local variabl...
DeclContext * getDeclContext()
lookup_result noload_lookup(DeclarationName Name)
Find the declarations with the given name that are visible within this context; don't attempt to retr...
Decl * getNonClosureAncestor()
Find the nearest non-closure ancestor of this context, i.e. the innermost semantic parent of this con...
const char * getDeclKindName() const
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
std::forward_iterator_tag iterator_category
static ToTy * doit(::clang::DeclContext *Val)
llvm::iterator_range< all_lookups_iterator > lookups_range
redecl_iterator redecls_begin() const
bool isFunctionOrMethod() const
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Module * getImportedOwningModule() const
Get the imported owning module, if this decl is from an imported (non-local) module.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
const Decl * getNonClosureContext() const
value_type operator->() const
DeclContextLookupResult slice(size_t N) const
void setLocation(SourceLocation L)
all_lookups_iterator lookups_begin() const
Iterators over all possible lookups within this context.
const Decl * getNonClosureAncestor() const
void setDeclContext(DeclContext *DC)
static bool isTagIdentifierNamespace(unsigned NS)
filtered_decl_iterator & operator++()
const value_type & reference
static const ToTy & doit(const ::clang::DeclContext &Val)
static const ::clang::DeclContext * doit(const FromTy *Val)
Abstract interface for external sources of AST nodes.
SourceLocation getLocStart() const LLVM_READONLY
reference operator*() const
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
bool hasTagIdentifierNamespace() const
Iterates through all the redeclarations of the same decl.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
llvm::iterator_adaptor_base< udir_iterator, lookup_iterator, std::random_access_iterator_tag, UsingDirectiveDecl * > udir_iterator_base
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
void setTopLevelDeclInObjCContainer(bool V=true)
SpecificDecl * value_type
bool InEnclosingNamespaceSetOf(const DeclContext *NS) const
Test if this context is part of the enclosing namespace set of the context NS, as defined in C++0x [n...
std::iterator_traits< DeclContext::decl_iterator >::difference_type difference_type
reference operator*() const
ASTContext & getASTContext() const LLVM_READONLY
decl_iterator noload_decls_begin() const
void setReferenced(bool R=true)
static bool classof(const DeclContext *D)
const DeclContext * getEnclosingNamespaceContext() const
udir_iterator(lookup_iterator I)
iterator::pointer pointer
all_lookups_iterator noload_lookups_end() const
A friend of a previously-declared entity.
virtual Stmt * getBody() const
void print(raw_ostream &OS) const override
all_lookups_iterator noload_lookups_begin() const
Iterators over all possible lookups within this context that are currently loaded; don't attempt to r...
DeclContextLookupResult(NamedDecl *Single)
::clang::DeclContext & doit(const FromTy &Val)
void setCachedLinkage(Linkage L) const
Linkage getCachedLinkage() const
SourceLocation getBegin() const
lookup_result lookup(DeclarationName Name) const
friend bool operator==(redecl_iterator x, redecl_iterator y)
bool isFileContext() const
virtual Decl * getNextRedeclarationImpl()
Returns the next redeclaration or itself if this is the only decl.
DeclContextLookupResult lookup_result
bool hasCachedLinkage() const
static ToTy * doit(DeclContext *Val)
bool isExternCXXContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
Defines various enumerations that describe declaration and type specifiers.
std::ptrdiff_t difference_type
reference operator*() const
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl. It will iterate at least once ...
static bool doit(const ::clang::DeclContext &Val)
static const ToTy * doit(const DeclContext *Val)
llvm::iterator_range< attr_iterator > attr_range
llvm::iterator_range< DeclContext::ddiag_iterator > ddiag_range
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
bool isInvalidDecl() const
friend bool operator!=(redecl_iterator x, redecl_iterator y)
Reads an AST files chain containing the contents of a translation unit.
const Decl * getPreviousDecl() const
Retrieve the most recent declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
RecordDecl * getOuterLexicalRecordContext()
Retrieve the outermost lexically enclosing record context.
bool isUsed(bool CheckUsedAttr=true) const
Whether this declaration was used, meaning that a definition is required.
Decl * getNonClosureContext()
decl_iterator operator++(int)
lookup_result::iterator lookup_iterator
const FunctionType * getFunctionType(bool BlocksToo=true) const
Looks through the Decl's underlying type to extract a FunctionType when possible. Will return null if...
bool isDefinedOutsideFunctionOrMethod() const
attr_iterator attr_end() const
void setHasExternalLexicalStorage(bool ES=true)
State whether this DeclContext has external storage for declarations lexically in this context...
void setObjectOfFriendDecl(bool PerformFriendInjection=false)
Changes the namespace of this declaration to reflect that it's the object of a friend declaration...
SmallVector< Context, 8 > Contexts
A dependently-generated diagnostic.
void setLocalExternDecl()
Changes the namespace of this declaration to reflect that it's a function-local extern declaration...
const DeclContext * getLexicalDeclContext() const
std::forward_iterator_tag iterator_category
void setIsUsed()
Set whether the declaration is used, in the sense of odr-use.
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
const TranslationUnitDecl * getTranslationUnitDecl() const
Decl::Kind getDeclKind() const
void setNonMemberOperator()
Specifies that this declaration is a C++ overloaded non-member.
filtered_decl_iterator operator++(int)
static __inline__ uint32_t uint32_t y
An iterator over the dependent diagnostics in a dependent context.
DeclContext * getRedeclContext()
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
static ToTy & doit(::clang::DeclContext &Val)
void addDecl(Decl *D)
Add the declaration D into this context.
AccessSpecifier getAccessUnsafe() const
Retrieve the access specifier for this declaration, even though it may not yet have been properly set...
reference operator[](size_t N) const
void markUsed(ASTContext &C)
Mark the declaration used, in the sense of odr-use.
__PTRDIFF_TYPE__ ptrdiff_t
const DeclContext * getLexicalParent() const
unsigned Hidden
Whether this declaration is hidden from normal name lookup, e.g., because it is was loaded from an AS...
const value_type & reference
const Decl * getCanonicalDecl() const
llvm::PointerIntPair< Decl *, 2, unsigned > NextInContextAndBits
The next declaration within the same lexical DeclContext. These pointers form the linked list that is...
static const ::clang::DeclContext & doit(const FromTy &Val)
friend bool operator==(const filtered_decl_iterator &x, const filtered_decl_iterator &y)
decl_iterator & operator++()
PrettyStackTraceDecl(const Decl *theDecl, SourceLocation L, SourceManager &sm, const char *Msg)
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
virtual bool isOutOfLine() const
void addHiddenDecl(Decl *D)
Add the declaration D to this context without modifying any lookup tables.
const DeclContext * getDeclContext() const
Decl(Kind DK, DeclContext *DC, SourceLocation L)
virtual Decl * getPreviousDeclImpl()
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain...
void dumpDeclContext() const
DeclContext * getLookupParent()
Find the parent context of this context that will be used for unqualified name lookup.
Writes an AST file containing the contents of a translation unit.
static const ToTy * doit(const DeclContext *Val)
static bool classof(const Decl *D)
std::iterator_traits< DeclContext::decl_iterator >::difference_type difference_type
friend class CXXClassMemberWrapper
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC...
Kind
Lists the kind of concrete classes of Decl.
TranslationUnitDecl - The top declaration context.
const DeclContext * getParent() const
value_type operator*() const
DeclContext * getPrimaryContext()
static void EnableStatistics()
friend bool operator==(decl_iterator x, decl_iterator y)
attr_iterator attr_begin() const
unsigned getGlobalID() const
Retrieve the global declaration ID associated with this declaration, which specifies where in the...
DeclContextLookupResult(ArrayRef< NamedDecl * > Result)
bool isParameterPack() const
Whether this declaration is a parameter pack.
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
void setLexicalDeclContext(DeclContext *DC)
void setAccess(AccessSpecifier AS)
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
void collectAllContexts(SmallVectorImpl< DeclContext * > &Contexts)
Collects all of the declaration contexts that are semantically connected to this declaration context...
Represents C++ using-directive.
TranslationUnitDecl * getTranslationUnitDecl()
virtual bool hasBody() const
Returns true if this Decl represents a declaration for a body of code, such as a function or method d...
const DeclContext * getPrimaryContext() const
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined...
This class handles loading and caching of source files into memory.
const DeclContext * getRedeclContext() const
DeclContextLookupResult()
AttrVec::const_iterator attr_iterator
value_type operator->() const
Attr - This represents one attribute.
friend bool operator!=(decl_iterator x, decl_iterator y)
DeclContext(Decl::Kind K)
bool isDeprecated(std::string *Message=nullptr) const
Determine whether this declaration is marked 'deprecated'.
DeclContext * getParentFunctionOrMethod()
bool hasExternalVisibleStorage() const
Whether this DeclContext has external storage containing additional declarations that are visible in ...
Whether this declaration is a top-level declaration (function, global variable, etc.) that is lexically inside an objc container definition.