14 #ifndef LLVM_CLANG_AST_DECLBASE_H 15 #define LLVM_CLANG_AST_DECLBASE_H 23 #include "llvm/ADT/ArrayRef.h" 24 #include "llvm/ADT/PointerIntPair.h" 25 #include "llvm/ADT/PointerUnion.h" 26 #include "llvm/ADT/iterator.h" 27 #include "llvm/ADT/iterator_range.h" 28 #include "llvm/Support/Casting.h" 29 #include "llvm/Support/Compiler.h" 30 #include "llvm/Support/PrettyStackTrace.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;
86 class LLVM_ALIGNAS( 8)
Decl {
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" 136 IDNS_Member = 0x0008,
140 IDNS_Namespace = 0x0010,
144 IDNS_Ordinary = 0x0020,
147 IDNS_ObjCProtocol = 0x0040,
152 IDNS_OrdinaryFriend = 0x0080,
157 IDNS_TagFriend = 0x0100,
168 IDNS_NonMemberOperator = 0x0400,
175 IDNS_LocalExtern = 0x0800,
178 IDNS_OMPReduction = 0x1000
200 OBJC_TQ_Bycopy = 0x8,
201 OBJC_TQ_Byref = 0x10,
202 OBJC_TQ_Oneway = 0x20,
207 OBJC_TQ_CSNullability = 0x40
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;
313 friend class CXXClassMemberWrapper;
348 bool AccessDeclContextSanity()
const;
354 auto *D = cast<Decl>(DC);
355 auto MOK = D->getModuleOwnershipKind();
356 if (MOK != ModuleOwnershipKind::Unowned &&
357 (!D->isFromASTFile() || D->hasLocalOwningModuleStorage()))
362 return ModuleOwnershipKind::Unowned;
367 : NextInContextAndBits(nullptr, getModuleOwnershipKindForChildOf(DC)),
368 DeclCtx(DC), Loc(L), DeclKind(DK), InvalidDecl(
false), HasAttrs(
false),
370 TopLevelDeclInObjCContainer(
false), Access(
AS_none), FromASTFile(0),
372 CacheValidAndLinkage(0) {
373 if (StatisticsEnabled) add(DK);
379 Access(
AS_none), FromASTFile(0),
381 CacheValidAndLinkage(0) {
382 if (StatisticsEnabled) add(DK);
391 return Linkage(CacheValidAndLinkage - 1);
395 CacheValidAndLinkage = L + 1;
399 return CacheValidAndLinkage;
420 const char *getDeclKindName()
const;
427 return getSemanticDC();
428 return getMultipleDC()->SemanticDC;
431 return const_cast<Decl*
>(
this)->getDeclContext();
446 return const_cast<Decl*
>(
this)->getTranslationUnitDecl();
449 bool isInAnonymousNamespace()
const;
451 bool isInStdNamespace()
const;
453 ASTContext &getASTContext()
const LLVM_READONLY;
457 assert(AccessDeclContextSanity());
461 assert(AccessDeclContextSanity());
474 return setAttrsImpl(Attrs, getASTContext());
478 return const_cast<AttrVec&
>(
const_cast<const Decl*
>(
this)->getAttrs());
481 const AttrVec &getAttrs()
const;
486 getAttrs().push_back(A);
499 return hasAttrs() ? getAttrs().begin() :
nullptr;
502 return hasAttrs() ? getAttrs().end() :
nullptr;
505 template <
typename T>
507 if (!HasAttrs)
return;
510 Vec.erase(std::remove_if(Vec.begin(), Vec.end(), isa<T, Attr*>), Vec.end());
516 template <
typename T>
518 return llvm::make_range(specific_attr_begin<T>(), specific_attr_end<T>());
521 template <
typename T>
526 template <
typename T>
532 return hasAttrs() ? getSpecificAttr<T>(getAttrs()) :
nullptr;
536 return hasAttrs() && hasSpecificAttr<T>(getAttrs());
541 unsigned getMaxAlignment()
const;
545 void setInvalidDecl(
bool Invalid =
true);
560 bool isUsed(
bool CheckUsedAttr =
true)
const;
575 bool isReferenced()
const;
587 return TopLevelDeclInObjCContainer;
591 TopLevelDeclInObjCContainer = V;
596 ExternalSourceSymbolAttr *getExternalSourceSymbolAttr()
const;
601 return getModuleOwnershipKind() == ModuleOwnershipKind::ModulePrivate;
606 bool isExported()
const;
610 bool hasDefiningAttr()
const;
613 const Attr *getDefiningAttr()
const;
621 if (getModuleOwnershipKind() == ModuleOwnershipKind::Unowned)
623 setModuleOwnershipKind(ModuleOwnershipKind::ModulePrivate);
628 assert(isFromASTFile() &&
"Only works on a deserialized declaration");
629 *((
unsigned*)
this - 2) =
ID;
647 getAvailability(std::string *Message =
nullptr,
682 bool isWeakImported()
const;
690 bool canBeWeakImported(
bool &IsDefinition)
const;
700 return *((
const unsigned*)
this - 1);
708 return *((
const unsigned*)
this - 2);
713 Module *getOwningModuleSlow()
const;
716 bool hasLocalOwningModuleStorage()
const;
722 if (!isFromASTFile() || !hasOwningModule())
725 return getOwningModuleSlow();
731 if (isFromASTFile() || !hasOwningModule())
734 assert(hasLocalOwningModuleStorage() &&
735 "owned local decl but no local module storage");
736 return reinterpret_cast<Module *
const *
>(
this)[-1];
739 assert(!isFromASTFile() && hasOwningModule() &&
740 hasLocalOwningModuleStorage() &&
741 "should not have a cached owning module");
742 reinterpret_cast<Module **
>(
this)[-1] = M;
747 return getModuleOwnershipKind() != ModuleOwnershipKind::Unowned;
752 return isFromASTFile() ? getImportedOwningModule() : getLocalOwningModule();
760 Module *getOwningModuleForLinkage(
bool IgnoreLinkage =
false)
const;
767 return (
int)getModuleOwnershipKind() > (int)ModuleOwnershipKind::Visible;
774 setModuleOwnershipKind(ModuleOwnershipKind::Visible);
779 return NextInContextAndBits.getInt();
784 assert(!(getModuleOwnershipKind() == ModuleOwnershipKind::Unowned &&
785 MOK != ModuleOwnershipKind::Unowned && !isFromASTFile() &&
786 !hasLocalOwningModuleStorage()) &&
787 "no storage available for owning module for this declaration");
788 NextInContextAndBits.setInt(MOK);
796 return getIdentifierNamespace() & NS;
799 static unsigned getIdentifierNamespaceForKind(
Kind DK);
802 return isTagIdentifierNamespace(getIdentifierNamespace());
807 return (NS & ~IDNS_TagFriend) == (IDNS_Tag | IDNS_Type);
822 return getSemanticDC();
823 return getMultipleDC()->LexicalDC;
826 return const_cast<Decl*
>(
this)->getLexicalDeclContext();
831 virtual bool isOutOfLine()
const;
841 bool isTemplated()
const;
848 return getParentFunctionOrMethod() ==
nullptr;
858 bool isLexicallyWithinFunctionOrMethod()
const;
862 const DeclContext *getParentFunctionOrMethod()
const;
865 const_cast<const Decl*
>(
this)->getParentFunctionOrMethod());
896 Decl *Current =
nullptr;
913 assert(Current &&
"Advancing while iterator has reached end");
916 assert(Next &&
"Should return next redeclaration or itself, never null!");
917 Current = (Next != Starter) ? Next :
nullptr;
928 return x.Current == y.Current;
932 return x.Current != y.Current;
957 return const_cast<Decl *
>(
this)->getPreviousDeclImpl();
962 return getPreviousDecl() ==
nullptr;
972 return const_cast<Decl *
>(
this)->getMostRecentDeclImpl();
984 virtual bool hasBody()
const {
return getBody() !=
nullptr; }
991 static void add(
Kind k);
992 static void EnableStatistics();
993 static void PrintStats();
997 bool isTemplateParameter()
const;
1001 bool isTemplateParameterPack()
const;
1004 bool isParameterPack()
const;
1007 bool isTemplateDecl()
const;
1011 return (DeclKind >= Decl::firstFunction &&
1012 DeclKind <= Decl::lastFunction) ||
1013 DeclKind == FunctionTemplate;
1025 return const_cast<Decl *
>(
this)->getAsFunction();
1035 Decl *Prev = getPreviousDecl();
1042 "namespace is not ordinary");
1065 assert((OldNS & (IDNS_Tag | IDNS_Ordinary |
1066 IDNS_TagFriend | IDNS_OrdinaryFriend |
1067 IDNS_LocalExtern)) &&
1068 "namespace includes neither ordinary nor tag");
1069 assert(!(OldNS & ~(IDNS_Tag | IDNS_Ordinary | IDNS_Type |
1070 IDNS_TagFriend | IDNS_OrdinaryFriend |
1071 IDNS_LocalExtern)) &&
1072 "namespace includes other than ordinary or tag");
1074 Decl *Prev = getPreviousDecl();
1077 if (OldNS & (IDNS_Tag | IDNS_TagFriend)) {
1079 if (PerformFriendInjection ||
1084 if (OldNS & (IDNS_Ordinary | IDNS_OrdinaryFriend | IDNS_LocalExtern)) {
1086 if (PerformFriendInjection ||
1105 if (!mask)
return FOK_None;
1114 "visible non-member operators should be in ordinary namespace");
1122 void print(raw_ostream &Out,
unsigned Indentation = 0,
1123 bool PrintInstantiation =
false)
const;
1125 unsigned Indentation = 0,
bool PrintInstantiation =
false)
const;
1126 static void printGroup(
Decl**
Begin,
unsigned NumDecls,
1128 unsigned Indentation = 0);
1134 void dumpColor()
const;
1136 void dump(raw_ostream &Out,
bool Deserialize =
false)
const;
1141 const FunctionType *getFunctionType(
bool BlocksToo =
true)
const;
1166 const Decl *TheDecl;
1169 const char *Message;
1174 : TheDecl(theDecl), Loc(L), SM(sm), Message(Msg) {}
1176 void print(raw_ostream &OS)
const override;
1191 static NamedDecl *
const SingleElementDummyList;
1198 : Result(SingleElementDummyList), Single(Single) {}
1203 llvm::iterator_adaptor_base<
iterator, ResultTy::iterator,
1204 std::random_access_iterator_tag,
1208 value_type SingleElement;
1211 iterator() =
default;
1224 iterator
begin()
const {
return iterator(Result.begin(), Single); }
1225 iterator
end()
const {
return iterator(Result.end(), Single); }
1227 bool empty()
const {
return Result.empty(); }
1229 size_t size()
const {
return Single ? 1 : Result.size(); }
1237 Sliced.Single = Single;
1258 unsigned DeclKind : 8;
1263 mutable bool ExternalLexicalStorage : 1;
1268 mutable bool ExternalVisibleStorage : 1;
1274 mutable bool NeedToReconcileExternalVisibleStorage : 1;
1278 mutable bool HasLazyLocalLexicalLookups : 1;
1282 mutable bool HasLazyExternalLexicalLookups : 1;
1287 mutable bool UseQualifiedLookup : 1;
1315 static std::pair<Decl *, Decl *>
1319 : DeclKind(K), ExternalLexicalStorage(
false),
1320 ExternalVisibleStorage(
false),
1321 NeedToReconcileExternalVisibleStorage(
false),
1322 HasLazyLocalLexicalLookups(
false), HasLazyExternalLexicalLookups(
false),
1323 UseQualifiedLookup(
false) {}
1332 const char *getDeclKindName()
const;
1336 return cast<Decl>(
this)->getDeclContext();
1339 return const_cast<DeclContext*
>(
this)->getParent();
1352 return cast<Decl>(
this)->getLexicalDeclContext();
1355 return const_cast<DeclContext*
>(
this)->getLexicalParent();
1361 return const_cast<DeclContext*
>(
this)->getLookupParent();
1365 return cast<Decl>(
this)->getASTContext();
1369 return DeclKind == Decl::Block;
1374 case Decl::ObjCCategory:
1375 case Decl::ObjCCategoryImpl:
1376 case Decl::ObjCImplementation:
1377 case Decl::ObjCInterface:
1378 case Decl::ObjCProtocol:
1387 case Decl::Captured:
1388 case Decl::ObjCMethod:
1391 return DeclKind >= Decl::firstFunction && DeclKind <= Decl::lastFunction;
1398 DeclKind != Decl::Export;
1402 return DeclKind == Decl::TranslationUnit || DeclKind == Decl::Namespace;
1406 return DeclKind == Decl::TranslationUnit;
1410 return DeclKind >= Decl::firstRecord && DeclKind <= Decl::lastRecord;
1414 return DeclKind == Decl::Namespace;
1419 bool isInlineNamespace()
const;
1423 bool isDependentContext()
const;
1440 bool isTransparentContext()
const;
1444 bool isExternCContext()
const;
1451 bool isExternCXXContext()
const;
1466 Decl *getNonClosureAncestor();
1468 return const_cast<DeclContext*
>(
this)->getNonClosureAncestor();
1479 return const_cast<DeclContext*
>(
this)->getPrimaryContext();
1487 return const_cast<DeclContext *
>(
this)->getRedeclContext();
1493 return const_cast<DeclContext *
>(
this)->getEnclosingNamespaceContext();
1499 return const_cast<DeclContext *
>(
this)->getOuterLexicalRecordContext();
1508 bool InEnclosingNamespaceSetOf(
const DeclContext *NS)
const;
1539 Decl *Current =
nullptr;
1568 return x.Current == y.Current;
1572 return x.Current != y.Current;
1583 bool decls_empty()
const;
1589 return decl_range(noload_decls_begin(), noload_decls_end());
1599 template<
typename SpecificDecl>
1609 void SkipToNextDecl() {
1610 while (*Current && !isa<SpecificDecl>(*Current))
1621 std::iterator_traits<DeclContext::decl_iterator>::difference_type;
1657 return x.Current == y.Current;
1662 return x.Current != y.Current;
1675 template<
typename SpecificDecl,
bool (SpecificDecl::*Acceptable)() const>
1685 void SkipToNextDecl() {
1687 (!isa<SpecificDecl>(*Current) ||
1688 (Acceptable && !(cast<SpecificDecl>(*Current)->*Acceptable)())))
1699 std::iterator_traits<DeclContext::decl_iterator>::difference_type;
1733 return x.Current == y.Current;
1738 return x.Current != y.Current;
1754 void addDecl(
Decl *D);
1764 void addDeclInternal(
Decl *D);
1772 void addHiddenDecl(
Decl *D);
1775 void removeDecl(
Decl *D);
1778 bool containsDecl(
Decl *D)
const;
1821 void makeDeclVisibleInContext(
NamedDecl *D);
1846 std::random_access_iterator_tag,
1862 using ddiag_range = llvm::iterator_range<DeclContext::ddiag_iterator>;
1875 assert(
this == getPrimaryContext() &&
1876 "should only be called on primary context");
1877 HasLazyExternalLexicalLookups =
true;
1894 ExternalLexicalStorage = ES;
1904 ExternalVisibleStorage = ES;
1905 if (ES && LookupPtr)
1906 NeedToReconcileExternalVisibleStorage =
true;
1917 bool old_value = UseQualifiedLookup;
1918 UseQualifiedLookup = use;
1923 return UseQualifiedLookup;
1929 void dumpDeclContext()
const;
1930 void dumpLookups()
const;
1931 void dumpLookups(llvm::raw_ostream &OS,
bool DumpDecls =
false,
1932 bool Deserialize =
false)
const;
1937 void reconcileExternalVisibleStorage()
const;
1938 bool LoadLexicalDeclsFromExternalStorage()
const;
1946 void makeDeclVisibleInContextInternal(
NamedDecl *D);
1950 void buildLookupImpl(
DeclContext *DCtx,
bool Internal);
1951 void makeDeclVisibleInContextWithFlags(
NamedDecl *D,
bool Internal,
1952 bool Rediscoverable);
1953 void makeDeclVisibleInContextImpl(
NamedDecl *D,
bool Internal);
1957 return getKind() == TemplateTypeParm ||
getKind() == NonTypeTemplateParm ||
1958 getKind() == TemplateTemplateParm;
1962 template <
class ToTy,
1963 bool IsKnownSubtype = ::std::is_base_of<DeclContext, ToTy>::value>
1975 template <
class ToTy>
1978 return static_cast<const ToTy*
>(Val);
1982 return static_cast<ToTy*
>(Val);
1991 template <
typename To>
1993 static bool doit(const ::clang::DeclContext &Val) {
1994 return To::classofKind(Val.getDeclKind());
1999 template<
class ToTy>
2000 struct cast_convert_val<ToTy,
2002 static const ToTy &
doit(const ::clang::DeclContext &Val) {
2007 template<
class ToTy>
2014 template<
class ToTy>
2015 struct cast_convert_val<ToTy,
2017 static const ToTy *
doit(const ::clang::DeclContext *Val) {
2018 return ::clang::cast_convert_decl_context<ToTy>::doit(Val);
2022 template<
class ToTy>
2025 return ::clang::cast_convert_decl_context<ToTy>::doit(Val);
2030 template<
class FromTy>
2032 static ::clang::DeclContext &
doit(
const FromTy &Val) {
2033 return *FromTy::castToDeclContext(&Val);
2037 template<
class FromTy>
2039 static ::clang::DeclContext *
doit(
const FromTy *Val) {
2040 return FromTy::castToDeclContext(Val);
2044 template<
class FromTy>
2046 static const ::clang::DeclContext &
doit(
const FromTy &Val) {
2047 return *FromTy::castToDeclContext(&Val);
2051 template<
class FromTy>
2053 static const ::clang::DeclContext *
doit(
const FromTy *Val) {
2054 return FromTy::castToDeclContext(Val);
2060 #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++()
static const Decl * getCanonicalDecl(const Decl *D)
void setImplicit(bool I=true)
An instance of this class is created to represent 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
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
llvm::PointerIntPair< Decl *, 2, ModuleOwnershipKind > NextInContextAndBits
The next declaration within the same lexical DeclContext.
Represents a version number in the form major[.minor[.subminor[.build]]].
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
static Decl * castFromDeclContext(const DeclContext *)
value_type operator*() const
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...
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)
static TemplateDecl * getDescribedTemplate(Decl *Templated)
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
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
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
static Decl * getNonClosureContext(T *D)
Starting at a given context (a Decl or DeclContext), look for a code context that is not a closure (a...
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?
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
bool isInvalidDecl() const
friend bool operator!=(const specific_decl_iterator &x, const specific_decl_iterator &y)
Describes how types, statements, expressions, and declarations should be printed. ...
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
RecordDecl - 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.
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
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 hasTagIdentifierNamespace() const
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
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)
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
void setLocalOwningModule(Module *M)
Represents a linkage specification.
::clang::DeclContext * doit(const FromTy *Val)
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()
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
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 Decl * getNonClosureContext() const
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
llvm::iterator_range< all_lookups_iterator > lookups_range
static bool classofKind(Kind K)
const FunctionProtoType * T
StoredDeclsMap * getLookupPtr() const
Retrieve the internal representation of the lookup structure.
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.
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
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
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
Decl::Kind getDeclKind() const
Iterates through all the redeclarations of the same decl.
Encodes a location in the source.
SpecificDecl * value_type
void setTopLevelDeclInObjCContainer(bool V=true)
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
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
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.
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.
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_iterator operator++(int)
const Decl * getNonClosureAncestor() const
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).
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
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)
ASTContext & getParentASTContext() const
Defines the clang::VersionTuple class, which represents a version in the form major[.minor[.subminor]].
Kind
Lists the kind of concrete classes of Decl.
static Decl::Kind getKind(const Decl *D)
TranslationUnitDecl - The top declaration context.
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
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...
NamedDecl - This represents a decl with a name.
bool isTranslationUnit() const
void setAccess(AccessSpecifier AS)
const TranslationUnitDecl * getTranslationUnitDecl() const
Represents C++ using-directive.
SourceLocation getBegin() const
This class handles loading and caching of source files into memory.
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
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...