14 #ifndef LLVM_CLANG_AST_DECL_H 15 #define LLVM_CLANG_AST_DECL_H 35 #include "llvm/ADT/APSInt.h" 36 #include "llvm/ADT/ArrayRef.h" 37 #include "llvm/ADT/Optional.h" 38 #include "llvm/ADT/PointerIntPair.h" 39 #include "llvm/ADT/PointerUnion.h" 40 #include "llvm/ADT/StringRef.h" 41 #include "llvm/ADT/iterator_range.h" 42 #include "llvm/Support/Casting.h" 43 #include "llvm/Support/Compiler.h" 44 #include "llvm/Support/TrailingObjects.h" 54 struct ASTTemplateArgumentListInfo;
57 class DependentFunctionTemplateSpecializationInfo;
60 class FunctionTemplateDecl;
61 class FunctionTemplateSpecializationInfo;
63 class MemberSpecializationInfo;
71 class TemplateArgumentList;
72 class TemplateArgumentListInfo;
73 class TemplateParameterList;
74 class TypeAliasTemplateDecl;
76 class UnresolvedSetImpl;
77 class VarTemplateDecl;
116 virtual void anchor();
150 :
Decl(PragmaComment, TU, CommentLoc), CommentKind(CommentKind) {}
152 virtual void anchor();
164 StringRef
getArg()
const {
return getTrailingObjects<char>(); }
184 :
Decl(PragmaDetectMismatch, TU, Loc), ValueStart(ValueStart) {}
186 virtual void anchor();
194 CreateDeserialized(
ASTContext &
C,
unsigned ID,
unsigned NameValueSize);
196 StringRef
getName()
const {
return getTrailingObjects<char>(); }
197 StringRef
getValue()
const {
return getTrailingObjects<char>() + ValueStart; }
226 virtual void anchor();
251 virtual void anchor();
254 NamedDecl *getUnderlyingDeclImpl() LLVM_READONLY;
258 :
Decl(DK, DC, L), Name(N) {}
271 assert(Name.
isIdentifier() &&
"Name is not a simple identifier");
287 virtual void printName(raw_ostream &os)
const;
302 void printQualifiedName(raw_ostream &OS)
const;
303 void printQualifiedName(raw_ostream &OS,
const PrintingPolicy &Policy)
const;
306 std::string getQualifiedNameAsString()
const;
314 virtual void getNameForDiagnostic(raw_ostream &OS,
316 bool Qualified)
const;
328 bool declarationReplaces(
NamedDecl *OldD,
bool IsKnownNewer =
true)
const;
331 bool hasLinkage()
const;
343 if (isa<EnumDecl>(DC))
351 bool isCXXInstanceMember()
const;
357 Linkage getLinkageInternal()
const;
382 return getLinkageAndVisibility().getVisibility();
408 bool isLinkageValid()
const;
417 return hasCachedLinkage();
424 if (this->
getKind() != UsingShadow &&
425 this->
getKind() != ConstructorUsingShadow &&
426 this->
getKind() != ObjCCompatibleAlias &&
427 this->
getKind() != NamespaceAlias)
430 return getUnderlyingDeclImpl();
433 return const_cast<NamedDecl*
>(
this)->getUnderlyingDecl();
437 return cast<NamedDecl>(
static_cast<Decl *
>(
this)->getMostRecentDecl());
440 return const_cast<NamedDecl*
>(
this)->getMostRecentDecl();
462 bool MSAsmNameResolved =
false;
471 :
NamedDecl(
Label, DC, IdentL, II), TheStmt(S), LocStart(StartL) {}
473 void anchor()
override;
486 bool isGnuLocal()
const {
return LocStart != getLocation(); }
495 void setMSAsmLabel(StringRef Name);
519 llvm::PointerIntPair<NamespaceDecl *, 1, bool> AnonOrFirstNamespaceAndInline;
545 using redeclarable_base::redecls_begin;
546 using redeclarable_base::redecls_end;
547 using redeclarable_base::redecls;
548 using redeclarable_base::getPreviousDecl;
549 using redeclarable_base::getMostRecentDecl;
550 using redeclarable_base::isFirstDecl;
567 return AnonOrFirstNamespaceAndInline.getInt();
572 AnonOrFirstNamespaceAndInline.setInt(Inline);
584 bool isOriginalNamespace()
const;
589 return getOriginalNamespace()->AnonOrFirstNamespaceAndInline.getPointer();
593 getOriginalNamespace()->AnonOrFirstNamespaceAndInline.setPointer(D);
598 return getOriginalNamespace();
601 return getOriginalNamespace();
630 void anchor()
override;
635 :
NamedDecl(DK, DC, L, N), DeclType(T) {}
659 unsigned NumTemplParamLists = 0;
674 void setTemplateParameterListsInfo(
ASTContext &Context,
687 llvm::PointerUnion<TypeSourceInfo *, ExtInfo *> DeclInfo;
693 bool hasExtInfo()
const {
return DeclInfo.is<ExtInfo*>(); }
694 ExtInfo *getExtInfo() {
return DeclInfo.get<ExtInfo*>(); }
695 const ExtInfo *getExtInfo()
const {
return DeclInfo.get<ExtInfo*>(); }
701 :
ValueDecl(DK, DC, L, N, T), DeclInfo(TInfo), InnerLocStart(StartL) {}
709 ? getExtInfo()->TInfo
715 getExtInfo()->TInfo = TI;
732 return getOuterLocStart();
738 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
746 return hasExtInfo() ? getExtInfo()->QualifierLoc
753 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
757 assert(index < getNumTemplateParameterLists());
758 return getExtInfo()->TemplParamLists[index];
761 void setTemplateParameterListsInfo(
ASTContext &Context,
769 return K >= firstDeclarator && K <= lastDeclarator;
836 static const char *getStorageClassSpecifierString(
StorageClass SC);
846 using InitType = llvm::PointerUnion<Stmt *, EvaluatedStmt *>;
857 class VarDeclBitfields {
862 unsigned TSCSpec : 2;
863 unsigned InitStyle : 2;
865 enum { NumVarDeclBits = 7 };
868 enum { NumParameterIndexBits = 8 };
881 unsigned : NumVarDeclBits;
885 unsigned HasInheritedDefaultArg : 1;
894 unsigned IsKNRPromoted : 1;
897 unsigned IsObjCMethodParam : 1;
903 unsigned ScopeDepthOrObjCQuals : 7;
907 unsigned ParameterIndex : NumParameterIndexBits;
915 unsigned : NumVarDeclBits;
920 unsigned IsThisDeclarationADemotedDefinition : 1;
924 unsigned ExceptionVar : 1;
929 unsigned NRVOVariable : 1;
933 unsigned CXXForRangeDecl : 1;
937 unsigned ARCPseudoStrong : 1;
940 unsigned IsInline : 1;
943 unsigned IsInlineSpecified : 1;
946 unsigned IsConstexpr : 1;
950 unsigned IsInitCapture : 1;
955 unsigned PreviousDeclInSameBlockScope : 1;
959 unsigned ImplicitParamKind : 3;
976 return getNextRedeclaration();
980 return getPreviousDecl();
984 return getMostRecentDecl();
991 using redeclarable_base::redecls_begin;
992 using redeclarable_base::redecls_end;
993 using redeclarable_base::redecls;
994 using redeclarable_base::getPreviousDecl;
995 using redeclarable_base::getMostRecentDecl;
996 using redeclarable_base::isFirstDecl;
1015 VarDeclBits.TSCSpec = TSC;
1016 assert(VarDeclBits.TSCSpec == TSC &&
"truncation");
1026 if (getStorageClass() ==
SC_None) {
1038 if (getStorageClass() ==
SC_Register && !isLocalVarDeclOrParm())
1044 return getStorageClass() >=
SC_Auto;
1050 return (getStorageClass() ==
SC_Static ||
1053 && !isFileVarDecl();
1059 return getStorageClass() ==
SC_Extern ||
1084 bool isInExternCContext()
const;
1088 bool isInExternCXXContext()
const;
1098 if (
const DeclContext *DC = getLexicalDeclContext())
1099 return DC->getRedeclContext()->isFunctionOrMethod();
1105 return isLocalVarDecl() ||
getKind() == Decl::ParmVar;
1128 return getKind() != Decl::ParmVar && getDeclContext()->isRecord();
1152 return isThisDeclarationADefinition(getASTContext());
1164 VarDecl *getActingDefinition();
1166 return const_cast<VarDecl*
>(
this)->getActingDefinition();
1183 bool isOutOfLine()
const override;
1188 if (K == ParmVar || K == ImplicitParam)
1191 if (getLexicalDeclContext()->getRedeclContext()->isFileContext())
1194 if (isStaticDataMember())
1204 return getAnyInitializer(D);
1209 const Expr *getAnyInitializer(
const VarDecl *&D)
const;
1211 bool hasInit()
const;
1213 return const_cast<VarDecl *
>(
this)->getInit();
1218 Stmt **getInitAddress();
1220 void setInit(
Expr *I);
1226 bool isUsableInConstantExpressions(
ASTContext &
C)
const;
1234 APValue *evaluateValue()
const;
1240 APValue *getEvaluatedValue()
const;
1244 bool isInitKnownICE()
const;
1251 bool isInitICE()
const;
1255 bool checkInitIsICE()
const;
1258 VarDeclBits.InitStyle =
Style;
1277 return getInitStyle() != CInit;
1282 return isa<ParmVarDecl>(
this) ?
false :
1283 NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
1292 assert(isThisDeclarationADefinition() &&
"Not a definition!");
1293 assert(!isa<ParmVarDecl>(
this) &&
"Cannot demote ParmVarDecls!");
1294 NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
1300 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.ExceptionVar;
1303 assert(!isa<ParmVarDecl>(
this));
1304 NonParmVarDeclBits.ExceptionVar = EV;
1318 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.NRVOVariable;
1321 assert(!isa<ParmVarDecl>(
this));
1322 NonParmVarDeclBits.NRVOVariable = NRVO;
1328 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.CXXForRangeDecl;
1331 assert(!isa<ParmVarDecl>(
this));
1332 NonParmVarDeclBits.CXXForRangeDecl = FRD;
1340 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.ARCPseudoStrong;
1343 assert(!isa<ParmVarDecl>(
this));
1344 NonParmVarDeclBits.ARCPseudoStrong = ps;
1349 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsInline;
1352 return isa<ParmVarDecl>(
this) ?
false 1353 : NonParmVarDeclBits.IsInlineSpecified;
1356 assert(!isa<ParmVarDecl>(
this));
1357 NonParmVarDeclBits.IsInline =
true;
1358 NonParmVarDeclBits.IsInlineSpecified =
true;
1361 assert(!isa<ParmVarDecl>(
this));
1362 NonParmVarDeclBits.IsInline =
true;
1367 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsConstexpr;
1370 assert(!isa<ParmVarDecl>(
this));
1371 NonParmVarDeclBits.IsConstexpr = IC;
1376 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsInitCapture;
1379 assert(!isa<ParmVarDecl>(
this));
1380 NonParmVarDeclBits.IsInitCapture = IC;
1386 return isa<ParmVarDecl>(
this)
1388 : NonParmVarDeclBits.PreviousDeclInSameBlockScope;
1391 assert(!isa<ParmVarDecl>(
this));
1392 NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
1397 VarDecl *getTemplateInstantiationPattern()
const;
1402 VarDecl *getInstantiatedFromStaticDataMember()
const;
1426 void setInstantiationOfStaticDataMember(
VarDecl *VD,
1450 void anchor()
override;
1488 :
VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
1490 NonParmVarDeclBits.ImplicitParamKind = ParamKind;
1498 NonParmVarDeclBits.ImplicitParamKind = ParamKind;
1515 enum { MaxFunctionScopeDepth = 255 };
1516 enum { MaxFunctionScopeIndex = 255 };
1522 :
VarDecl(DK, C, DC, StartLoc, IdLoc, Id, T, TInfo, S) {
1523 assert(ParmVarDeclBits.HasInheritedDefaultArg ==
false);
1524 assert(ParmVarDeclBits.DefaultArgKind == DAK_None);
1525 assert(ParmVarDeclBits.IsKNRPromoted ==
false);
1526 assert(ParmVarDeclBits.IsObjCMethodParam ==
false);
1527 setDefaultArg(DefArg);
1542 ParmVarDeclBits.IsObjCMethodParam =
true;
1543 setParameterIndex(parameterIndex);
1547 assert(!ParmVarDeclBits.IsObjCMethodParam);
1549 ParmVarDeclBits.ScopeDepthOrObjCQuals = scopeDepth;
1550 assert(ParmVarDeclBits.ScopeDepthOrObjCQuals == scopeDepth
1553 setParameterIndex(parameterIndex);
1557 return ParmVarDeclBits.IsObjCMethodParam;
1561 if (ParmVarDeclBits.IsObjCMethodParam)
return 0;
1562 return ParmVarDeclBits.ScopeDepthOrObjCQuals;
1567 return getParameterIndex();
1571 if (!ParmVarDeclBits.IsObjCMethodParam)
return OBJC_TQ_None;
1575 assert(ParmVarDeclBits.IsObjCMethodParam);
1576 ParmVarDeclBits.ScopeDepthOrObjCQuals = QTVal;
1588 return ParmVarDeclBits.IsKNRPromoted;
1591 ParmVarDeclBits.IsKNRPromoted = promoted;
1594 Expr *getDefaultArg();
1596 return const_cast<ParmVarDecl *
>(
this)->getDefaultArg();
1599 void setDefaultArg(
Expr *defarg);
1604 void setUninstantiatedDefaultArg(
Expr *arg);
1605 Expr *getUninstantiatedDefaultArg();
1607 return const_cast<ParmVarDecl *
>(
this)->getUninstantiatedDefaultArg();
1612 bool hasDefaultArg()
const;
1625 return ParmVarDeclBits.DefaultArgKind == DAK_Unparsed;
1629 return ParmVarDeclBits.DefaultArgKind == DAK_Uninstantiated;
1638 ParmVarDeclBits.DefaultArgKind = DAK_Unparsed;
1642 return ParmVarDeclBits.HasInheritedDefaultArg;
1646 ParmVarDeclBits.HasInheritedDefaultArg = I;
1653 bool isParameterPack()
const;
1666 enum { ParameterIndexSentinel = (1 << NumParameterIndexBits) - 1 };
1668 void setParameterIndex(
unsigned parameterIndex) {
1669 if (parameterIndex >= ParameterIndexSentinel) {
1670 setParameterIndexLarge(parameterIndex);
1674 ParmVarDeclBits.ParameterIndex = parameterIndex;
1675 assert(ParmVarDeclBits.ParameterIndex == parameterIndex &&
"truncation!");
1677 unsigned getParameterIndex()
const {
1678 unsigned d = ParmVarDeclBits.ParameterIndex;
1679 return d == ParameterIndexSentinel ? getParameterIndexLarge() : d;
1682 void setParameterIndexLarge(
unsigned parameterIndex);
1683 unsigned getParameterIndexLarge()
const;
1706 TK_DependentFunctionTemplateSpecialization
1719 unsigned SClass : 3;
1720 unsigned IsInline : 1;
1721 unsigned IsInlineSpecified : 1;
1729 unsigned IsVirtualAsWritten : 1;
1730 unsigned IsPure : 1;
1731 unsigned HasInheritedPrototype : 1;
1732 unsigned HasWrittenPrototype : 1;
1733 unsigned IsDeleted : 1;
1734 unsigned IsTrivial : 1;
1735 unsigned IsDefaulted : 1;
1736 unsigned IsExplicitlyDefaulted : 1;
1737 unsigned HasImplicitReturnZero : 1;
1738 unsigned IsLateTemplateParsed : 1;
1739 unsigned IsConstexpr : 1;
1740 unsigned InstantiationIsPending : 1;
1743 unsigned UsesSEHTry : 1;
1747 unsigned HasSkippedBody : 1;
1751 unsigned WillHaveBody : 1;
1764 unsigned HasODRHash : 1;
1792 TemplateOrSpecialization;
1819 void setFunctionTemplateSpecialization(
ASTContext &
C,
1820 FunctionTemplateDecl *Template,
1838 bool isConstexprSpecified)
1839 :
DeclaratorDecl(DK, DC, NameInfo.getLoc(), NameInfo.getName(), T, TInfo,
1842 IsInline(isInlineSpecified), IsInlineSpecified(isInlineSpecified),
1844 HasInheritedPrototype(
false), HasWrittenPrototype(
true),
1846 IsExplicitlyDefaulted(
false), HasImplicitReturnZero(
false),
1847 IsLateTemplateParsed(
false), IsConstexpr(isConstexprSpecified),
1848 InstantiationIsPending(
false), UsesSEHTry(
false), HasSkippedBody(
false),
1849 WillHaveBody(
false), IsCopyDeductionCandidate(
false), HasODRHash(
false),
1850 ODRHash(0), EndRangeLoc(NameInfo.getEndLoc()),
1856 return getNextRedeclaration();
1860 return getPreviousDecl();
1864 return getMostRecentDecl();
1874 using redeclarable_base::redecls_begin;
1875 using redeclarable_base::redecls_end;
1876 using redeclarable_base::redecls;
1877 using redeclarable_base::getPreviousDecl;
1878 using redeclarable_base::getMostRecentDecl;
1879 using redeclarable_base::isFirstDecl;
1886 bool isInlineSpecified =
false,
1887 bool hasWrittenPrototype =
true,
1888 bool isConstexprSpecified =
false) {
1892 isInlineSpecified, hasWrittenPrototype,
1893 isConstexprSpecified);
1901 bool isInlineSpecified,
1902 bool hasWrittenPrototype,
1903 bool isConstexprSpecified =
false);
1911 void getNameForDiagnostic(raw_ostream &OS,
const PrintingPolicy &Policy,
1912 bool Qualified)
const override;
1927 return hasBody(Definition);
1932 bool hasTrivialBody()
const;
1941 return isDefined(Definition);
1947 if (isDefined(Definition))
1965 return getBody(Definition);
1974 return IsDeleted || IsDefaulted || Body || HasSkippedBody ||
1975 IsLateTemplateParsed || WillHaveBody || hasDefiningAttr();
1981 return Body || IsLateTemplateParsed;
1984 void setBody(
Stmt *B);
1988 bool isVariadic()
const;
1997 void setPure(
bool P =
true);
2031 return HasWrittenPrototype || HasInheritedPrototype;
2083 bool isMain()
const;
2087 bool isMSVCRTEntryPoint()
const;
2102 bool isReservedGlobalPlacementOperator()
const;
2122 bool isReplaceableGlobalAllocationFunction(
bool *IsAligned =
nullptr)
const;
2125 bool isDestroyingOperatorDelete()
const;
2136 bool isInExternCContext()
const;
2140 bool isInExternCXXContext()
const;
2143 bool isGlobal()
const;
2147 bool isNoReturn()
const;
2164 unsigned getBuiltinID()
const;
2168 return {ParamInfo, getNumParams()};
2171 return {ParamInfo, getNumParams()};
2188 unsigned getNumParams()
const;
2191 assert(i < getNumParams() &&
"Illegal param #");
2192 return ParamInfo[i];
2195 assert(i < getNumParams() &&
"Illegal param #");
2196 return ParamInfo[i];
2199 setParams(getASTContext(), NewParamInfo);
2205 unsigned getMinRequiredArguments()
const;
2208 assert(
getType()->getAs<FunctionType>() &&
"Expected a FunctionType!");
2223 assert(
getType()->getAs<FunctionType>() &&
"Expected a FunctionType!");
2229 const Attr *getUnusedResultAttr()
const;
2245 IsInlineSpecified = I;
2259 bool isInlineDefinitionExternallyVisible()
const;
2261 bool isMSExternInline()
const;
2263 bool doesDeclarationForceExternallyVisibleDefinition()
const;
2268 return getOverloadedOperator() !=
OO_None;
2296 FunctionDecl *getInstantiatedFromMemberFunction()
const;
2304 MemberSpecializationInfo *getMemberSpecializationInfo()
const;
2310 setInstantiationOfMemberFunction(getASTContext(), FD, TSK);
2325 FunctionTemplateDecl *getDescribedFunctionTemplate()
const;
2327 void setDescribedFunctionTemplate(FunctionTemplateDecl *Template);
2332 return getPrimaryTemplate() !=
nullptr;
2337 FunctionDecl *getClassScopeSpecializationPattern()
const;
2342 FunctionTemplateSpecializationInfo *getTemplateSpecializationInfo()
const;
2347 bool isImplicitlyInstantiable()
const;
2363 FunctionTemplateDecl *getPrimaryTemplate()
const;
2380 getTemplateSpecializationArgsAsWritten()
const;
2407 setFunctionTemplateSpecialization(getASTContext(), Template, TemplateArgs,
2408 InsertPos, TSK, TemplateArgsAsWritten,
2409 PointOfInstantiation);
2414 void setDependentTemplateSpecialization(
ASTContext &Context,
2419 getDependentSpecializationInfo()
const;
2440 bool isOutOfLine()
const override;
2446 unsigned getMemoryFunctionKind()
const;
2450 unsigned getODRHash();
2455 return K >= firstFunction && K <= lastFunction;
2468 unsigned BitField : 1;
2469 unsigned Mutable : 1;
2470 mutable unsigned CachedFieldIndex : 30;
2476 enum InitStorageKind {
2492 ISK_CapturedVLAType,
2497 struct InitAndBitWidth {
2511 llvm::PointerIntPair<void *, 2, InitStorageKind> InitStorage;
2519 BitField(
false), Mutable(Mutable), CachedFieldIndex(0),
2520 InitStorage(nullptr, (InitStorageKind) InitStyle) {
2554 bool isAnonymousStructOrUnion()
const;
2559 void *Ptr = InitStorage.getPointer();
2560 if (getInClassInitStyle())
2561 return static_cast<InitAndBitWidth*
>(Ptr)->BitWidth;
2562 return static_cast<Expr*
>(Ptr);
2565 unsigned getBitWidthValue(
const ASTContext &Ctx)
const;
2570 assert(!hasCapturedVLAType() && !BitField &&
2571 "bit width or captured type already set");
2572 assert(Width &&
"no bit width specified");
2573 InitStorage.setPointer(
2574 InitStorage.getInt()
2575 ?
new (getASTContext())
2576 InitAndBitWidth{getInClassInitializer(), Width}
2577 :
static_cast<void*
>(Width));
2584 assert(isBitField() &&
"no bitfield width to remove");
2585 InitStorage.setPointer(getInClassInitializer());
2591 InitStorageKind storageKind = InitStorage.getInt();
2592 return (storageKind == ISK_CapturedVLAType
2605 if (!hasInClassInitializer())
2607 void *Ptr = InitStorage.getPointer();
2609 return static_cast<InitAndBitWidth*
>(Ptr)->Init;
2610 return static_cast<Expr*
>(Ptr);
2616 assert(hasInClassInitializer() && !getInClassInitializer());
2618 static_cast<InitAndBitWidth*
>(InitStorage.getPointer())->Init = Init;
2620 InitStorage.setPointer(Init);
2626 assert(hasInClassInitializer() &&
"no initializer to remove");
2627 InitStorage.setPointerAndInt(getBitWidth(), ISK_NoInit);
2633 return InitStorage.getInt() == ISK_CapturedVLAType;
2639 InitStorage.getPointer())
2649 return cast<RecordDecl>(getDeclContext());
2653 return cast<RecordDecl>(getDeclContext());
2678 const llvm::APSInt &V)
2679 :
ValueDecl(EnumConstant, DC, L, Id, T), Init((
Stmt*)E), Val(V) {}
2687 const llvm::APSInt &V);
2714 unsigned ChainingSize;
2720 void anchor()
override;
2734 return llvm::makeArrayRef(Chaining, ChainingSize);
2742 assert(chain().size() >= 2);
2743 return cast<FieldDecl>(chain().back());
2747 assert(chain().size() >= 2);
2748 return dyn_cast<
VarDecl>(chain().front());
2767 mutable const Type *TypeForDecl =
nullptr;
2772 void anchor()
override;
2777 :
NamedDecl(DK, DC, L, Id), LocStart(StartL) {}
2803 using ModedTInfo = std::pair<TypeSourceInfo *, QualType>;
2804 llvm::PointerUnion<TypeSourceInfo *, ModedTInfo *> MaybeModedTInfo;
2809 mutable unsigned CacheIsTransparentTag : 2;
2811 void anchor()
override;
2818 MaybeModedTInfo(TInfo), CacheIsTransparentTag(0) {}
2823 return getNextRedeclaration();
2827 return getPreviousDecl();
2831 return getMostRecentDecl();
2838 using redeclarable_base::redecls_begin;
2839 using redeclarable_base::redecls_end;
2840 using redeclarable_base::redecls;
2841 using redeclarable_base::getPreviousDecl;
2842 using redeclarable_base::getMostRecentDecl;
2843 using redeclarable_base::isFirstDecl;
2845 bool isModed()
const {
return MaybeModedTInfo.is<ModedTInfo*>(); }
2849 ? MaybeModedTInfo.get<ModedTInfo*>()->first
2855 ? MaybeModedTInfo.get<ModedTInfo*>()->second
2860 MaybeModedTInfo = newType;
2864 MaybeModedTInfo =
new (getASTContext()) ModedTInfo(unmodedTSI, modedTy);
2876 TagDecl *getAnonDeclWithTypedefName(
bool AnyRedecl =
false)
const;
2881 if (CacheIsTransparentTag)
2882 return CacheIsTransparentTag & 0x2;
2883 return isTransparentTagSlow();
2889 return K >= firstTypedefName && K <= lastTypedefName;
2893 bool isTransparentTagSlow()
const;
2925 Template(
nullptr) {}
2953 unsigned TagDeclKind : 3;
2958 unsigned IsCompleteDefinition : 1;
2968 unsigned IsEmbeddedInDeclarator : 1;
2971 unsigned IsFreeStanding : 1;
3017 llvm::PointerUnion<TypedefNameDecl *, ExtInfo *> TypedefNameDeclOrQualifier;
3019 bool hasExtInfo()
const {
return TypedefNameDeclOrQualifier.is<
ExtInfo *>(); }
3020 ExtInfo *getExtInfo() {
return TypedefNameDeclOrQualifier.get<
ExtInfo *>(); }
3021 const ExtInfo *getExtInfo()
const {
3022 return TypedefNameDeclOrQualifier.get<
ExtInfo *>();
3030 TagDeclKind(TK), IsCompleteDefinition(
false), IsBeingDefined(
false),
3031 IsEmbeddedInDeclarator(
false), IsFreeStanding(
false),
3032 IsCompleteDefinitionRequired(
false),
3034 assert((DK != Enum || TK ==
TTK_Enum) &&
3035 "EnumDecl not matched with TTK_Enum");
3036 setPreviousDecl(PrevDecl);
3042 return getNextRedeclaration();
3046 return getPreviousDecl();
3050 return getMostRecentDecl();
3056 void completeDefinition();
3065 using redeclarable_base::redecls_begin;
3066 using redeclarable_base::redecls_end;
3067 using redeclarable_base::redecls;
3068 using redeclarable_base::getPreviousDecl;
3069 using redeclarable_base::getMostRecentDecl;
3070 using redeclarable_base::isFirstDecl;
3092 return isCompleteDefinition();
3098 return IsCompleteDefinition;
3104 return IsCompleteDefinitionRequired;
3109 return IsBeingDefined;
3113 return IsEmbeddedInDeclarator;
3116 IsEmbeddedInDeclarator = isInDeclarator;
3121 IsFreeStanding = isFreeStanding;
3134 void startDefinition();
3149 IsCompleteDefinitionRequired = V;
3184 return (getDeclName() || getTypedefNameForAnonDecl());
3188 return hasExtInfo() ? nullptr
3197 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
3205 return hasExtInfo() ? getExtInfo()->QualifierLoc
3212 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
3216 assert(i < getNumTemplateParameterLists());
3217 return getExtInfo()->TemplParamLists[i];
3220 void setTemplateParameterListsInfo(
ASTContext &Context,
3254 llvm::PointerUnion<const Type *, TypeSourceInfo *> IntegerType;
3265 MemberSpecializationInfo *SpecializationInfo =
nullptr;
3269 bool Scoped,
bool ScopedUsingClassTag,
bool Fixed)
3271 assert(Scoped || !ScopedUsingClassTag);
3272 IntegerType = (
const Type *)
nullptr;
3273 NumNegativeBits = 0;
3274 NumPositiveBits = 0;
3276 IsScopedUsingClassTag = ScopedUsingClassTag;
3280 void anchor()
override;
3295 return cast_or_null<EnumDecl>(
3296 static_cast<TagDecl *
>(
this)->getPreviousDecl());
3299 return const_cast<EnumDecl*
>(
this)->getPreviousDecl();
3303 return cast<EnumDecl>(
static_cast<TagDecl *
>(
this)->getMostRecentDecl());
3306 return const_cast<EnumDecl*
>(
this)->getMostRecentDecl();
3316 bool IsScoped,
bool IsScopedUsingClassTag,
3325 void completeDefinition(
QualType NewType,
3327 unsigned NumPositiveBits,
3328 unsigned NumNegativeBits);
3334 llvm::iterator_range<specific_decl_iterator<EnumConstantDecl>>;
3367 if (
const Type *T = IntegerType.dyn_cast<
const Type*>())
3386 SourceRange getIntegerTypeRange()
const LLVM_READONLY;
3391 return NumPositiveBits;
3394 NumPositiveBits = Num;
3395 assert(NumPositiveBits == Num &&
"can't store this bitcount");
3408 return NumNegativeBits;
3411 NumNegativeBits = Num;
3421 return IsScopedUsingClassTag;
3432 return isCompleteDefinition() || isFixed();
3437 bool isClosed()
const;
3441 bool isClosedFlag()
const;
3445 bool isClosedNonFlag()
const;
3449 EnumDecl *getTemplateInstantiationPattern()
const;
3454 EnumDecl *getInstantiatedFromMemberEnum()
const;
3470 return SpecializationInfo;
3477 setInstantiationOfMemberEnum(getASTContext(), ED, TSK);
3495 bool HasFlexibleArrayMember : 1;
3499 bool AnonymousStructOrUnion : 1;
3503 bool HasObjectMember : 1;
3507 bool HasVolatileMember : 1;
3513 mutable bool LoadedFieldsFromExternalStorage : 1;
3527 return cast_or_null<RecordDecl>(
3528 static_cast<TagDecl *
>(
this)->getPreviousDecl());
3531 return const_cast<RecordDecl*
>(
this)->getPreviousDecl();
3535 return cast<RecordDecl>(
static_cast<TagDecl *
>(
this)->getMostRecentDecl());
3538 return const_cast<RecordDecl*
>(
this)->getMostRecentDecl();
3558 AnonymousStructOrUnion = Anon;
3568 return LoadedFieldsFromExternalStorage;
3571 LoadedFieldsFromExternalStorage = val;
3587 bool isInjectedClassName()
const;
3591 bool isLambda()
const;
3595 bool isCapturedRecord()
const;
3599 void setCapturedRecord();
3617 using field_range = llvm::iterator_range<specific_decl_iterator<FieldDecl>>;
3629 return field_begin() == field_end();
3634 virtual void completeDefinition();
3638 return K >= firstRecord && K <= lastRecord;
3649 bool mayInsertExtraPadding(
bool EmitRemark =
false)
const;
3653 const FieldDecl *findFirstNamedDataMember()
const;
3657 void LoadFieldsFromExternalStorage()
const;
3666 :
Decl(FileScopeAsm, DC, StartL), AsmString(asmstring), RParenLoc(EndL) {}
3668 virtual void anchor();
3706 llvm::PointerIntPair<VarDecl*, 2> VariableAndFlags;
3715 : VariableAndFlags(variable,
3716 (byRef ? flag_isByRef : 0) | (nested ? flag_isNested : 0)),
3724 bool isByRef()
const {
return VariableAndFlags.getInt() & flag_isByRef; }
3728 bool isNested()
const {
return VariableAndFlags.getInt() & flag_isNested; }
3737 bool IsVariadic : 1;
3738 bool CapturesCXXThis : 1;
3739 bool BlockMissingReturnType : 1;
3740 bool IsConversionFromLambda : 1;
3746 unsigned NumParams = 0;
3748 Stmt *Body =
nullptr;
3751 const Capture *Captures =
nullptr;
3752 unsigned NumCaptures = 0;
3754 unsigned ManglingNumber = 0;
3755 Decl *ManglingContextDecl =
nullptr;
3760 CapturesCXXThis(
false), BlockMissingReturnType(
true),
3761 IsConversionFromLambda(
false) {}
3781 return {ParamInfo, getNumParams()};
3784 return {ParamInfo, getNumParams()};
3801 assert(i < getNumParams() &&
"Illegal param #");
3802 return ParamInfo[i];
3805 assert(i < getNumParams() &&
"Illegal param #");
3806 return ParamInfo[i];
3813 bool hasCaptures()
const {
return NumCaptures != 0 || CapturesCXXThis; }
3833 bool capturesVariable(
const VarDecl *var)
const;
3836 bool CapturesCXXThis);
3839 return ManglingNumber;
3843 return ManglingContextDecl;
3847 ManglingNumber = Number;
3848 ManglingContextDecl = Ctx;
3880 unsigned ContextParam;
3883 llvm::PointerIntPair<Stmt *, 1, bool> BodyAndNothrow;
3888 return getTrailingObjects<ImplicitParamDecl *>();
3892 return getTrailingObjects<ImplicitParamDecl *>();
3901 unsigned NumParams);
3903 unsigned NumParams);
3905 Stmt *getBody()
const override;
3906 void setBody(
Stmt *B);
3908 bool isNothrow()
const;
3909 void setNothrow(
bool Nothrow =
true);
3914 assert(i < NumParams);
3915 return getParams()[i];
3918 assert(i < NumParams);
3924 return {getParams(), getNumParams()};
3927 return {getParams(), getNumParams()};
3932 assert(ContextParam < NumParams);
3933 return getParam(ContextParam);
3936 assert(i < NumParams);
3984 llvm::PointerIntPair<Module *, 1, bool> ImportedAndComplete;
4012 unsigned NumLocations);
4037 virtual void anchor();
4063 return decls_empty() ? getLocation() : decls_begin()->getLocEnd();
4084 virtual void anchor();
4110 template<
typename decl_type>
4114 assert(RedeclLink.NextIsLatest() &&
4115 "setPreviousDecl on a decl already in a redeclaration chain");
4121 First = PrevDecl->getFirstDecl();
4122 assert(First->RedeclLink.NextIsLatest() &&
"Expected first");
4123 decl_type *MostRecent = First->getNextRedeclaration();
4124 RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4128 static_cast<decl_type*
>(
this)->IdentifierNamespace |=
4129 MostRecent->getIdentifierNamespace() &
4133 First =
static_cast<decl_type*
>(
this);
4137 First->RedeclLink.setLatest(static_cast<decl_type*>(
this));
4139 assert(!isa<NamedDecl>(static_cast<decl_type*>(
this)) ||
4140 cast<NamedDecl>(static_cast<decl_type*>(
this))->isLinkageValid());
4163 #endif // LLVM_CLANG_AST_DECL_H static bool classof(const Decl *D)
static bool classofKind(Kind K)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
void setHasSkippedBody(bool Skipped=true)
FunctionDecl * getDefinition()
Get the definition for this declaration.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
void setOwningFunction(DeclContext *FD)
setOwningFunction - Sets the function declaration that owns this ParmVarDecl.
bool hasCapturedVLAType() const
Determine whether this member captures the variable length array type.
redeclarable_base::redecl_range redecl_range
enumerator_iterator enumerator_end() const
static unsigned getFieldIndex(Decl *F)
static const Decl * getCanonicalDecl(const Decl *D)
An instance of this class is created to represent a function declaration or definition.
bool isThisDeclarationADemotedDefinition() const
If this definition should pretend to be a declaration.
Other implicit parameter.
static bool classof(const Decl *D)
Expr * getCopyExpr() const
static DeclContext * castToDeclContext(const ExternCContextDecl *D)
void setAnonymousStructOrUnion(bool Anon)
A class which contains all the information about a particular captured value.
A (possibly-)qualified type.
TagDecl * getDefinition() const
getDefinition - Returns the TagDecl that actually defines this struct/union/class/enum.
static bool classofKind(Kind K)
bool isOverloadedOperator() const
isOverloadedOperator - Whether this function declaration represents an C++ overloaded operator...
bool hasCaptures() const
hasCaptures - True if this block (or its nested blocks) captures anything of local storage from its e...
static bool classofKind(Kind K)
param_iterator param_begin() const
Retrieve an iterator pointing to the first parameter decl.
bool isObjCMethodParameter() const
capture_const_iterator capture_begin() const
SourceRange getBraceRange() const
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
const NamedDecl * getUnderlyingDecl() const
InClassInitStyle getInClassInitStyle() const
Get the kind of (C++11) default member initializer that this field has.
VarDecl * getVarDecl() const
redeclarable_base::redecl_iterator redecl_iterator
static TranslationUnitDecl * castFromDeclContext(const DeclContext *DC)
bool IsEnumDeclScoped(EnumDecl *ED)
Check if the given decl is scoped.
static bool classofKind(Kind K)
Stmt - This represents one statement.
Expr * getBitWidth() const
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
FunctionType - C99 6.7.5.3 - Function Declarators.
TagDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, TagDecl *PrevDecl, SourceLocation StartL)
bool IsICE
Whether this statement is an integral constant expression, or in C++11, whether the statement is a co...
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
void setEmbeddedInDeclarator(bool isInDeclarator)
TypedefDecl - Represents the declaration of a typedef-name via the 'typedef' type specifier...
C Language Family Type Representation.
const EnumDecl * getCanonicalDecl() const
void setParam(unsigned i, ImplicitParamDecl *P)
bool IsEvaluating
Whether this statement is being evaluated.
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
const RecordDecl * getMostRecentDecl() const
bool hasVolatileMember() const
param_const_iterator param_end() const
redeclarable_base::redecl_range redecl_range
static TemplateSpecializationKind getTemplateSpecializationKind(Decl *D)
Determine what kind of template specialization the given declaration is.
const Type * getTypeForDecl() const
DeclaratorDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL)
Decl - This represents one declaration (or definition), e.g.
unsigned getNumCaptures() const
getNumCaptures - Returns the number of captured variables.
void setRangeEnd(SourceLocation E)
redeclarable_base::redecl_iterator redecl_iterator
bool hasUnusedResultAttr() const
Returns true if this function or its return type has the warn_unused_result attribute.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
EnumDecl * getPreviousDecl()
ThreadStorageClassSpecifier getTSCSpec() const
param_iterator param_end()
NamedDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N)
Parameter for C++ 'this' argument.
bool hasWrittenPrototype() const
ImplicitParamKind
Defines the kind of the implicit parameter: is this an implicit parameter with pointer to 'this'...
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
unsigned getBlockManglingNumber() const
const RecordDecl * getParent() const
getParent - Returns the parent of this field declaration, which is the struct in which this field is ...
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement...
The base class of the type hierarchy.
Represents an empty-declaration.
void setCopyExpr(Expr *e)
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of this declaration, if it was present in ...
bool usesSEHTry() const
Indicates the function uses __try.
Declaration of a variable template.
NamespaceDecl - Represent a C++ namespace.
A container of type source information.
QualType getCallResultType() const
Determine the type of an expression that calls this function.
StorageDuration
The storage duration for an object (per C++ [basic.stc]).
StringLiteral * getAsmString()
ArrayRef< Capture >::const_iterator capture_const_iterator
bool CheckingICE
Whether we are checking whether this statement is an integral constant expression.
const Expr * getAnyInitializer() const
getAnyInitializer - Get the initializer for this variable, no matter which declaration it is attached...
void setInitStyle(InitializationStyle Style)
ArrayRef< ParmVarDecl * >::const_iterator param_const_iterator
MutableArrayRef< ParmVarDecl * >::iterator param_iterator
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
size_t param_size() const
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
capture_const_iterator capture_end() const
static CapturedDecl * castFromDeclContext(const DeclContext *DC)
VarDecl * getMostRecentDeclImpl() override
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
enumerator_range enumerators() const
ExplicitVisibilityKind
Kinds of explicit visibility.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
bool WasEvaluated
Whether this statement was already evaluated.
QualType getReturnType() const
RecordDecl * getPreviousDecl()
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
static bool classofKind(Kind K)
const T * getAs() const
Member-template getAs<specific type>'.
redeclarable_base::redecl_range redecl_range
bool hasInheritedDefaultArg() const
size_t numTrailingObjects(OverloadToken< ImplicitParamDecl >)
Declaration context for names declared as extern "C" in C++.
The "__interface" keyword.
Parameter for Objective-C '_cmd' argument.
const FunctionDecl * getCanonicalDecl() const
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
NamespaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this namespace.
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getContextParamPosition() const
static StringRef getTagTypeKindName(TagTypeKind Kind)
static bool classof(const Decl *D)
Describes how types, statements, expressions, and declarations should be printed. ...
static DeclContext * castToDeclContext(const ExportDecl *D)
unsigned IsExplicitSpecified
static const NamedDecl * getDefinition(const Decl *D)
ParmVarDecl - Represents a parameter to a function.
ArrayRef< ParmVarDecl * >::const_iterator param_const_iterator
MutableArrayRef< ParmVarDecl * >::iterator param_iterator
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
Provides information about a dependent function-template specialization declaration.
MutableArrayRef< ParmVarDecl * > parameters()
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable.
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
Types, declared with 'struct foo', typedefs, etc.
Base wrapper for a particular "section" of type source info.
LabelStmt - Represents a label, which has a substatement.
RecordDecl - Represents a struct/union/class.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Provides common interface for the Decls that can be redeclared.
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists...
FunctionDecl * getPreviousDeclImpl() override
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain...
static bool classofKind(Kind K)
Linkage getFormalLinkage() const
Get the linkage from a semantic point of view.
bool isComplete() const
Returns true if this can be considered a complete type.
One of these records is kept for each identifier that is lexed.
void setIntegerType(QualType T)
Set the underlying integer type.
bool hasBody() const override
Returns true if this Decl represents a declaration for a body of code, such as a function or method d...
static bool classofKind(Kind K)
FieldDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this field.
static bool classof(const Decl *D)
void setCompleteDefinition(bool V)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
bool isInline() const
Returns true if this is an inline namespace declaration.
bool CheckedICE
Whether we already checked whether this statement was an integral constant expression.
static bool classof(const Decl *D)
RecordDecl * getDefinition() const
getDefinition - Returns the RecordDecl that actually defines this struct/union/class.
field_range fields() const
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
void setBlockMissingReturnType(bool val)
ImplicitParamDecl * getContextParam() const
Retrieve the parameter containing captured variables.
Parameter for C++ virtual table pointers.
const llvm::APSInt & getInitVal() const
void setLocStart(SourceLocation L)
const FunctionDecl * getDefinition() const
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
static DeclContext * castToDeclContext(const FunctionDecl *D)
StringRef getValue() const
ImplicitParamDecl(ASTContext &C, QualType Type, ImplicitParamKind ParamKind)
FieldDecl * getAnonField() const
void overrideType(QualType T)
Override the type stored in this TypeSourceInfo. Use with caution!
Linkage getFormalLinkage(Linkage L)
static bool classofKind(Kind K)
bool isExternallyDeclarable() const
Determine whether this declaration can be redeclared in a different translation unit.
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
void setNumPositiveBits(unsigned Num)
void setParams(ArrayRef< ParmVarDecl *> NewParamInfo)
bool hasLoadedFieldsFromExternalStorage() const
bool isPreviousDeclInSameBlockScope() const
Whether this local extern variable declaration's previous declaration was declared in the same block ...
TypedefNameDecl * getNextRedeclarationImpl() override
Returns the next redeclaration or itself if this is the only decl.
TypeSourceInfo * getSignatureAsWritten() const
Describes a module or submodule.
static bool classofKind(Kind K)
ArrayRef< ParmVarDecl * > parameters() const
virtual bool isDefined() const
SourceLocation getAsmLoc() const
Provides information about a function template specialization, which is a FunctionDecl that has been ...
TypedefNameDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this typedef-name.
unsigned getNumParams() const
static NamespaceDecl * castFromDeclContext(const DeclContext *DC)
InitializationStyle
Initialization styles.
static bool classof(const Decl *D)
bool isBitField() const
Determines whether this field is a bitfield.
TypeDecl(Kind DK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, SourceLocation StartL=SourceLocation())
TagKind getTagKind() const
redeclarable_base::redecl_iterator redecl_iterator
A convenient class for passing around template argument information.
bool isKNRPromoted() const
True if the value passed to this parameter must undergo K&R-style default argument promotion: ...
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
const FieldDecl * getCanonicalDecl() const
Parameter for captured context.
bool hasPrototype() const
Whether this function has a prototype, either because one was explicitly written or because it was "i...
ArrayRef< NamedDecl * > chain() const
ASTContext & getASTContext() const
Visibility
Describes the different kinds of visibility that a declaration may have.
param_iterator param_end() const
Retrieve an iterator one past the last parameter decl.
static bool classof(const Decl *D)
DefinitionKind hasDefinition() const
bool isByRef() const
Whether this is a "by ref" capture, i.e.
TypeDecl - Represents a declaration of a type.
void setHasObjectMember(bool val)
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum...
A set of unresolved declarations.
void setHasImplicitReturnZero(bool IRZ)
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization...
void setExceptionVariable(bool EV)
Defines the Diagnostic-related interfaces.
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
static bool classof(const Decl *D)
FunctionDecl * getMostRecentDeclImpl() override
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
bool hasUnparsedDefaultArg() const
hasUnparsedDefaultArg - Determines whether this parameter has a default argument that has not yet bee...
static BlockDecl * castFromDeclContext(const DeclContext *DC)
TagDecl * getPreviousDeclImpl() override
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain...
static bool classof(const Decl *D)
Defines the Linkage enumeration and various utility functions.
const Expr * getInitExpr() const
bool hasNameForLinkage() const
Is this tag type named, either directly or via being defined in a typedef of this type...
TypedefNameDecl * getPreviousDeclImpl() override
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain...
bool isCompleteDefinitionRequired() const
Return true if this complete decl is required to be complete for some existing use.
void setNumNegativeBits(unsigned Num)
static bool classofKind(Kind K)
redeclarable_base::redecl_range redecl_range
This represents the body of a CapturedStmt, and serves as its DeclContext.
void setInitVal(const llvm::APSInt &V)
void setInitExpr(Expr *E)
void setStmt(LabelStmt *T)
void setLocStart(SourceLocation L)
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInlineSpecified=false, bool hasWrittenPrototype=true, bool isConstexprSpecified=false)
SourceLocation getLocEnd() const LLVM_READONLY
VarDecl * getPreviousDeclImpl() override
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain...
bool isAnonymousStructOrUnion() const
isAnonymousStructOrUnion - Whether this is an anonymous struct or union.
param_iterator param_begin()
void setHasInheritedPrototype(bool P=true)
Defines the clang::Visibility enumeration and various utility functions.
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
param_const_iterator param_end() const
static bool classof(const Decl *D)
StorageDuration getStorageDuration() const
Get the storage duration of this variable, per C++ [basic.stc].
static bool classof(const Decl *D)
void removeInClassInitializer()
removeInClassInitializer - Remove the C++11 in-class initializer from this member.
void setInline(bool Inline)
Set whether this is an inline namespace declaration.
Provides definitions for the various language-specific address spaces.
void setLazyBody(uint64_t Offset)
bool isExternalFormalLinkage(Linkage L)
RecordDecl * getMostRecentDecl()
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x alias-declaration.
A little helper class used to produce diagnostics.
CompoundStmt - This represents a group of statements like { stmt stmt }.
void setHasLoadedFieldsFromExternalStorage(bool val)
static bool classof(const Decl *D)
bool isFileVarDecl() const
isFileVarDecl - Returns true for file scoped variable declaration.
static bool classofKind(Kind K)
SourceLocation getLocStart() const LLVM_READONLY
static bool classof(const Decl *D)
Represents a ValueDecl that came out of a declarator.
QualType getPromotionType() const
getPromotionType - Return the integer type that enumerators should promote to.
bool isInlineSpecified() const
TypeSourceInfo * getTypeSourceInfo() const
static bool classof(const Decl *D)
void setInClassInitializer(Expr *Init)
setInClassInitializer - Set the C++11 in-class initializer for this member.
FieldDecl(Kind DK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
bool isTransparentTag() const
Determines if this typedef shares a name and spelling location with its underlying tag type...
static bool classof(const Decl *D)
TypedefNameDecl * getMostRecentDeclImpl() override
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
unsigned getFunctionScopeDepth() const
bool isDependentType() const
Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
StringRef getKindName() const
TypedefNameDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
unsigned getChainingSize() const
void setBitWidth(Expr *Width)
setBitWidth - Set the bit-field width for this member.
static bool classofKind(Kind K)
bool isDefaulted() const
Whether this function is defaulted per C++0x.
static bool classof(const Decl *D)
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
bool hasLocalStorage() const
hasLocalStorage - Returns true if a variable with function scope is a non-static local variable...
const FunctionProtoType * T
NamespaceDecl * getAnonymousNamespace() const
void setRBraceLoc(SourceLocation L)
unsigned getNumParams() const
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
std::string getAsString() const
getNameAsString - Retrieve the human-readable string for this name.
bool isAnonymousNamespace() const
Returns true if this is an anonymous namespace declaration.
bool isExceptionVariable() const
Determine whether this variable is the exception variable in a C++ catch statememt or an Objective-C ...
void setContextParam(unsigned i, ImplicitParamDecl *P)
Defines an enumeration for C++ overloaded operators.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of this declaration, if it was present in ...
field_iterator field_end() const
ArrayRef< ImplicitParamDecl * > parameters() const
TemplateParameterList * getTemplateParameterList(unsigned index) const
static bool classofKind(Kind K)
llvm::PointerUnion< Stmt *, EvaluatedStmt * > InitType
This declaration is a tentative definition.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
static bool classof(const Decl *D)
void setCompleteDefinitionRequired(bool V=true)
EnumDecl * getDefinition() const
EnumDecl * getMostRecentDecl()
void setLateTemplateParsed(bool ILT=true)
const ParmVarDecl * getParamDecl(unsigned i) const
void setLocStart(SourceLocation L)
static DeclContext * castToDeclContext(const CapturedDecl *D)
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier.
MutableArrayRef< ParmVarDecl * > parameters()
void setModulePrivate()
Specify that this declaration was marked as being private to the module in which it was defined...
const VarDecl * getDefinition() const
void setConstexpr(bool IC)
unsigned IsCopyDeductionCandidate
[C++17] Only used by CXXDeductionGuideDecl.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
bool isFunctionOrMethod() const
StorageClass
Storage classes.
static Optional< Visibility > getExplicitVisibility(const NamedDecl *D, LVComputationKind kind)
llvm::iterator_range< specific_decl_iterator< FieldDecl > > field_range
enumerator_iterator enumerator_begin() const
bool isIdentifier() const
Predicate functions for querying what type of name this is.
InClassInitStyle
In-class initialization styles for non-static data members.
Declaration of an alias template.
const EnumConstantDecl * getCanonicalDecl() const
bool isExternallyVisible(Linkage L)
unsigned IsScopedUsingClassTag
IsScopedUsingClassTag - If this tag declaration is a scoped enum, then this is true if the scoped enu...
void setModedTypeSourceInfo(TypeSourceInfo *unmodedTSI, QualType modedTy)
static bool hasDefinition(const ObjCObjectPointerType *ObjPtr)
const IndirectFieldDecl * getCanonicalDecl() const
SourceLocation getCaretLocation() const
const EnumDecl * getMostRecentDecl() const
static bool classof(const Decl *D)
TagDecl * getMostRecentDeclImpl() override
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
StringRef getName() const
static DeclContext * castToDeclContext(const NamespaceDecl *D)
This template specialization was implicitly instantiated from a template.
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
DefinitionKind isThisDeclarationADefinition() const
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
bool IsEnumDeclComplete(EnumDecl *ED)
Check if the given decl is complete.
void setBlockMangling(unsigned Number, Decl *Ctx)
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
static StringRef getIdentifier(const Token &Tok)
static bool classofKind(Kind K)
static bool classof(const Decl *D)
bool isDirectInit() const
Whether the initializer is a direct-initializer (list or call).
param_iterator param_begin()
void setIsVariadic(bool value)
bool hasInheritedPrototype() const
Whether this function inherited its prototype from a previous declaration.
BlockDecl(DeclContext *DC, SourceLocation CaretLoc)
virtual void printName(raw_ostream &os) const
void setTypeForDecl(const Type *TD)
static bool classof(const Decl *D)
Represents a C++ Modules TS module export declaration.
chain_iterator chain_end() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
QualifierInfo - A struct with extended info about a syntactic name qualifier, to be used for the case...
Decl::Kind getDeclKind() const
static bool classofKind(Kind K)
static bool classofKind(Kind K)
static bool classof(const Decl *D)
static ExternCContextDecl * castFromDeclContext(const DeclContext *DC)
const VarDecl * getActingDefinition() const
ArrayRef< NamedDecl * >::const_iterator chain_iterator
void setIsConversionFromLambda(bool val)
void setKNRPromoted(bool promoted)
Encodes a location in the source.
static DeclContext * castToDeclContext(const TranslationUnitDecl *D)
bool isPure() const
Whether this virtual function is pure, i.e.
ImplicitParamDecl *const * param_iterator
decl_iterator decls_begin() const
static bool classof(const Decl *D)
static bool classofKind(Kind K)
void setBraceRange(SourceRange R)
ParmVarDecl * getParamDecl(unsigned i)
void setAnonymousNamespace(NamespaceDecl *D)
static bool classofKind(Kind K)
SourceLocation getLocStart() const LLVM_READONLY
std::string getNameAsString() const
getNameAsString - Get a human-readable name for the declaration, even if it is one of the special kin...
bool isUnnamedBitfield() const
Determines whether this is an unnamed bitfield.
redeclarable_base::redecl_iterator redecl_iterator
const VariableArrayType * getCapturedVLAType() const
Get the captured variable length array type.
void setFreeStanding(bool isFreeStanding=true)
TagDecl - Represents the declaration of a struct/union/class/enum.
LanguageLinkage
Describes the different kinds of language linkage (C++ [dcl.link]) that an entity may have...
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
LabelDecl - Represents the declaration of a label.
TagDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set...
SourceLocation getRParenLoc() const
const NamespaceDecl * getCanonicalDecl() const
void setDefaulted(bool D=true)
void setHasFlexibleArrayMember(bool V)
EnumDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool hasGlobalStorage() const
Returns true for all variables that do not have local storage.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
C-style initialization with assignment.
void setInstantiationOfMemberEnum(EnumDecl *ED, TemplateSpecializationKind TSK)
Specify that this enumeration is an instantiation of the member enumeration ED.
bool isConversionFromLambda() const
static bool classof(const Decl *D)
const ParmVarDecl * getParamDecl(unsigned i) const
void demoteThisDefinitionToDeclaration()
This is a definition which should be demoted to a declaration.
IndirectFieldDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
void setDeclName(DeclarationName N)
Set the name of this declaration.
Capture(VarDecl *variable, bool byRef, bool nested, Expr *copy)
FunctionDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass S, bool isInlineSpecified, bool isConstexprSpecified)
llvm::iterator_range< specific_decl_iterator< EnumConstantDecl > > enumerator_range
ParmVarDecl * getParamDecl(unsigned i)
void setTagKind(TagKind TK)
This declaration is only a declaration.
Direct list-initialization.
void removeBitWidth()
removeBitWidth - Remove the bit-field width from this member.
bool isMSAsmLabel() const
static ExportDecl * castFromDeclContext(const DeclContext *DC)
Decl * getBlockManglingContextDecl() const
bool hasLinkageBeenComputed() const
True if something has required us to compute the linkage of this declaration.
bool hasUninstantiatedDefaultArg() const
VarDecl * getVariable() const
The variable being captured.
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted per C++0x.
DeclarationNameInfo getNameInfo() const
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
const Expr * getDefaultArg() const
bool hasImplicitReturnZero() const
Whether falling off this function implicitly returns null/zero.
static DeclContext * castToDeclContext(const BlockDecl *D)
void setExplicitlyDefaulted(bool ED=true)
void setHasInheritedDefaultArg(bool I=true)
bool hasFlexibleArrayMember() const
static bool classofKind(Kind K)
Describes a module import declaration, which makes the contents of the named module visible in the cu...
const TypedefNameDecl * getCanonicalDecl() const
void setVirtualAsWritten(bool V)
Defines various enumerations that describe declaration and type specifiers.
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
ObjCDeclQualifier getObjCDeclQualifier() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
const NamedDecl * getMostRecentDecl() const
decl_iterator - Iterates through the declarations stored within this context.
Base class for declarations which introduce a typedef-name.
void setAnonymousNamespace(NamespaceDecl *D)
LabelStmt * getStmt() const
TagTypeKind
The kind of a tag type.
static bool classofKind(Kind K)
Dataflow Directional Tag Classes.
void setDescribedAliasTemplate(TypeAliasTemplateDecl *TAT)
void setBody(CompoundStmt *B)
bool isValid() const
Return true if this is a valid SourceLocation object.
void setImplicitlyInline()
Flag that this function is implicitly inline.
MutableArrayRef< ImplicitParamDecl * > parameters()
const EnumDecl * getPreviousDecl() const
void setHasVolatileMember(bool val)
EnumConstantDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this enumerator.
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
param_const_iterator param_begin() const
CompoundStmt * getCompoundBody() const
ArrayRef< Capture > captures() const
bool isNested() const
Whether this is a nested capture, i.e.
FunctionDecl * getNextRedeclarationImpl() override
Returns the next redeclaration or itself if this is the only decl.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
const VarDecl * getCanonicalDecl() const
VarDecl * getNextRedeclarationImpl() override
Returns the next redeclaration or itself if this is the only decl.
StringRef getMSAsmLabel() const
Parameter for Objective-C 'self' argument.
InitType Init
The initializer for this variable or, for a ParmVarDecl, the C++ default argument.
ParmVarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
Reads an AST files chain containing the contents of a translation unit.
TagDecl * getNextRedeclarationImpl() override
Returns the next redeclaration or itself if this is the only decl.
void setARCPseudoStrong(bool ps)
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
QualType getUnderlyingType() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
const Expr * getInit() const
unsigned IsScoped
IsScoped - True if this tag declaration is a scoped enumeration.
bool isEmbeddedInDeclarator() const
unsigned getNumTemplateParameterLists() const
TLSKind
Kinds of thread-local storage.
void setWillHaveBody(bool V=true)
DeclarationName - The name of a declaration.
void setInstantiationIsPending(bool IC)
bool isCXXClassMember() const
Determine whether this declaration is a C++ class member.
void setInstantiationOfMemberFunction(FunctionDecl *FD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member function FD.
ParmVarDeclBitfields ParmVarDeclBits
bool instantiationIsPending() const
Whether the instantiation of this function is pending.
SourceLocation getLocStart() const LLVM_READONLY
unsigned getNumTemplateParameterLists() const
EnumDecl - Represents an enum.
llvm::iterator_range< redecl_iterator > redecl_range
void setInlineSpecified()
static bool classof(const Decl *D)
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
Tags, declared with 'struct foo;' and referenced with 'struct foo'.
void setPreviousDeclInSameBlockScope(bool Same)
const RecordDecl * getPreviousDecl() const
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).
param_iterator param_end()
void setInitCapture(bool IC)
void setImplicitlyInline()
Do an LV computation for, ultimately, a type.
unsigned MayHaveOutOfDateDef
Indicates whether it is possible for declarations of this kind to have an out-of-date definition...
Not an overloaded operator.
ImplicitParamDecl(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType Type, ImplicitParamKind ParamKind)
static FunctionDecl * castFromDeclContext(const DeclContext *DC)
Provides common interface for the Decls that cannot be redeclared, but can be merged if the same decl...
static const TypeInfo & getInfo(unsigned id)
void setUnparsedDefaultArg()
setUnparsedDefaultArg - Specify that this parameter has an unparsed default argument.
NonParmVarDeclBitfields NonParmVarDeclBits
chain_iterator chain_begin() const
llvm::iterator_range< param_iterator > param_range
void setTypeSourceInfo(TypeSourceInfo *TI)
bool isStaticLocal() const
isStaticLocal - Returns true if a variable with function scope is a static local variable.
size_t param_size() const
const Expr * getUninstantiatedDefaultArg() const
TypeSourceInfo * getTypeSourceInfo() const
void setUsesSEHTry(bool UST)
static bool classof(const Decl *D)
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
ImplicitParamDecl * getParam(unsigned i) const
void setCXXForRangeDecl(bool FRD)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static bool classofKind(Kind K)
redeclarable_base::redecl_iterator redecl_iterator
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
unsigned IsBeingDefined
IsBeingDefined - True if this is currently being defined.
const Type * getTypePtrOrNull() const
static bool classofKind(Kind K)
void setInnerLocStart(SourceLocation L)
void setObjCMethodScopeInfo(unsigned parameterIndex)
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
bool capturesCXXThis() const
void setSignatureAsWritten(TypeSourceInfo *Sig)
void setPromotionType(QualType T)
Set the promotion type.
unsigned IsFixed
IsFixed - True if this is an enumeration with fixed underlying type.
void setAsmString(StringLiteral *Asm)
void setRParenLoc(SourceLocation L)
A template argument list.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
void setRBraceLoc(SourceLocation L)
const VarDecl * getDefinition(ASTContext &C) const
NestedNameSpecifierLoc QualifierLoc
bool isResolvedMSAsmLabel() const
static bool classofKind(Kind K)
Call-style initialization (C++98)
static DeclContext * castToDeclContext(const TagDecl *D)
static bool classofKind(Kind K)
ValueDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T)
ThreadStorageClassSpecifier
Thread storage-class-specifier.
Defines the clang::SourceLocation class and associated facilities.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
TypedefNameDecl * getTypedefNameForAnonDecl() const
bool isMutable() const
isMutable - Determines whether this field is mutable (C++ only).
bool isThisDeclarationADefinition() const
isThisDeclarationADefinition() - Return true if this declaration is a completion definition of the ty...
SourceLocation getRBraceLoc() const
void setTSCSpec(ThreadStorageClassSpecifier TSC)
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
static bool classofKind(Kind K)
void setConstexpr(bool IC)
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
Provides information a specialization of a member of a class template, which may be a member function...
VarDecl * getDefinition()
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
bool hasExternalStorage() const
Returns true if a variable has extern or private_extern storage.
static bool classof(const Decl *D)
static bool classofKind(Kind K)
StringLiteral - This represents a string literal expression, e.g.
TLS with a known-constant initializer.
QualType getIntegerType() const
getIntegerType - Return the integer type this enum decl corresponds to.
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body - that is, if it is a non-delete...
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
Kind
Lists the kind of concrete classes of Decl.
bool blockMissingReturnType() const
static TagDecl * castFromDeclContext(const DeclContext *DC)
static Decl::Kind getKind(const Decl *D)
VarDeclBitfields VarDeclBits
TranslationUnitDecl - The top declaration context.
bool isFunctionOrMethodVarDecl() const
isFunctionOrMethodVarDecl - Similar to isLocalVarDecl, but excludes variables declared in blocks...
static bool classofKind(Kind K)
static bool classof(const Decl *D)
const TagDecl * getCanonicalDecl() const
ArrayRef< ParmVarDecl * > parameters() const
NamedDecl * getMostRecentDecl()
Visibility getVisibility() const
Determines the visibility of this entity.
bool isDeleted() const
Whether this function has been deleted.
bool hasObjectMember() const
EnumConstantDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, Expr *E, const llvm::APSInt &V)
void setObjCDeclQualifier(ObjCDeclQualifier QTVal)
void setMSAsmLabelResolved()
bool isStaticDataMember() const
Determines whether this is a static data member.
SourceLocation getInnerLocStart() const
getInnerLocStart - Return SourceLocation representing start of source range ignoring outer template d...
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace nested inside this namespace, if any.
bool isLocalVarDecl() const
isLocalVarDecl - Returns true for local variable declarations other than parameters.
unsigned IsCompleteDefinitionRequired
Has the full definition of this type been required by a use somewhere in the TU.
void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template, const TemplateArgumentList *TemplateArgs, void *InsertPos, TemplateSpecializationKind TSK=TSK_ImplicitInstantiation, const TemplateArgumentListInfo *TemplateArgsAsWritten=nullptr, SourceLocation PointOfInstantiation=SourceLocation())
Specify that this function declaration is actually a function template specialization.
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 setIntegerTypeSourceInfo(TypeSourceInfo *TInfo)
Set the underlying integer type source info.
NamedDecl - This represents a decl with a name.
void setTypeSourceInfo(TypeSourceInfo *newType)
Represents a C array with a specified size that is not an integer-constant-expression.
Automatic storage duration (most local variables).
bool isInline() const
Whether this variable is (C++1z) inline.
ImplicitParamKind getParameterKind() const
Returns the implicit parameter kind.
Represents a #pragma detect_mismatch line.
static bool classofKind(Kind K)
SourceLocation getExportLoc() const
void setNRVOVariable(bool NRVO)
static bool classof(const Decl *D)
void setType(QualType newType)
bool isFreeStanding() const
SourceLocation getInnerLocStart() const
getInnerLocStart - Return SourceLocation representing start of source range ignoring outer template d...
void setDeletedAsWritten(bool D=true)
void setInlineSpecified(bool I)
Set whether the "inline" keyword was specified for this function.
TemplateParameterList * getTemplateParameterList(unsigned i) const
Declaration of a template function.
bool isLocalVarDeclOrParm() const
Similar to isLocalVarDecl but also includes parameters.
Attr - This represents one attribute.
bool isDeletedAsWritten() const
const StringLiteral * getAsmString() const
bool isExternallyVisible() const
QualType getType() const
Return the type wrapped by this type source info.
bool isBeingDefined() const
isBeingDefined - Return true if this decl is currently being defined.
SourceLocation getRBraceLoc() const
decl_iterator decls_end() const
param_const_iterator param_begin() const
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
bool hasExternalFormalLinkage() const
True if this decl has external linkage.
redeclarable_base::redecl_range redecl_range
static bool isExternC(const NamedDecl *ND)
Structure used to store a statement, the constant value to which it was evaluated (if any)...
TemplatedKind
The kind of templated function a FunctionDecl can be.