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();
254 virtual void anchor();
257 NamedDecl *getUnderlyingDeclImpl() LLVM_READONLY;
261 :
Decl(DK, DC, L), Name(N) {}
276 assert(Name.
isIdentifier() &&
"Name is not a simple identifier");
293 virtual void printName(raw_ostream &os)
const;
310 void printQualifiedName(raw_ostream &OS)
const;
311 void printQualifiedName(raw_ostream &OS,
const PrintingPolicy &Policy)
const;
314 std::string getQualifiedNameAsString()
const;
322 virtual void getNameForDiagnostic(raw_ostream &OS,
324 bool Qualified)
const;
336 bool declarationReplaces(
NamedDecl *OldD,
bool IsKnownNewer =
true)
const;
339 bool hasLinkage()
const;
351 if (isa<EnumDecl>(DC))
359 bool isCXXInstanceMember()
const;
366 Linkage getLinkageInternal()
const;
391 return getLinkageAndVisibility().getVisibility();
417 bool isLinkageValid()
const;
426 return hasCachedLinkage();
433 if (this->
getKind() != UsingShadow &&
434 this->
getKind() != ConstructorUsingShadow &&
435 this->
getKind() != ObjCCompatibleAlias &&
436 this->
getKind() != NamespaceAlias)
439 return getUnderlyingDeclImpl();
442 return const_cast<NamedDecl*
>(
this)->getUnderlyingDecl();
446 return cast<NamedDecl>(
static_cast<Decl *
>(
this)->getMostRecentDecl());
449 return const_cast<NamedDecl*
>(
this)->getMostRecentDecl();
471 bool MSAsmNameResolved =
false;
480 :
NamedDecl(
Label, DC, IdentL, II), TheStmt(S), LocStart(StartL) {}
482 void anchor()
override;
495 bool isGnuLocal()
const {
return LocStart != getLocation(); }
504 void setMSAsmLabel(StringRef Name);
528 llvm::PointerIntPair<NamespaceDecl *, 1, bool> AnonOrFirstNamespaceAndInline;
554 using redeclarable_base::redecls_begin;
555 using redeclarable_base::redecls_end;
556 using redeclarable_base::redecls;
557 using redeclarable_base::getPreviousDecl;
558 using redeclarable_base::getMostRecentDecl;
559 using redeclarable_base::isFirstDecl;
576 return AnonOrFirstNamespaceAndInline.getInt();
581 AnonOrFirstNamespaceAndInline.setInt(Inline);
593 bool isOriginalNamespace()
const;
598 return getOriginalNamespace()->AnonOrFirstNamespaceAndInline.getPointer();
602 getOriginalNamespace()->AnonOrFirstNamespaceAndInline.setPointer(D);
607 return getOriginalNamespace();
610 return getOriginalNamespace();
640 void anchor()
override;
645 :
NamedDecl(DK, DC, L, N), DeclType(T) {}
669 unsigned NumTemplParamLists = 0;
683 void setTemplateParameterListsInfo(
ASTContext &Context,
696 llvm::PointerUnion<TypeSourceInfo *, ExtInfo *> DeclInfo;
702 bool hasExtInfo()
const {
return DeclInfo.is<ExtInfo*>(); }
703 ExtInfo *getExtInfo() {
return DeclInfo.get<ExtInfo*>(); }
704 const ExtInfo *getExtInfo()
const {
return DeclInfo.get<ExtInfo*>(); }
710 :
ValueDecl(DK, DC, L, N, T), DeclInfo(TInfo), InnerLocStart(StartL) {}
718 ? getExtInfo()->TInfo
724 getExtInfo()->TInfo = TI;
741 return getOuterLocStart();
747 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
755 return hasExtInfo() ? getExtInfo()->QualifierLoc
762 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
766 assert(index < getNumTemplateParameterLists());
767 return getExtInfo()->TemplParamLists[index];
770 void setTemplateParameterListsInfo(
ASTContext &Context,
778 return K >= firstDeclarator && K <= lastDeclarator;
843 static const char *getStorageClassSpecifierString(
StorageClass SC);
853 using InitType = llvm::PointerUnion<Stmt *, EvaluatedStmt *>;
864 class VarDeclBitfields {
869 unsigned TSCSpec : 2;
870 unsigned InitStyle : 2;
872 enum { NumVarDeclBits = 7 };
875 enum { NumParameterIndexBits = 8 };
888 unsigned : NumVarDeclBits;
892 unsigned HasInheritedDefaultArg : 1;
901 unsigned IsKNRPromoted : 1;
904 unsigned IsObjCMethodParam : 1;
910 unsigned ScopeDepthOrObjCQuals : 7;
914 unsigned ParameterIndex : NumParameterIndexBits;
922 unsigned : NumVarDeclBits;
927 unsigned IsThisDeclarationADemotedDefinition : 1;
931 unsigned ExceptionVar : 1;
936 unsigned NRVOVariable : 1;
940 unsigned CXXForRangeDecl : 1;
943 unsigned ObjCForDecl : 1;
947 unsigned ARCPseudoStrong : 1;
950 unsigned IsInline : 1;
953 unsigned IsInlineSpecified : 1;
956 unsigned IsConstexpr : 1;
960 unsigned IsInitCapture : 1;
965 unsigned PreviousDeclInSameBlockScope : 1;
969 unsigned ImplicitParamKind : 3;
986 return getNextRedeclaration();
990 return getPreviousDecl();
994 return getMostRecentDecl();
1001 using redeclarable_base::redecls_begin;
1002 using redeclarable_base::redecls_end;
1003 using redeclarable_base::redecls;
1004 using redeclarable_base::getPreviousDecl;
1005 using redeclarable_base::getMostRecentDecl;
1006 using redeclarable_base::isFirstDecl;
1025 VarDeclBits.TSCSpec = TSC;
1026 assert(VarDeclBits.TSCSpec == TSC &&
"truncation");
1036 if (getStorageClass() ==
SC_None) {
1048 if (getStorageClass() ==
SC_Register && !isLocalVarDeclOrParm())
1054 return getStorageClass() >=
SC_Auto;
1060 return (getStorageClass() ==
SC_Static ||
1063 && !isFileVarDecl();
1069 return getStorageClass() ==
SC_Extern ||
1093 bool isInExternCContext()
const;
1097 bool isInExternCXXContext()
const;
1107 if (
const DeclContext *DC = getLexicalDeclContext())
1108 return DC->getRedeclContext()->isFunctionOrMethod();
1114 return isLocalVarDecl() ||
getKind() == Decl::ParmVar;
1136 return getKind() != Decl::ParmVar && getDeclContext()->isRecord();
1160 return isThisDeclarationADefinition(getASTContext());
1171 VarDecl *getActingDefinition();
1173 return const_cast<VarDecl*
>(
this)->getActingDefinition();
1190 bool isOutOfLine()
const override;
1195 if (K == ParmVar || K == ImplicitParam)
1198 if (getLexicalDeclContext()->getRedeclContext()->isFileContext())
1201 if (isStaticDataMember())
1211 return getAnyInitializer(D);
1216 const Expr *getAnyInitializer(
const VarDecl *&D)
const;
1218 bool hasInit()
const;
1220 return const_cast<VarDecl *
>(
this)->getInit();
1225 Stmt **getInitAddress();
1227 void setInit(
Expr *I);
1233 bool isUsableInConstantExpressions(
ASTContext &
C)
const;
1241 APValue *evaluateValue()
const;
1247 APValue *getEvaluatedValue()
const;
1251 bool isInitKnownICE()
const;
1258 bool isInitICE()
const;
1262 bool checkInitIsICE()
const;
1265 VarDeclBits.InitStyle =
Style;
1284 return getInitStyle() != CInit;
1289 return isa<ParmVarDecl>(
this) ?
false :
1290 NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
1299 assert(isThisDeclarationADefinition() &&
"Not a definition!");
1300 assert(!isa<ParmVarDecl>(
this) &&
"Cannot demote ParmVarDecls!");
1301 NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
1307 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.ExceptionVar;
1310 assert(!isa<ParmVarDecl>(
this));
1311 NonParmVarDeclBits.ExceptionVar = EV;
1325 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.NRVOVariable;
1328 assert(!isa<ParmVarDecl>(
this));
1329 NonParmVarDeclBits.NRVOVariable = NRVO;
1335 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.CXXForRangeDecl;
1338 assert(!isa<ParmVarDecl>(
this));
1339 NonParmVarDeclBits.CXXForRangeDecl = FRD;
1345 return NonParmVarDeclBits.ObjCForDecl;
1349 NonParmVarDeclBits.ObjCForDecl = FRD;
1357 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.ARCPseudoStrong;
1360 assert(!isa<ParmVarDecl>(
this));
1361 NonParmVarDeclBits.ARCPseudoStrong = ps;
1366 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsInline;
1369 return isa<ParmVarDecl>(
this) ?
false 1370 : NonParmVarDeclBits.IsInlineSpecified;
1373 assert(!isa<ParmVarDecl>(
this));
1374 NonParmVarDeclBits.IsInline =
true;
1375 NonParmVarDeclBits.IsInlineSpecified =
true;
1378 assert(!isa<ParmVarDecl>(
this));
1379 NonParmVarDeclBits.IsInline =
true;
1384 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsConstexpr;
1387 assert(!isa<ParmVarDecl>(
this));
1388 NonParmVarDeclBits.IsConstexpr = IC;
1393 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsInitCapture;
1396 assert(!isa<ParmVarDecl>(
this));
1397 NonParmVarDeclBits.IsInitCapture = IC;
1403 return isa<ParmVarDecl>(
this)
1405 : NonParmVarDeclBits.PreviousDeclInSameBlockScope;
1408 assert(!isa<ParmVarDecl>(
this));
1409 NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
1414 VarDecl *getTemplateInstantiationPattern()
const;
1419 VarDecl *getInstantiatedFromStaticDataMember()
const;
1443 void setInstantiationOfStaticDataMember(
VarDecl *VD,
1464 bool isKnownToBeDefined()
const;
1472 void anchor()
override;
1510 :
VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
1512 NonParmVarDeclBits.ImplicitParamKind = ParamKind;
1520 NonParmVarDeclBits.ImplicitParamKind = ParamKind;
1537 enum { MaxFunctionScopeDepth = 255 };
1538 enum { MaxFunctionScopeIndex = 255 };
1544 :
VarDecl(DK, C, DC, StartLoc, IdLoc, Id, T, TInfo, S) {
1545 assert(ParmVarDeclBits.HasInheritedDefaultArg ==
false);
1546 assert(ParmVarDeclBits.DefaultArgKind == DAK_None);
1547 assert(ParmVarDeclBits.IsKNRPromoted ==
false);
1548 assert(ParmVarDeclBits.IsObjCMethodParam ==
false);
1549 setDefaultArg(DefArg);
1564 ParmVarDeclBits.IsObjCMethodParam =
true;
1565 setParameterIndex(parameterIndex);
1569 assert(!ParmVarDeclBits.IsObjCMethodParam);
1571 ParmVarDeclBits.ScopeDepthOrObjCQuals = scopeDepth;
1572 assert(ParmVarDeclBits.ScopeDepthOrObjCQuals == scopeDepth
1575 setParameterIndex(parameterIndex);
1579 return ParmVarDeclBits.IsObjCMethodParam;
1583 if (ParmVarDeclBits.IsObjCMethodParam)
return 0;
1584 return ParmVarDeclBits.ScopeDepthOrObjCQuals;
1589 return getParameterIndex();
1593 if (!ParmVarDeclBits.IsObjCMethodParam)
return OBJC_TQ_None;
1597 assert(ParmVarDeclBits.IsObjCMethodParam);
1598 ParmVarDeclBits.ScopeDepthOrObjCQuals = QTVal;
1610 return ParmVarDeclBits.IsKNRPromoted;
1613 ParmVarDeclBits.IsKNRPromoted = promoted;
1616 Expr *getDefaultArg();
1618 return const_cast<ParmVarDecl *
>(
this)->getDefaultArg();
1621 void setDefaultArg(
Expr *defarg);
1626 void setUninstantiatedDefaultArg(
Expr *arg);
1627 Expr *getUninstantiatedDefaultArg();
1629 return const_cast<ParmVarDecl *
>(
this)->getUninstantiatedDefaultArg();
1634 bool hasDefaultArg()
const;
1646 return ParmVarDeclBits.DefaultArgKind == DAK_Unparsed;
1650 return ParmVarDeclBits.DefaultArgKind == DAK_Uninstantiated;
1658 ParmVarDeclBits.DefaultArgKind = DAK_Unparsed;
1662 return ParmVarDeclBits.HasInheritedDefaultArg;
1666 ParmVarDeclBits.HasInheritedDefaultArg = I;
1673 bool isParameterPack()
const;
1686 enum { ParameterIndexSentinel = (1 << NumParameterIndexBits) - 1 };
1688 void setParameterIndex(
unsigned parameterIndex) {
1689 if (parameterIndex >= ParameterIndexSentinel) {
1690 setParameterIndexLarge(parameterIndex);
1694 ParmVarDeclBits.ParameterIndex = parameterIndex;
1695 assert(ParmVarDeclBits.ParameterIndex == parameterIndex &&
"truncation!");
1697 unsigned getParameterIndex()
const {
1698 unsigned d = ParmVarDeclBits.ParameterIndex;
1699 return d == ParameterIndexSentinel ? getParameterIndexLarge() : d;
1702 void setParameterIndexLarge(
unsigned parameterIndex);
1703 unsigned getParameterIndexLarge()
const;
1725 TK_DependentFunctionTemplateSpecialization
1738 unsigned SClass : 3;
1739 unsigned IsInline : 1;
1740 unsigned IsInlineSpecified : 1;
1748 unsigned IsVirtualAsWritten : 1;
1749 unsigned IsPure : 1;
1750 unsigned HasInheritedPrototype : 1;
1751 unsigned HasWrittenPrototype : 1;
1752 unsigned IsDeleted : 1;
1753 unsigned IsTrivial : 1;
1758 unsigned IsTrivialForCall : 1;
1760 unsigned IsDefaulted : 1;
1761 unsigned IsExplicitlyDefaulted : 1;
1762 unsigned HasImplicitReturnZero : 1;
1763 unsigned IsLateTemplateParsed : 1;
1764 unsigned IsConstexpr : 1;
1765 unsigned InstantiationIsPending : 1;
1768 unsigned UsesSEHTry : 1;
1772 unsigned HasSkippedBody : 1;
1776 unsigned WillHaveBody : 1;
1780 unsigned IsMultiVersion : 1;
1793 unsigned HasODRHash : 1;
1821 TemplateOrSpecialization;
1848 void setFunctionTemplateSpecialization(
ASTContext &
C,
1849 FunctionTemplateDecl *Template,
1867 bool isConstexprSpecified)
1871 IsInline(isInlineSpecified), IsInlineSpecified(isInlineSpecified),
1873 HasInheritedPrototype(
false), HasWrittenPrototype(
true),
1876 IsExplicitlyDefaulted(
false), HasImplicitReturnZero(
false),
1877 IsLateTemplateParsed(
false), IsConstexpr(isConstexprSpecified),
1878 InstantiationIsPending(
false), UsesSEHTry(
false), HasSkippedBody(
false),
1880 IsCopyDeductionCandidate(
false), HasODRHash(
false), ODRHash(0),
1881 EndRangeLoc(NameInfo.getEndLoc()), DNLoc(NameInfo.
getInfo()) {}
1886 return getNextRedeclaration();
1890 return getPreviousDecl();
1894 return getMostRecentDecl();
1904 using redeclarable_base::redecls_begin;
1905 using redeclarable_base::redecls_end;
1906 using redeclarable_base::redecls;
1907 using redeclarable_base::getPreviousDecl;
1908 using redeclarable_base::getMostRecentDecl;
1909 using redeclarable_base::isFirstDecl;
1916 bool isInlineSpecified =
false,
1917 bool hasWrittenPrototype =
true,
1918 bool isConstexprSpecified =
false) {
1922 isInlineSpecified, hasWrittenPrototype,
1923 isConstexprSpecified);
1931 bool isInlineSpecified,
1932 bool hasWrittenPrototype,
1933 bool isConstexprSpecified =
false);
1941 void getNameForDiagnostic(raw_ostream &OS,
const PrintingPolicy &Policy,
1942 bool Qualified)
const override;
1971 return hasBody(Definition);
1976 bool hasTrivialBody()
const;
1987 return isDefined(Definition);
1993 if (isDefined(Definition))
2011 return getBody(Definition);
2020 return IsDeleted || IsDefaulted || Body || HasSkippedBody ||
2021 IsLateTemplateParsed || WillHaveBody || hasDefiningAttr();
2026 return Body || IsLateTemplateParsed;
2029 void setBody(
Stmt *B);
2033 bool isVariadic()
const;
2042 void setPure(
bool P =
true);
2079 return HasWrittenPrototype || HasInheritedPrototype;
2131 bool isMain()
const;
2135 bool isMSVCRTEntryPoint()
const;
2150 bool isReservedGlobalPlacementOperator()
const;
2170 bool isReplaceableGlobalAllocationFunction(
bool *IsAligned =
nullptr)
const;
2173 bool isDestroyingOperatorDelete()
const;
2184 bool isInExternCContext()
const;
2188 bool isInExternCXXContext()
const;
2191 bool isGlobal()
const;
2195 bool isNoReturn()
const;
2216 bool isCPUDispatchMultiVersion()
const;
2219 bool isCPUSpecificMultiVersion()
const;
2228 unsigned getBuiltinID()
const;
2232 return {ParamInfo, getNumParams()};
2235 return {ParamInfo, getNumParams()};
2252 unsigned getNumParams()
const;
2255 assert(i < getNumParams() &&
"Illegal param #");
2256 return ParamInfo[i];
2259 assert(i < getNumParams() &&
"Illegal param #");
2260 return ParamInfo[i];
2263 setParams(getASTContext(), NewParamInfo);
2269 unsigned getMinRequiredArguments()
const;
2272 assert(
getType()->getAs<FunctionType>() &&
"Expected a FunctionType!");
2287 assert(
getType()->getAs<FunctionType>() &&
"Expected a FunctionType!");
2293 const Attr *getUnusedResultAttr()
const;
2309 IsInlineSpecified = I;
2323 bool isInlineDefinitionExternallyVisible()
const;
2325 bool isMSExternInline()
const;
2327 bool doesDeclarationForceExternallyVisibleDefinition()
const;
2332 return getOverloadedOperator() !=
OO_None;
2360 FunctionDecl *getInstantiatedFromMemberFunction()
const;
2368 MemberSpecializationInfo *getMemberSpecializationInfo()
const;
2374 setInstantiationOfMemberFunction(getASTContext(), FD, TSK);
2389 FunctionTemplateDecl *getDescribedFunctionTemplate()
const;
2391 void setDescribedFunctionTemplate(FunctionTemplateDecl *Template);
2396 return getPrimaryTemplate() !=
nullptr;
2401 FunctionDecl *getClassScopeSpecializationPattern()
const;
2406 FunctionTemplateSpecializationInfo *getTemplateSpecializationInfo()
const;
2411 bool isImplicitlyInstantiable()
const;
2427 FunctionTemplateDecl *getPrimaryTemplate()
const;
2444 getTemplateSpecializationArgsAsWritten()
const;
2471 setFunctionTemplateSpecialization(getASTContext(), Template, TemplateArgs,
2472 InsertPos, TSK, TemplateArgsAsWritten,
2473 PointOfInstantiation);
2478 void setDependentTemplateSpecialization(
ASTContext &Context,
2483 getDependentSpecializationInfo()
const;
2504 bool isOutOfLine()
const override;
2510 unsigned getMemoryFunctionKind()
const;
2514 unsigned getODRHash();
2518 unsigned getODRHash()
const;
2523 return K >= firstFunction && K <= lastFunction;
2535 unsigned BitField : 1;
2536 unsigned Mutable : 1;
2537 mutable unsigned CachedFieldIndex : 30;
2543 enum InitStorageKind {
2559 ISK_CapturedVLAType,
2564 struct InitAndBitWidth {
2578 llvm::PointerIntPair<void *, 2, InitStorageKind> InitStorage;
2586 BitField(
false), Mutable(Mutable), CachedFieldIndex(0),
2587 InitStorage(nullptr, (InitStorageKind) InitStyle) {
2621 bool isAnonymousStructOrUnion()
const;
2626 void *Ptr = InitStorage.getPointer();
2627 if (getInClassInitStyle())
2628 return static_cast<InitAndBitWidth*
>(Ptr)->BitWidth;
2629 return static_cast<Expr*
>(Ptr);
2632 unsigned getBitWidthValue(
const ASTContext &Ctx)
const;
2637 assert(!hasCapturedVLAType() && !BitField &&
2638 "bit width or captured type already set");
2639 assert(Width &&
"no bit width specified");
2640 InitStorage.setPointer(
2641 InitStorage.getInt()
2642 ?
new (getASTContext())
2643 InitAndBitWidth{getInClassInitializer(), Width}
2644 :
static_cast<void*
>(Width));
2651 assert(isBitField() &&
"no bitfield width to remove");
2652 InitStorage.setPointer(getInClassInitializer());
2659 bool isZeroLengthBitField(
const ASTContext &Ctx)
const;
2663 InitStorageKind storageKind = InitStorage.getInt();
2664 return (storageKind == ISK_CapturedVLAType
2677 if (!hasInClassInitializer())
2679 void *Ptr = InitStorage.getPointer();
2681 return static_cast<InitAndBitWidth*
>(Ptr)->Init;
2682 return static_cast<Expr*
>(Ptr);
2687 assert(hasInClassInitializer() && !getInClassInitializer());
2689 static_cast<InitAndBitWidth*
>(InitStorage.getPointer())->Init = Init;
2691 InitStorage.setPointer(Init);
2696 assert(hasInClassInitializer() &&
"no initializer to remove");
2697 InitStorage.setPointerAndInt(getBitWidth(), ISK_NoInit);
2703 return InitStorage.getInt() == ISK_CapturedVLAType;
2709 InitStorage.getPointer())
2719 return cast<RecordDecl>(getDeclContext());
2723 return cast<RecordDecl>(getDeclContext());
2748 const llvm::APSInt &V)
2749 :
ValueDecl(EnumConstant, DC, L, Id, T), Init((
Stmt*)E), Val(V) {}
2757 const llvm::APSInt &V);
2783 unsigned ChainingSize;
2789 void anchor()
override;
2803 return llvm::makeArrayRef(Chaining, ChainingSize);
2811 assert(chain().size() >= 2);
2812 return cast<FieldDecl>(chain().back());
2816 assert(chain().size() >= 2);
2817 return dyn_cast<
VarDecl>(chain().front());
2836 mutable const Type *TypeForDecl =
nullptr;
2841 void anchor()
override;
2846 :
NamedDecl(DK, DC, L, Id), LocStart(StartL) {}
2873 struct alignas(8) ModedTInfo {
2880 mutable llvm::PointerIntPair<
2881 llvm::PointerUnion<TypeSourceInfo *, ModedTInfo *>, 2>
2884 void anchor()
override;
2891 MaybeModedTInfo(TInfo, 0) {}
2896 return getNextRedeclaration();
2900 return getPreviousDecl();
2904 return getMostRecentDecl();
2911 using redeclarable_base::redecls_begin;
2912 using redeclarable_base::redecls_end;
2913 using redeclarable_base::redecls;
2914 using redeclarable_base::getPreviousDecl;
2915 using redeclarable_base::getMostRecentDecl;
2916 using redeclarable_base::isFirstDecl;
2919 return MaybeModedTInfo.getPointer().is<ModedTInfo *>();
2923 return isModed() ? MaybeModedTInfo.getPointer().get<ModedTInfo *>()->first
2928 return isModed() ? MaybeModedTInfo.getPointer().get<ModedTInfo *>()->second
2929 : MaybeModedTInfo.getPointer()
2935 MaybeModedTInfo.setPointer(newType);
2939 MaybeModedTInfo.setPointer(
new (getASTContext(), 8)
2940 ModedTInfo({unmodedTSI, modedTy}));
2952 TagDecl *getAnonDeclWithTypedefName(
bool AnyRedecl =
false)
const;
2957 if (MaybeModedTInfo.getInt())
2958 return MaybeModedTInfo.getInt() & 0x2;
2959 return isTransparentTagSlow();
2965 return K >= firstTypedefName && K <= lastTypedefName;
2969 bool isTransparentTagSlow()
const;
3001 Template(
nullptr) {}
3029 unsigned TagDeclKind : 3;
3034 unsigned IsCompleteDefinition : 1;
3043 unsigned IsEmbeddedInDeclarator : 1;
3046 unsigned IsFreeStanding : 1;
3092 llvm::PointerUnion<TypedefNameDecl *, ExtInfo *> TypedefNameDeclOrQualifier;
3094 bool hasExtInfo()
const {
return TypedefNameDeclOrQualifier.is<
ExtInfo *>(); }
3095 ExtInfo *getExtInfo() {
return TypedefNameDeclOrQualifier.get<
ExtInfo *>(); }
3096 const ExtInfo *getExtInfo()
const {
3097 return TypedefNameDeclOrQualifier.get<
ExtInfo *>();
3105 TagDeclKind(TK), IsCompleteDefinition(
false), IsBeingDefined(
false),
3106 IsEmbeddedInDeclarator(
false), IsFreeStanding(
false),
3107 IsCompleteDefinitionRequired(
false),
3109 assert((DK != Enum || TK ==
TTK_Enum) &&
3110 "EnumDecl not matched with TTK_Enum");
3111 setPreviousDecl(PrevDecl);
3117 return getNextRedeclaration();
3121 return getPreviousDecl();
3125 return getMostRecentDecl();
3131 void completeDefinition();
3140 using redeclarable_base::redecls_begin;
3141 using redeclarable_base::redecls_end;
3142 using redeclarable_base::redecls;
3143 using redeclarable_base::getPreviousDecl;
3144 using redeclarable_base::getMostRecentDecl;
3145 using redeclarable_base::isFirstDecl;
3167 return isCompleteDefinition();
3172 return IsCompleteDefinition;
3178 return IsCompleteDefinitionRequired;
3183 return IsBeingDefined;
3187 return IsEmbeddedInDeclarator;
3190 IsEmbeddedInDeclarator = isInDeclarator;
3195 IsFreeStanding = isFreeStanding;
3208 void startDefinition();
3223 IsCompleteDefinitionRequired = V;
3258 return (getDeclName() || getTypedefNameForAnonDecl());
3262 return hasExtInfo() ? nullptr
3271 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
3279 return hasExtInfo() ? getExtInfo()->QualifierLoc
3286 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
3290 assert(i < getNumTemplateParameterLists());
3291 return getExtInfo()->TemplParamLists[i];
3294 void setTemplateParameterListsInfo(
ASTContext &Context,
3328 llvm::PointerUnion<const Type *, TypeSourceInfo *> IntegerType;
3339 MemberSpecializationInfo *SpecializationInfo =
nullptr;
3342 unsigned HasODRHash : 1;
3347 bool Scoped,
bool ScopedUsingClassTag,
bool Fixed)
3349 assert(Scoped || !ScopedUsingClassTag);
3350 IntegerType = (
const Type *)
nullptr;
3351 NumNegativeBits = 0;
3352 NumPositiveBits = 0;
3354 IsScopedUsingClassTag = ScopedUsingClassTag;
3360 void anchor()
override;
3375 return cast_or_null<EnumDecl>(
3376 static_cast<TagDecl *
>(
this)->getPreviousDecl());
3379 return const_cast<EnumDecl*
>(
this)->getPreviousDecl();
3383 return cast<EnumDecl>(
static_cast<TagDecl *
>(
this)->getMostRecentDecl());
3386 return const_cast<EnumDecl*
>(
this)->getMostRecentDecl();
3396 bool IsScoped,
bool IsScopedUsingClassTag,
3405 void completeDefinition(
QualType NewType,
3407 unsigned NumPositiveBits,
3408 unsigned NumNegativeBits);
3413 llvm::iterator_range<specific_decl_iterator<EnumConstantDecl>>;
3445 if (
const Type *T = IntegerType.dyn_cast<
const Type*>())
3464 SourceRange getIntegerTypeRange()
const LLVM_READONLY;
3469 return NumPositiveBits;
3472 NumPositiveBits = Num;
3473 assert(NumPositiveBits == Num &&
"can't store this bitcount");
3486 return NumNegativeBits;
3489 NumNegativeBits = Num;
3499 return IsScopedUsingClassTag;
3508 unsigned getODRHash();
3514 return isCompleteDefinition() || IntegerType;
3519 bool isClosed()
const;
3523 bool isClosedFlag()
const;
3527 bool isClosedNonFlag()
const;
3531 EnumDecl *getTemplateInstantiationPattern()
const;
3536 EnumDecl *getInstantiatedFromMemberEnum()
const;
3552 return SpecializationInfo;
3559 setInstantiationOfMemberEnum(getASTContext(), ED, TSK);
3592 APK_CanNeverPassInRegs
3602 unsigned HasFlexibleArrayMember : 1;
3605 unsigned AnonymousStructOrUnion : 1;
3609 unsigned HasObjectMember : 1;
3613 unsigned HasVolatileMember : 1;
3619 mutable unsigned LoadedFieldsFromExternalStorage : 1;
3622 unsigned NonTrivialToPrimitiveDefaultInitialize : 1;
3623 unsigned NonTrivialToPrimitiveCopy : 1;
3624 unsigned NonTrivialToPrimitiveDestroy : 1;
3630 unsigned ParamDestroyedInCallee : 1;
3633 unsigned ArgPassingRestrictions : 2;
3647 return cast_or_null<RecordDecl>(
3648 static_cast<TagDecl *
>(
this)->getPreviousDecl());
3651 return const_cast<RecordDecl*
>(
this)->getPreviousDecl();
3655 return cast<RecordDecl>(
static_cast<TagDecl *
>(
this)->getMostRecentDecl());
3658 return const_cast<RecordDecl*
>(
this)->getMostRecentDecl();
3677 AnonymousStructOrUnion = Anon;
3687 return LoadedFieldsFromExternalStorage;
3690 LoadedFieldsFromExternalStorage = val;
3695 return NonTrivialToPrimitiveDefaultInitialize;
3699 NonTrivialToPrimitiveDefaultInitialize = V;
3703 return NonTrivialToPrimitiveCopy;
3707 NonTrivialToPrimitiveCopy = V;
3711 return NonTrivialToPrimitiveDestroy;
3715 NonTrivialToPrimitiveDestroy = V;
3722 return getArgPassingRestrictions() == APK_CanPassInRegs;
3730 ArgPassingRestrictions =
static_cast<uint8_t
>(
Kind);
3734 return ParamDestroyedInCallee;
3738 ParamDestroyedInCallee = V;
3754 bool isInjectedClassName()
const;
3758 bool isLambda()
const;
3762 bool isCapturedRecord()
const;
3766 void setCapturedRecord();
3784 using field_range = llvm::iterator_range<specific_decl_iterator<FieldDecl>>;
3795 return field_begin() == field_end();
3799 virtual void completeDefinition();
3803 return K >= firstRecord && K <= lastRecord;
3814 bool mayInsertExtraPadding(
bool EmitRemark =
false)
const;
3818 const FieldDecl *findFirstNamedDataMember()
const;
3822 void LoadFieldsFromExternalStorage()
const;
3831 :
Decl(FileScopeAsm, DC, StartL), AsmString(asmstring), RParenLoc(EndL) {}
3833 virtual void anchor();
3871 llvm::PointerIntPair<VarDecl*, 2> VariableAndFlags;
3880 : VariableAndFlags(variable,
3881 (byRef ? flag_isByRef : 0) | (nested ? flag_isNested : 0)),
3889 bool isByRef()
const {
return VariableAndFlags.getInt() & flag_isByRef; }
3893 bool isNested()
const {
return VariableAndFlags.getInt() & flag_isNested; }
3902 bool IsVariadic : 1;
3903 bool CapturesCXXThis : 1;
3904 bool BlockMissingReturnType : 1;
3905 bool IsConversionFromLambda : 1;
3909 bool DoesNotEscape : 1;
3915 unsigned NumParams = 0;
3917 Stmt *Body =
nullptr;
3920 const Capture *Captures =
nullptr;
3921 unsigned NumCaptures = 0;
3923 unsigned ManglingNumber = 0;
3924 Decl *ManglingContextDecl =
nullptr;
3929 CapturesCXXThis(
false), BlockMissingReturnType(
true),
3930 IsConversionFromLambda(
false), DoesNotEscape(
false) {}
3950 return {ParamInfo, getNumParams()};
3953 return {ParamInfo, getNumParams()};
3970 assert(i < getNumParams() &&
"Illegal param #");
3971 return ParamInfo[i];
3974 assert(i < getNumParams() &&
"Illegal param #");
3975 return ParamInfo[i];
3982 bool hasCaptures()
const {
return NumCaptures != 0 || CapturesCXXThis; }
4005 bool capturesVariable(
const VarDecl *var)
const;
4008 bool CapturesCXXThis);
4011 return ManglingNumber;
4015 return ManglingContextDecl;
4019 ManglingNumber = Number;
4020 ManglingContextDecl = Ctx;
4051 unsigned ContextParam;
4054 llvm::PointerIntPair<Stmt *, 1, bool> BodyAndNothrow;
4059 return getTrailingObjects<ImplicitParamDecl *>();
4063 return getTrailingObjects<ImplicitParamDecl *>();
4072 unsigned NumParams);
4074 unsigned NumParams);
4076 Stmt *getBody()
const override;
4077 void setBody(
Stmt *B);
4079 bool isNothrow()
const;
4080 void setNothrow(
bool Nothrow =
true);
4085 assert(i < NumParams);
4086 return getParams()[i];
4089 assert(i < NumParams);
4095 return {getParams(), getNumParams()};
4098 return {getParams(), getNumParams()};
4103 assert(ContextParam < NumParams);
4104 return getParam(ContextParam);
4107 assert(i < NumParams);
4155 llvm::PointerIntPair<Module *, 1, bool> ImportedAndComplete;
4183 unsigned NumLocations);
4208 virtual void anchor();
4235 return decls_empty() ? getLocation() : decls_begin()->getLocEnd();
4256 virtual void anchor();
4282 template<
typename decl_type>
4286 assert(RedeclLink.isFirst() &&
4287 "setPreviousDecl on a decl already in a redeclaration chain");
4293 First = PrevDecl->getFirstDecl();
4294 assert(
First->RedeclLink.isFirst() &&
"Expected first");
4295 decl_type *MostRecent =
First->getNextRedeclaration();
4296 RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4300 static_cast<decl_type*
>(
this)->IdentifierNamespace |=
4301 MostRecent->getIdentifierNamespace() &
4305 First =
static_cast<decl_type*
>(
this);
4309 First->RedeclLink.setLatest(static_cast<decl_type*>(
this));
4311 assert(!isa<NamedDecl>(static_cast<decl_type*>(
this)) ||
4312 cast<NamedDecl>(static_cast<decl_type*>(
this))->isLinkageValid());
4335 #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)
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)
Represents a function declaration or definition.
bool isThisDeclarationADemotedDefinition() const
If this definition should pretend to be a declaration.
void setNonTrivialToPrimitiveDestroy(bool V)
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
Returns the TagDecl that actually defines this struct/union/class/enum.
static bool classofKind(Kind K)
bool isOverloadedOperator() const
Whether this function declaration represents an C++ overloaded operator, e.g., "operator+".
bool hasCaptures() const
True if this block (or its nested blocks) captures anything of local storage from its enclosing scope...
static bool classofKind(Kind K)
param_iterator param_begin() const
Retrieve an iterator pointing to the first parameter decl.
static ClassTemplateDecl * getDefinition(ClassTemplateDecl *D)
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
void setNonTrivialToPrimitiveDefaultInitialize(bool V)
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...
An instance of this object exists for each enum constant that is defined.
void setEmbeddedInDeclarator(bool isInDeclarator)
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
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()
void setArgPassingRestrictions(ArgPassingKind Kind)
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
Returns the parent of this field declaration, which is the struct in which this field is defined...
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.
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
Get the initializer for this variable, no matter which declaration it is attached to...
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
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.
Represents a variable declaration or definition.
bool WasEvaluated
Whether this statement was already evaluated.
SourceLocation getEndLoc() const LLVM_READONLY
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
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...
std::string getName(ArrayRef< StringRef > Parts) const
Get the platform-specific name separator.
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
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.
Represents a struct/union/class.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
DeclarationName getDeclName() const
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)
bool doesNotEscape() const
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
Returns the RecordDecl that actually defines this struct/union/class.
SourceLocation getBeginLoc() const LLVM_READONLY
void setObjCForDecl(bool FRD)
field_range fields() const
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
Represents a member of a struct/union/class.
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.
ArgPassingKind
Enum that represents the different ways arguments are passed to and returned from function calls...
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)
SourceLocation getBeginLoc() const LLVM_READONLY
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
The argument of this type can be passed directly in registers.
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.
static void setTypedefNameForAnonDecl(TagDecl *From, TagDecl *To, ASTImporter &Importer)
bool isKNRPromoted() const
True if the value passed to this parameter must undergo K&R-style default argument promotion: ...
void setParamDestroyedInCallee(bool V)
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
SourceLocation getBeginLoc() const LLVM_READONLY
bool isByRef() const
Whether this is a "by ref" capture, i.e.
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
Determines whether this parameter has a default argument that has not yet been parsed.
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
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
ArgPassingKind getArgPassingRestrictions() const
VarDecl * getPreviousDeclImpl() override
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain...
bool isAnonymousStructOrUnion() const
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()
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...
Represents the declaration of a typedef-name via a C++11 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
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
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)
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)
void setTrivialForCall(bool IT)
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.
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
unsigned getFunctionScopeDepth() const
bool isMultiVersion() const
True if this function is considered a multiversioned function.
bool isDependentType() const
Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
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)
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
Returns true if a variable with function scope is a non-static local variable.
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)
The argument of this type cannot be passed directly in registers.
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
If this tag declaration is a scoped enum, then this is true if the scoped enum was declared using the...
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).
bool isNonTrivialToPrimitiveDestroy() const
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
bool isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C structs.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
A struct with extended info about a syntactic name qualifier, to be used for the case of out-of-line ...
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
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
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)
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
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()
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
bool canPassInRegisters() const
Determine whether this class can be passed in registers.
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
bool isTrivialForCall() 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)
Represents a field injected from an anonymous union/struct into the parent scope. ...
QualType getUnderlyingType() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
const Expr * getInit() const
unsigned 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 isNonTrivialToPrimitiveCopy() const
bool instantiationIsPending() const
Whether the instantiation of this function is pending.
SourceLocation getLocStart() const LLVM_READONLY
unsigned getNumTemplateParameterLists() const
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()
Specify that this parameter has an unparsed default argument.
NonParmVarDeclBitfields NonParmVarDeclBits
chain_iterator chain_begin() const
llvm::iterator_range< param_iterator > param_range
bool isObjCForDecl() const
Determine whether this variable is a for-loop declaration for a for-in statement in Objective-C...
void setTypeSourceInfo(TypeSourceInfo *TI)
bool isStaticLocal() const
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)
bool isParamDestroyedInCallee() const
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
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
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
Determines whether this field is mutable (C++ only).
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
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
Return the integer type this enum decl corresponds to.
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
StringRef getName() const
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
The top declaration context.
bool isFunctionOrMethodVarDecl() const
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
Return SourceLocation representing start of source range ignoring outer template declarations.
void setIsMultiVersion(bool V=true)
Sets the multiversion state for this declaration and all of its redeclarations.
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace nested inside this namespace, if any.
bool isLocalVarDecl() const
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.
This represents a decl that may have 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
Return start of source range ignoring outer template declarations.
void setNonTrivialToPrimitiveCopy(bool V)
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
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.