14 #ifndef LLVM_CLANG_AST_DECLBASE_H 15 #define LLVM_CLANG_AST_DECLBASE_H 22 #include "llvm/ADT/ArrayRef.h" 23 #include "llvm/ADT/PointerIntPair.h" 24 #include "llvm/ADT/PointerUnion.h" 25 #include "llvm/ADT/iterator.h" 26 #include "llvm/ADT/iterator_range.h" 27 #include "llvm/Support/Casting.h" 28 #include "llvm/Support/Compiler.h" 29 #include "llvm/Support/PrettyStackTrace.h" 30 #include "llvm/Support/VersionTuple.h" 36 #include <type_traits> 42 class ASTMutationListener;
45 class ExternalSourceSymbolAttr;
50 class LinkageSpecDecl;
53 class ObjCCategoryDecl;
54 class ObjCCategoryImplDecl;
55 class ObjCContainerDecl;
57 class ObjCImplementationDecl;
58 class ObjCInterfaceDecl;
60 class ObjCProtocolDecl;
61 struct PrintingPolicy;
67 class TranslationUnitDecl;
68 class UsingDirectiveDecl;
90 #define DECL(DERIVED, BASE) DERIVED, 91 #define ABSTRACT_DECL(DECL) 92 #define DECL_RANGE(BASE, START, END) \ 93 first##BASE = START, last##BASE = END, 94 #define LAST_DECL_RANGE(BASE, START, END) \ 95 first##BASE = START, last##BASE = END 96 #include "clang/AST/DeclNodes.inc" 262 llvm::PointerUnion<DeclContext*, MultipleDC*> DeclCtx;
264 bool isInSemaDC()
const {
return DeclCtx.is<
DeclContext*>(); }
265 bool isOutOfSemaDC()
const {
return DeclCtx.is<MultipleDC*>(); }
267 MultipleDC *getMultipleDC()
const {
268 return DeclCtx.get<MultipleDC*>();
279 unsigned DeclKind : 7;
282 unsigned InvalidDecl : 1;
285 unsigned HasAttrs : 1;
289 unsigned Implicit : 1;
299 unsigned Referenced : 1;
304 unsigned TopLevelDeclInObjCContainer : 1;
307 static bool StatisticsEnabled;
349 bool AccessDeclContextSanity()
const;
355 auto *D = cast<Decl>(DC);
356 auto MOK = D->getModuleOwnershipKind();
358 (!D->isFromASTFile() || D->hasLocalOwningModuleStorage()))
368 : NextInContextAndBits(nullptr, getModuleOwnershipKindForChildOf(DC)),
369 DeclCtx(DC), Loc(L), DeclKind(DK), InvalidDecl(
false), HasAttrs(
false),
374 if (StatisticsEnabled)
add(DK);
383 if (StatisticsEnabled)
add(DK);
430 return getSemanticDC();
431 return getMultipleDC()->SemanticDC;
460 assert(AccessDeclContextSanity());
464 assert(AccessDeclContextSanity());
508 template <
typename T>
510 if (!HasAttrs)
return;
513 Vec.erase(std::remove_if(Vec.begin(), Vec.end(), isa<T, Attr*>), Vec.end());
519 template <
typename T>
521 return llvm::make_range(specific_attr_begin<T>(), specific_attr_end<T>());
524 template <
typename T>
529 template <
typename T>
563 bool isUsed(
bool CheckUsedAttr =
true)
const;
590 return TopLevelDeclInObjCContainer;
594 TopLevelDeclInObjCContainer = V;
631 assert(
isFromASTFile() &&
"Only works on a deserialized declaration");
632 *((
unsigned*)
this - 2) =
ID;
655 VersionTuple EnclosingVersion = VersionTuple(),
656 StringRef *RealizedPlatform =
nullptr)
const;
708 return *((
const unsigned*)
this - 1);
716 return *((
const unsigned*)
this - 2);
721 Module *getOwningModuleSlow()
const;
733 return getOwningModuleSlow();
743 "owned local decl but no local module storage");
744 return reinterpret_cast<Module *
const *
>(
this)[-1];
749 "should not have a cached owning module");
750 reinterpret_cast<Module **
>(
this)[-1] = M;
787 return NextInContextAndBits.getInt();
795 "no storage available for owning module for this declaration");
796 NextInContextAndBits.setInt(MOK);
830 return getSemanticDC();
831 return getMultipleDC()->LexicalDC;
904 Decl *Current =
nullptr;
921 assert(Current &&
"Advancing while iterator has reached end");
924 assert(Next &&
"Should return next redeclaration or itself, never null!");
925 Current = (Next != Starter) ? Next :
nullptr;
936 return x.Current == y.Current;
940 return x.Current != y.Current;
1019 return (DeclKind >= Decl::firstFunction &&
1020 DeclKind <= Decl::lastFunction) ||
1021 DeclKind == FunctionTemplate;
1050 "namespace is not ordinary");
1076 "namespace includes neither ordinary nor tag");
1080 "namespace includes other than ordinary or tag");
1087 if (PerformFriendInjection ||
1094 if (PerformFriendInjection ||
1122 "visible non-member operators should be in ordinary namespace");
1130 void print(raw_ostream &Out,
unsigned Indentation = 0,
1131 bool PrintInstantiation =
false)
const;
1133 unsigned Indentation = 0,
bool PrintInstantiation =
false)
const;
1136 unsigned Indentation = 0);
1144 void dump(raw_ostream &Out,
bool Deserialize =
false)
const;
1174 const Decl *TheDecl;
1177 const char *Message;
1182 : TheDecl(theDecl), Loc(L), SM(sm), Message(Msg) {}
1184 void print(raw_ostream &OS)
const override;
1199 static NamedDecl *
const SingleElementDummyList;
1206 : Result(SingleElementDummyList), Single(Single) {}
1211 llvm::iterator_adaptor_base<
iterator, ResultTy::iterator,
1212 std::random_access_iterator_tag,
1216 value_type SingleElement;
1219 iterator() =
default;
1232 iterator
begin()
const {
return iterator(Result.begin(), Single); }
1233 iterator
end()
const {
return iterator(Result.end(), Single); }
1235 bool empty()
const {
return Result.empty(); }
1237 size_t size()
const {
return Single ? 1 : Result.size(); }
1245 Sliced.Single = Single;
1266 unsigned DeclKind : 8;
1271 mutable bool ExternalLexicalStorage : 1;
1276 mutable bool ExternalVisibleStorage : 1;
1282 mutable bool NeedToReconcileExternalVisibleStorage : 1;
1286 mutable bool HasLazyLocalLexicalLookups : 1;
1290 mutable bool HasLazyExternalLexicalLookups : 1;
1295 mutable bool UseQualifiedLookup : 1;
1323 static std::pair<Decl *, Decl *>
1327 : DeclKind(K), ExternalLexicalStorage(
false),
1328 ExternalVisibleStorage(
false),
1329 NeedToReconcileExternalVisibleStorage(
false),
1330 HasLazyLocalLexicalLookups(
false), HasLazyExternalLexicalLookups(
false),
1331 UseQualifiedLookup(
false) {}
1347 return const_cast<DeclContext*
>(
this)->getParent();
1363 return const_cast<DeclContext*
>(
this)->getLexicalParent();
1369 return const_cast<DeclContext*
>(
this)->getLookupParent();
1377 return DeclKind == Decl::Block;
1382 case Decl::ObjCCategory:
1383 case Decl::ObjCCategoryImpl:
1384 case Decl::ObjCImplementation:
1385 case Decl::ObjCInterface:
1386 case Decl::ObjCProtocol:
1395 case Decl::Captured:
1396 case Decl::ObjCMethod:
1399 return DeclKind >= Decl::firstFunction && DeclKind <= Decl::lastFunction;
1406 DeclKind != Decl::Export;
1410 return DeclKind == Decl::TranslationUnit || DeclKind == Decl::Namespace;
1414 return DeclKind == Decl::TranslationUnit;
1418 return DeclKind >= Decl::firstRecord && DeclKind <= Decl::lastRecord;
1422 return DeclKind == Decl::Namespace;
1427 bool isInlineNamespace()
const;
1431 bool isDependentContext()
const;
1448 bool isTransparentContext()
const;
1452 bool isExternCContext()
const;
1459 bool isExternCXXContext()
const;
1474 Decl *getNonClosureAncestor();
1476 return const_cast<DeclContext*
>(
this)->getNonClosureAncestor();
1487 return const_cast<DeclContext*
>(
this)->getPrimaryContext();
1495 return const_cast<DeclContext *
>(
this)->getRedeclContext();
1501 return const_cast<DeclContext *
>(
this)->getEnclosingNamespaceContext();
1507 return const_cast<DeclContext *
>(
this)->getOuterLexicalRecordContext();
1516 bool InEnclosingNamespaceSetOf(
const DeclContext *NS)
const;
1547 Decl *Current =
nullptr;
1576 return x.Current == y.Current;
1580 return x.Current != y.Current;
1591 bool decls_empty()
const;
1597 return decl_range(noload_decls_begin(), noload_decls_end());
1607 template<
typename SpecificDecl>
1617 void SkipToNextDecl() {
1618 while (*Current && !isa<SpecificDecl>(*Current))
1629 std::iterator_traits<DeclContext::decl_iterator>::difference_type;
1665 return x.Current == y.Current;
1670 return x.Current != y.Current;
1683 template<
typename SpecificDecl,
bool (SpecificDecl::*Acceptable)() const>
1693 void SkipToNextDecl() {
1695 (!isa<SpecificDecl>(*Current) ||
1696 (Acceptable && !(cast<SpecificDecl>(*Current)->*Acceptable)())))
1707 std::iterator_traits<DeclContext::decl_iterator>::difference_type;
1741 return x.Current == y.Current;
1746 return x.Current != y.Current;
1762 void addDecl(
Decl *D);
1772 void addDeclInternal(
Decl *D);
1780 void addHiddenDecl(
Decl *D);
1783 void removeDecl(
Decl *D);
1786 bool containsDecl(
Decl *D)
const;
1790 bool containsDeclAndLoad(
Decl *D)
const;
1833 void makeDeclVisibleInContext(
NamedDecl *D);
1844 lookups_range noload_lookups(
bool PreserveInternalState)
const;
1860 std::random_access_iterator_tag,
1876 using ddiag_range = llvm::iterator_range<DeclContext::ddiag_iterator>;
1889 assert(
this == getPrimaryContext() &&
1890 "should only be called on primary context");
1891 HasLazyExternalLexicalLookups =
true;
1908 ExternalLexicalStorage = ES;
1918 ExternalVisibleStorage = ES;
1919 if (ES && LookupPtr)
1920 NeedToReconcileExternalVisibleStorage =
true;
1931 bool old_value = UseQualifiedLookup;
1932 UseQualifiedLookup = use;
1937 return UseQualifiedLookup;
1943 void dumpDeclContext()
const;
1944 void dumpLookups()
const;
1945 void dumpLookups(llvm::raw_ostream &OS,
bool DumpDecls =
false,
1946 bool Deserialize =
false)
const;
1951 void reconcileExternalVisibleStorage()
const;
1952 bool LoadLexicalDeclsFromExternalStorage()
const;
1960 void makeDeclVisibleInContextInternal(
NamedDecl *D);
1964 void loadLazyLocalLexicalLookups();
1965 void buildLookupImpl(
DeclContext *DCtx,
bool Internal);
1966 void makeDeclVisibleInContextWithFlags(
NamedDecl *D,
bool Internal,
1967 bool Rediscoverable);
1968 void makeDeclVisibleInContextImpl(
NamedDecl *D,
bool Internal);
1972 return getKind() == TemplateTypeParm ||
getKind() == NonTypeTemplateParm ||
1973 getKind() == TemplateTemplateParm;
1977 template <
class ToTy,
1978 bool IsKnownSubtype = ::std::is_base_of<DeclContext, ToTy>::value>
1990 template <
class ToTy>
1993 return static_cast<const ToTy*
>(Val);
1997 return static_cast<ToTy*
>(Val);
2006 template <
typename To>
2008 static bool doit(const ::clang::DeclContext &Val) {
2009 return To::classofKind(Val.getDeclKind());
2014 template<
class ToTy>
2015 struct cast_convert_val<ToTy,
2017 static const ToTy &
doit(const ::clang::DeclContext &Val) {
2022 template<
class ToTy>
2029 template<
class ToTy>
2030 struct cast_convert_val<ToTy,
2032 static const ToTy *
doit(const ::clang::DeclContext *Val) {
2033 return ::clang::cast_convert_decl_context<ToTy>::doit(Val);
2037 template<
class ToTy>
2040 return ::clang::cast_convert_decl_context<ToTy>::doit(Val);
2045 template<
class FromTy>
2047 static ::clang::DeclContext &
doit(
const FromTy &Val) {
2048 return *FromTy::castToDeclContext(&Val);
2052 template<
class FromTy>
2054 static ::clang::DeclContext *
doit(
const FromTy *Val) {
2055 return FromTy::castToDeclContext(Val);
2059 template<
class FromTy>
2061 static const ::clang::DeclContext &
doit(
const FromTy &Val) {
2062 return *FromTy::castToDeclContext(&Val);
2066 template<
class FromTy>
2068 static const ::clang::DeclContext *
doit(
const FromTy *Val) {
2069 return FromTy::castToDeclContext(Val);
2075 #endif // LLVM_CLANG_AST_DECLBASE_H
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.
bool shouldUseQualifiedLookup() const
specific_decl_iterator & operator++()
void setImplicit(bool I=true)
Represents a function declaration or definition.
redecl_iterator operator++(int)
const Decl * getCanonicalDecl() const
decl_iterator noload_decls_begin() const
llvm::iterator_range< redecl_iterator > redecl_range
static DeclContext * castToDeclContext(const Decl *)
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
const char * getDeclKindName() const
llvm::PointerIntPair< Decl *, 2, ModuleOwnershipKind > NextInContextAndBits
The next declaration within the same lexical DeclContext.
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
static Decl * castFromDeclContext(const DeclContext *)
value_type operator*() const
This declaration has an owning module, but is only visible to lookups that occur within that module...
bool isLookupContext() const
Test whether the context supports looking up names.
virtual Stmt * getBody() const
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
void setAttrs(const AttrVec &Attrs)
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Module * getOwningModuleForLinkage(bool IgnoreLinkage=false) const
Get the module that owns this declaration for linkage purposes.
attr_iterator attr_begin() const
specific_attr_iterator< T > specific_attr_begin() const
Stmt - This represents one statement.
FunctionType - C99 6.7.5.3 - Function Declarators.
unsigned CacheValidAndLinkage
If 0, we have not computed the linkage of this declaration.
Decl - This represents one declaration (or definition), e.g.
specific_attr_iterator - Iterates over a subrange of an AttrVec, only providing attributes that are o...
friend bool operator==(const specific_decl_iterator &x, const specific_decl_iterator &y)
SourceLocation getBeginLoc() const LLVM_READONLY
specific_decl_iterator(DeclContext::decl_iterator C)
specific_decl_iterator - Construct a new iterator over a subset of the declarations the range [C...
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
static ToTy & doit(::clang::DeclContext &Val)
static bool doit(const ::clang::DeclContext &Val)
bool isObjCContainer() const
SourceLocation getEndLoc() const LLVM_READONLY
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)
bool isDeclInLexicalTraversal(const Decl *D) const
Determine whether the given declaration is stored in the list of declarations lexically within this c...
static ToTy * doit(DeclContext *Val)
SourceLocation getLocEnd() const LLVM_READONLY
bool hasExternalVisibleStorage() const
Whether this DeclContext has external storage containing additional declarations that are visible in ...
Iterates over a filtered subrange of declarations stored in a DeclContext.
unsigned getIdentifierNamespace() const
const DeclContext * getParentFunctionOrMethod() const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext...
unsigned Access
Access - Used by C++ decls for the access specifier.
redecl_iterator & operator++()
reference operator*() const
ModuleOwnershipKind
The kind of ownership a declaration has, for visibility purposes.
bool hasOwningModule() const
Is this declaration owned by some module?
ASTMutationListener * getASTMutationListener() const
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
bool hasLocalOwningModuleStorage() const
bool isInvalidDecl() const
friend bool operator!=(const specific_decl_iterator &x, const specific_decl_iterator &y)
ExternalSourceSymbolAttr * getExternalSourceSymbolAttr() const
Looks on this and related declarations for an applicable external source symbol attribute.
Describes how types, statements, expressions, and declarations should be printed. ...
bool isParameterPack() const
Whether this declaration is a parameter pack.
static const ToTy * doit(const ::clang::DeclContext *Val)
Module * getLocalOwningModule() const
Get the local owning module, if known.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
Decl(Kind DK, EmptyShell Empty)
void setHasExternalVisibleStorage(bool ES=true)
State whether this DeclContext has external storage for declarations visible in this context...
value_type operator->() const
Types, declared with 'struct foo', typedefs, etc.
bool isLexicallyWithinFunctionOrMethod() const
Returns true if this declaration lexically is inside a function.
Represents a struct/union/class.
Provides common interface for the Decls that can be redeclared.
One of these records is kept for each identifier that is lexed.
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
bool isInAnonymousNamespace() const
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.
attr_iterator attr_end() const
specific_decl_iterator operator++(int)
llvm::iterator_range< decl_iterator > decl_range
std::forward_iterator_tag iterator_category
This declaration is a friend function.
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible...
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
void setOwningModuleID(unsigned ID)
Set the owning module ID.
bool isDefinedOutsideFunctionOrMethod() const
isDefinedOutsideFunctionOrMethod - This predicate returns true if this scoped decl is defined outside...
bool isInIdentifierNamespace(unsigned NS) const
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC...
unsigned FromASTFile
Whether this declaration was loaded from an AST file.
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
specific_attr_iterator< T > specific_attr_end() const
Describes a module or submodule.
value_type operator*() const
bool isDeprecated(std::string *Message=nullptr) const
Determine whether this declaration is marked 'deprecated'.
friend bool operator!=(const filtered_decl_iterator &x, const filtered_decl_iterator &y)
iterator(pointer Pos, value_type Single=nullptr)
bool isReferenced() const
Whether any declaration of this entity was referenced.
Namespaces, declared with 'namespace foo {}'.
bool hasTagIdentifierNamespace() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
const DeclContext * getLexicalDeclContext() const
ModuleOwnershipKind getModuleOwnershipKind() const
Get the kind of module ownership for this declaration.
std::forward_iterator_tag iterator_category
filtered_decl_iterator(DeclContext::decl_iterator C)
filtered_decl_iterator - Construct a new iterator over a subset of the declarations the range [C...
static bool isStdNamespace(const DeclContext *DC)
A friend of a previously-undeclared entity.
std::forward_iterator_tag iterator_category
DeclContextLookupResult slice(size_t N) 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.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
std::iterator_traits< DeclContext::decl_iterator >::difference_type difference_type
std::ptrdiff_t difference_type
Labels, declared with 'x:' and referenced with 'goto x'.
void setLocalOwningModule(Module *M)
Represents a linkage specification.
::clang::DeclContext * doit(const FromTy *Val)
bool isExported() const
Whether this declaration is exported (by virtue of being lexically within an ExportDecl or by being a...
virtual Decl * getMostRecentDeclImpl()
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
void setCachedLinkage(Linkage L) const
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
AvailabilityResult
Captures the result of checking the availability of a declaration.
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...
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
AvailabilityResult getAvailability(std::string *Message=nullptr, VersionTuple EnclosingVersion=VersionTuple(), StringRef *RealizedPlatform=nullptr) const
Determine the availability of the given declaration.
This declaration is a C++ operator declared in a non-class context.
static ToTy * doit(::clang::DeclContext *Val)
llvm::iterator_range< udir_iterator > udir_range
decl_range noload_decls() const
noload_decls_begin/end - Iterate over the declarations stored in this context that are currently load...
std::ptrdiff_t difference_type
const DeclContext * getLookupParent() const
const FunctionType * getFunctionType(bool BlocksToo=true) const
Looks through the Decl's underlying type to extract a FunctionType when possible. ...
This declaration is a friend class.
const Decl * getNonClosureContext() const
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
const Attr * getDefiningAttr() const
Return this declaration's defining attribute if it has one.
llvm::iterator_range< all_lookups_iterator > lookups_range
static bool classofKind(Kind K)
static unsigned getIdentifierNamespaceForKind(Kind DK)
StoredDeclsMap * getLookupPtr() const
Retrieve the internal representation of the lookup structure.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
This declaration is an OpenMP user defined reduction construction.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Module * getImportedOwningModule() const
Get the imported owning module, if this decl is from an imported (non-local) module.
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
DeclContextLookupResult(ArrayRef< NamedDecl *> Result)
const Decl * getNextDeclInContext() const
bool isLocalExternDecl()
Determine whether this is a block-scope declaration with linkage.
bool isFileContext() const
DeclContext * getDeclContext()
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
redecl_iterator redecls_end() const
bool isTemplateParameter() const
isTemplateParameter - Determines whether this declaration is a template parameter.
bool isTemplateParameterPack() const
isTemplateParameter - Determines whether this declaration is a template parameter pack...
void setModulePrivate()
Specify that this declaration was marked as being private to the module in which it was defined...
llvm::iterator_range< attr_iterator > attr_range
const DeclContext * getParent() const
bool isFunctionOrMethod() const
reference operator[](size_t N) const
unsigned getMaxAlignment() const
getMaxAlignment - return the maximum alignment specified by attributes on this decl, 0 if there are none.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
SourceLocation getEnd() const
void setLocation(SourceLocation L)
const FunctionDecl * getAsFunction() const
The result type of a method or function.
unsigned IdentifierNamespace
IdentifierNamespace - This specifies what IDNS_* namespace this lives in.
const DeclContext * getDeclContext() const
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
SmallVector< Attr *, 4 > AttrVec
AttrVec - A vector of Attr, which is how they are stored on the AST.
reference operator*() const
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
static bool isTagIdentifierNamespace(unsigned NS)
virtual bool hasBody() const
Returns true if this Decl represents a declaration for a body of code, such as a function or method d...
filtered_decl_iterator & operator++()
static const ToTy & doit(const ::clang::DeclContext &Val)
static const ::clang::DeclContext * doit(const FromTy *Val)
iterator::reference reference
Abstract interface for external sources of AST nodes.
SourceLocation getLocStart() const LLVM_READONLY
bool isTemplateDecl() const
returns true if this declaration is a template
Decl::Kind getDeclKind() const
This declaration has an owning module, but is globally visible (typically because its owning module i...
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.
VersionTuple getVersionIntroduced() const
Retrieve the version of the target platform in which this declaration was introduced.
Encodes a location in the source.
SpecificDecl * value_type
void setTopLevelDeclInObjCContainer(bool V=true)
Members, declared with object declarations within tag definitions.
all_lookups_iterator - An iterator that provides a view over the results of looking up every possible...
void setModuleOwnershipKind(ModuleOwnershipKind MOK)
Set whether this declaration is hidden from name lookup.
value_type operator->() const
The nullability qualifier is set when the nullability of the result or parameter was expressed via a ...
ASTContext & getASTContext() const LLVM_READONLY
void setReferenced(bool R=true)
static bool classof(const DeclContext *D)
std::forward_iterator_tag iterator_category
udir_iterator(lookup_iterator I)
bool hasCachedLinkage() const
A friend of a previously-declared entity.
DeclContextLookupResult(NamedDecl *Single)
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
::clang::DeclContext & doit(const FromTy &Val)
Linkage getCachedLinkage() const
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
friend bool operator==(redecl_iterator x, redecl_iterator y)
llvm::iterator_range< DeclContext::ddiag_iterator > ddiag_range
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
value_type operator->() const
virtual Decl * getNextRedeclarationImpl()
Returns the next redeclaration or itself if this is the only decl.
static ToTy * doit(DeclContext *Val)
decl_iterator noload_decls_end() const
__PTRDIFF_TYPE__ ptrdiff_t
A signed integer type that is the result of subtracting two pointers.
virtual bool isOutOfLine() const
Determine whether this declaration is declared out of line (outside its semantic context).
bool isWeakImported() const
Determine whether this is a weak-imported symbol.
Defines various enumerations that describe declaration and type specifiers.
decl_iterator - Iterates through the declarations stored within this context.
bool isThisDeclarationReferenced() const
Whether this declaration was referenced.
redecl_iterator redecls_begin() const
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
static const ToTy * doit(const DeclContext *Val)
Dataflow Directional Tag Classes.
void updateOutOfDate(IdentifierInfo &II) const
Update a potentially out-of-date declaration.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
The base class of all kinds of template declarations (e.g., class, function, etc.).
bool isTopLevelDeclInObjCContainer() const
Whether this declaration is a top-level declaration (function, global variable, etc.) that is lexically inside an objc container definition.
const Decl * getMostRecentDecl() const
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
bool isFunctionOrFunctionTemplate() const
Whether this declaration is a function or function template.
friend bool operator!=(redecl_iterator x, redecl_iterator y)
Reads an AST files chain containing the contents of a translation unit.
AttrVec::const_iterator attr_iterator
AccessSpecifier getAccess() const
IdentifierNamespace
IdentifierNamespace - The different namespaces in which declarations may appear.
DeclarationName - The name of a declaration.
Decl * getNonClosureContext()
Find the innermost non-closure ancestor of this declaration, walking up through blocks, lambdas, etc.
decl_iterator operator++(int)
const Decl * getNonClosureAncestor() const
Tags, declared with 'struct foo;' and referenced with 'struct foo'.
bool isHidden() const
Determine whether this declaration might be hidden from name lookup.
void setHasExternalLexicalStorage(bool ES=true)
State whether this DeclContext has external storage for declarations lexically in this context...
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext, providing only those that are of type SpecificDecl (or a class derived from it).
This declaration is not owned by a module.
void setObjectOfFriendDecl(bool PerformFriendInjection=false)
Changes the namespace of this declaration to reflect that it's the object of a friend declaration...
A dependently-generated diagnostic.
void setLocalExternDecl()
Changes the namespace of this declaration to reflect that it's a function-local extern declaration...
const RecordDecl * getOuterLexicalRecordContext() const
void setIsUsed()
Set whether the declaration is used, in the sense of odr-use.
static bool classof(const OMPClause *T)
static bool isFunctionOrMethod(const Decl *D)
isFunctionOrMethod - Return true if the given decl has function type (function or function-typed vari...
void setNonMemberOperator()
Specifies that this declaration is a C++ overloaded non-member.
unsigned getOwningModuleID() const
Retrieve the global ID of the module that owns this particular declaration.
filtered_decl_iterator operator++(int)
const DeclContext * getLexicalParent() const
unsigned getGlobalID() const
Retrieve the global declaration ID associated with this declaration, which specifies where this Decl ...
An iterator over the dependent diagnostics in a dependent context.
iterator::pointer pointer
SpecificDecl * value_type
reference operator*() const
void markUsed(ASTContext &C)
Mark the declaration used, in the sense of odr-use.
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
static const ::clang::DeclContext & doit(const FromTy &Val)
Defines the clang::SourceLocation class and associated facilities.
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
friend bool operator==(const filtered_decl_iterator &x, const filtered_decl_iterator &y)
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
decl_iterator & operator++()
PrettyStackTraceDecl(const Decl *theDecl, SourceLocation L, SourceManager &sm, const char *Msg)
const DeclContext * getEnclosingNamespaceContext() const
value_type operator->() const
const DeclContext * getPrimaryContext() 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...
Writes an AST file containing the contents of a translation unit.
static const ToTy * doit(const DeclContext *Val)
friend class CXXClassMemberWrapper
ASTContext & getParentASTContext() const
Kind
Lists the kind of concrete classes of Decl.
The top declaration context.
This declaration is a function-local extern declaration of a variable or function.
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
static void EnableStatistics()
friend bool operator==(decl_iterator x, decl_iterator y)
AccessSpecifier getAccessUnsafe() const
Retrieve the access specifier for this declaration, even though it may not yet have been properly set...
bool setUseQualifiedLookup(bool use=true)
A trivial tuple used to represent a source range.
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined...
void setLexicalDeclContext(DeclContext *DC)
This represents a decl that may have a name.
bool isTranslationUnit() const
void setAccess(AccessSpecifier AS)
const TranslationUnitDecl * getTranslationUnitDecl() const
TemplateDecl * getDescribedTemplate() const
If this is a declaration that describes some template, this method returns that template declaration...
Represents C++ using-directive.
bool hasDefiningAttr() const
Return true if this declaration has an attribute which acts as definition of the entity, such as 'alias' or 'ifunc'.
bool isInStdNamespace() const
SourceLocation getBegin() const
TranslationUnitDecl * getTranslationUnitDecl()
bool isTemplated() const
Determine whether this declaration is a templated entity (whether it is.
This class handles loading and caching of source files into memory.
SourceLocation getBodyRBrace() const
getBodyRBrace - Gets the right brace of the body, if a body exists.
Attr - This represents one attribute.
SourceLocation getLocation() const
friend bool operator!=(decl_iterator x, decl_iterator y)
const DeclContext * getRedeclContext() const
DeclContext(Decl::Kind K)
bool isUnavailable(std::string *Message=nullptr) const
Determine whether this declaration is marked 'unavailable'.
decl_iterator decls_end() const
This declaration is a using declaration.
std::iterator_traits< DeclContext::decl_iterator >::difference_type difference_type
DeclContext * getParentFunctionOrMethod()
PrettyStackTraceDecl - If a crash occurs, indicate that it happened when doing something to a specifi...