13 #ifndef LLVM_CLANG_AST_DECL_H 14 #define LLVM_CLANG_AST_DECL_H 36 #include "llvm/ADT/APSInt.h" 37 #include "llvm/ADT/ArrayRef.h" 38 #include "llvm/ADT/Optional.h" 39 #include "llvm/ADT/PointerIntPair.h" 40 #include "llvm/ADT/PointerUnion.h" 41 #include "llvm/ADT/StringRef.h" 42 #include "llvm/ADT/iterator_range.h" 43 #include "llvm/Support/Casting.h" 44 #include "llvm/Support/Compiler.h" 45 #include "llvm/Support/TrailingObjects.h" 55 struct ASTTemplateArgumentListInfo;
58 class DependentFunctionTemplateSpecializationInfo;
61 class FunctionTemplateDecl;
62 class FunctionTemplateSpecializationInfo;
63 class FunctionTypeLoc;
65 class MemberSpecializationInfo;
73 class TemplateArgumentList;
74 class TemplateArgumentListInfo;
75 class TemplateParameterList;
76 class TypeAliasTemplateDecl;
78 class UnresolvedSetImpl;
79 class VarTemplateDecl;
91 virtual void anchor();
125 :
Decl(PragmaComment, TU, CommentLoc), CommentKind(CommentKind) {}
127 virtual void anchor();
139 StringRef
getArg()
const {
return getTrailingObjects<char>(); }
159 :
Decl(PragmaDetectMismatch, TU, Loc), ValueStart(ValueStart) {}
161 virtual void anchor();
169 CreateDeserialized(
ASTContext &
C,
unsigned ID,
unsigned NameValueSize);
171 StringRef
getName()
const {
return getTrailingObjects<char>(); }
172 StringRef
getValue()
const {
return getTrailingObjects<char>() + ValueStart; }
201 virtual void anchor();
229 virtual void anchor();
232 NamedDecl *getUnderlyingDeclImpl() LLVM_READONLY;
236 :
Decl(DK, DC, L), Name(N) {}
251 assert(Name.
isIdentifier() &&
"Name is not a simple identifier");
268 virtual void printName(raw_ostream &os)
const;
285 void printQualifiedName(raw_ostream &OS)
const;
286 void printQualifiedName(raw_ostream &OS,
const PrintingPolicy &Policy)
const;
292 void printNestedNameSpecifier(raw_ostream &OS)
const;
293 void printNestedNameSpecifier(raw_ostream &OS,
297 std::string getQualifiedNameAsString()
const;
305 virtual void getNameForDiagnostic(raw_ostream &OS,
307 bool Qualified)
const;
319 bool declarationReplaces(
NamedDecl *OldD,
bool IsKnownNewer =
true)
const;
322 bool hasLinkage()
const;
334 if (isa<EnumDecl>(DC))
342 bool isCXXInstanceMember()
const;
349 Linkage getLinkageInternal()
const;
374 return getLinkageAndVisibility().getVisibility();
400 bool isLinkageValid()
const;
416 if (this->
getKind() != UsingShadow &&
417 this->
getKind() != ConstructorUsingShadow &&
418 this->
getKind() != ObjCCompatibleAlias &&
419 this->
getKind() != NamespaceAlias)
422 return getUnderlyingDeclImpl();
425 return const_cast<NamedDecl*
>(
this)->getUnderlyingDecl();
454 bool MSAsmNameResolved =
false;
463 :
NamedDecl(
Label, DC, IdentL, II), TheStmt(S), LocStart(StartL) {}
465 void anchor()
override;
487 void setMSAsmLabel(StringRef Name);
511 llvm::PointerIntPair<NamespaceDecl *, 1, bool> AnonOrFirstNamespaceAndInline;
537 using redeclarable_base::redecls_begin;
538 using redeclarable_base::redecls_end;
539 using redeclarable_base::redecls;
540 using redeclarable_base::getPreviousDecl;
541 using redeclarable_base::getMostRecentDecl;
542 using redeclarable_base::isFirstDecl;
559 return AnonOrFirstNamespaceAndInline.getInt();
564 AnonOrFirstNamespaceAndInline.setInt(Inline);
576 bool isOriginalNamespace()
const;
581 return getOriginalNamespace()->AnonOrFirstNamespaceAndInline.getPointer();
585 getOriginalNamespace()->AnonOrFirstNamespaceAndInline.setPointer(D);
590 return getOriginalNamespace();
593 return getOriginalNamespace();
622 void anchor()
override;
627 :
NamedDecl(DK, DC, L, N), DeclType(T) {}
651 unsigned NumTemplParamLists = 0;
665 void setTemplateParameterListsInfo(
ASTContext &Context,
677 Expr *TrailingRequiresClause =
nullptr;
680 llvm::PointerUnion<TypeSourceInfo *, ExtInfo *> DeclInfo;
686 bool hasExtInfo()
const {
return DeclInfo.is<ExtInfo*>(); }
687 ExtInfo *getExtInfo() {
return DeclInfo.get<ExtInfo*>(); }
688 const ExtInfo *getExtInfo()
const {
return DeclInfo.get<ExtInfo*>(); }
694 :
ValueDecl(DK, DC, L, N, T), DeclInfo(TInfo), InnerLocStart(StartL) {}
702 ? getExtInfo()->TInfo
708 getExtInfo()->TInfo = TI;
724 return getOuterLocStart();
730 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
738 return hasExtInfo() ? getExtInfo()->QualifierLoc
748 return hasExtInfo() ? getExtInfo()->TrailingRequiresClause
753 return hasExtInfo() ? getExtInfo()->TrailingRequiresClause
757 void setTrailingRequiresClause(
Expr *TrailingRequiresClause);
760 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
764 assert(index < getNumTemplateParameterLists());
765 return getExtInfo()->TemplParamLists[index];
768 void setTemplateParameterListsInfo(
ASTContext &Context,
777 return K >= firstDeclarator && K <= lastDeclarator;
849 static const char *getStorageClassSpecifierString(
StorageClass SC);
859 using InitType = llvm::PointerUnion<Stmt *, EvaluatedStmt *>;
870 class VarDeclBitfields {
875 unsigned TSCSpec : 2;
876 unsigned InitStyle : 2;
880 unsigned ARCPseudoStrong : 1;
882 enum { NumVarDeclBits = 8 };
885 enum { NumParameterIndexBits = 8 };
894 enum { NumScopeDepthOrObjCQualsBits = 7 };
900 unsigned : NumVarDeclBits;
904 unsigned HasInheritedDefaultArg : 1;
913 unsigned IsKNRPromoted : 1;
916 unsigned IsObjCMethodParam : 1;
922 unsigned ScopeDepthOrObjCQuals : NumScopeDepthOrObjCQualsBits;
926 unsigned ParameterIndex : NumParameterIndexBits;
934 unsigned : NumVarDeclBits;
939 unsigned IsThisDeclarationADemotedDefinition : 1;
943 unsigned ExceptionVar : 1;
948 unsigned NRVOVariable : 1;
952 unsigned CXXForRangeDecl : 1;
955 unsigned ObjCForDecl : 1;
958 unsigned IsInline : 1;
961 unsigned IsInlineSpecified : 1;
964 unsigned IsConstexpr : 1;
968 unsigned IsInitCapture : 1;
973 unsigned PreviousDeclInSameBlockScope : 1;
977 unsigned ImplicitParamKind : 3;
979 unsigned EscapingByref : 1;
996 return getNextRedeclaration();
1011 using redeclarable_base::redecls_begin;
1012 using redeclarable_base::redecls_end;
1013 using redeclarable_base::redecls;
1014 using redeclarable_base::getPreviousDecl;
1015 using redeclarable_base::getMostRecentDecl;
1016 using redeclarable_base::isFirstDecl;
1035 VarDeclBits.TSCSpec = TSC;
1036 assert(VarDeclBits.TSCSpec == TSC &&
"truncation");
1073 && !isFileVarDecl();
1103 bool isInExternCContext()
const;
1107 bool isInExternCXXContext()
const;
1118 return DC->getRedeclContext()->isFunctionOrMethod();
1124 return isLocalVarDecl() ||
getKind() == Decl::ParmVar;
1181 VarDecl *getActingDefinition();
1183 return const_cast<VarDecl*
>(
this)->getActingDefinition();
1205 if (K == ParmVar || K == ImplicitParam)
1211 if (isStaticDataMember())
1221 return getAnyInitializer(D);
1226 const Expr *getAnyInitializer(
const VarDecl *&D)
const;
1228 bool hasInit()
const;
1230 return const_cast<VarDecl *
>(
this)->getInit();
1235 Stmt **getInitAddress();
1237 void setInit(
Expr *I);
1242 VarDecl *getInitializingDeclaration();
1244 return const_cast<VarDecl *
>(
this)->getInitializingDeclaration();
1251 bool mightBeUsableInConstantExpressions(
ASTContext &
C)
const;
1256 bool isUsableInConstantExpressions(
ASTContext &C)
const;
1264 APValue *evaluateValue()
const;
1270 APValue *getEvaluatedValue()
const;
1282 bool isInitKnownICE()
const;
1289 bool isInitICE()
const;
1293 bool checkInitIsICE()
const;
1296 VarDeclBits.InitStyle =
Style;
1315 return getInitStyle() != CInit;
1320 return isa<ParmVarDecl>(
this) ?
false :
1321 NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
1330 assert(isThisDeclarationADefinition() &&
"Not a definition!");
1331 assert(!isa<ParmVarDecl>(
this) &&
"Cannot demote ParmVarDecls!");
1332 NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
1338 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.ExceptionVar;
1341 assert(!isa<ParmVarDecl>(
this));
1342 NonParmVarDeclBits.ExceptionVar = EV;
1356 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.NRVOVariable;
1359 assert(!isa<ParmVarDecl>(
this));
1360 NonParmVarDeclBits.NRVOVariable = NRVO;
1366 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.CXXForRangeDecl;
1369 assert(!isa<ParmVarDecl>(
this));
1370 NonParmVarDeclBits.CXXForRangeDecl = FRD;
1376 return NonParmVarDeclBits.ObjCForDecl;
1380 NonParmVarDeclBits.ObjCForDecl = FRD;
1395 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsInline;
1398 return isa<ParmVarDecl>(
this) ?
false 1399 : NonParmVarDeclBits.IsInlineSpecified;
1402 assert(!isa<ParmVarDecl>(
this));
1403 NonParmVarDeclBits.IsInline =
true;
1404 NonParmVarDeclBits.IsInlineSpecified =
true;
1407 assert(!isa<ParmVarDecl>(
this));
1408 NonParmVarDeclBits.IsInline =
true;
1413 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsConstexpr;
1416 assert(!isa<ParmVarDecl>(
this));
1417 NonParmVarDeclBits.IsConstexpr = IC;
1422 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsInitCapture;
1425 assert(!isa<ParmVarDecl>(
this));
1426 NonParmVarDeclBits.IsInitCapture = IC;
1436 return isa<ParmVarDecl>(
this)
1438 : NonParmVarDeclBits.PreviousDeclInSameBlockScope;
1441 assert(!isa<ParmVarDecl>(
this));
1442 NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
1448 bool isEscapingByref()
const;
1452 bool isNonEscapingByref()
const;
1455 NonParmVarDeclBits.EscapingByref =
true;
1460 VarDecl *getTemplateInstantiationPattern()
const;
1465 VarDecl *getInstantiatedFromStaticDataMember()
const;
1476 getTemplateSpecializationKindForInstantiation()
const;
1495 void setInstantiationOfStaticDataMember(
VarDecl *VD,
1516 bool isKnownToBeDefined()
const;
1532 void anchor()
override;
1570 :
VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
1572 NonParmVarDeclBits.ImplicitParamKind = ParamKind;
1580 NonParmVarDeclBits.ImplicitParamKind = ParamKind;
1597 enum { MaxFunctionScopeDepth = 255 };
1598 enum { MaxFunctionScopeIndex = 255 };
1604 :
VarDecl(DK, C, DC, StartLoc, IdLoc, Id, T, TInfo, S) {
1605 assert(ParmVarDeclBits.HasInheritedDefaultArg ==
false);
1606 assert(ParmVarDeclBits.DefaultArgKind == DAK_None);
1607 assert(ParmVarDeclBits.IsKNRPromoted ==
false);
1608 assert(ParmVarDeclBits.IsObjCMethodParam ==
false);
1609 setDefaultArg(DefArg);
1624 ParmVarDeclBits.IsObjCMethodParam =
true;
1625 setParameterIndex(parameterIndex);
1629 assert(!ParmVarDeclBits.IsObjCMethodParam);
1631 ParmVarDeclBits.ScopeDepthOrObjCQuals = scopeDepth;
1632 assert(ParmVarDeclBits.ScopeDepthOrObjCQuals == scopeDepth
1635 setParameterIndex(parameterIndex);
1639 return ParmVarDeclBits.IsObjCMethodParam;
1643 if (ParmVarDeclBits.IsObjCMethodParam)
return 0;
1644 return ParmVarDeclBits.ScopeDepthOrObjCQuals;
1648 return (1u << NumScopeDepthOrObjCQualsBits) - 1;
1653 return getParameterIndex();
1657 if (!ParmVarDeclBits.IsObjCMethodParam)
return OBJC_TQ_None;
1661 assert(ParmVarDeclBits.IsObjCMethodParam);
1662 ParmVarDeclBits.ScopeDepthOrObjCQuals = QTVal;
1674 return ParmVarDeclBits.IsKNRPromoted;
1677 ParmVarDeclBits.IsKNRPromoted = promoted;
1680 Expr *getDefaultArg();
1682 return const_cast<ParmVarDecl *
>(
this)->getDefaultArg();
1685 void setDefaultArg(
Expr *defarg);
1690 void setUninstantiatedDefaultArg(
Expr *arg);
1691 Expr *getUninstantiatedDefaultArg();
1693 return const_cast<ParmVarDecl *
>(
this)->getUninstantiatedDefaultArg();
1698 bool hasDefaultArg()
const;
1710 return ParmVarDeclBits.DefaultArgKind == DAK_Unparsed;
1714 return ParmVarDeclBits.DefaultArgKind == DAK_Uninstantiated;
1722 ParmVarDeclBits.DefaultArgKind = DAK_Unparsed;
1726 return ParmVarDeclBits.HasInheritedDefaultArg;
1730 ParmVarDeclBits.HasInheritedDefaultArg = I;
1746 enum { ParameterIndexSentinel = (1 << NumParameterIndexBits) - 1 };
1748 void setParameterIndex(
unsigned parameterIndex) {
1749 if (parameterIndex >= ParameterIndexSentinel) {
1750 setParameterIndexLarge(parameterIndex);
1754 ParmVarDeclBits.ParameterIndex = parameterIndex;
1755 assert(ParmVarDeclBits.ParameterIndex == parameterIndex &&
"truncation!");
1757 unsigned getParameterIndex()
const {
1758 unsigned d = ParmVarDeclBits.ParameterIndex;
1759 return d == ParameterIndexSentinel ? getParameterIndexLarge() : d;
1762 void setParameterIndexLarge(
unsigned parameterIndex);
1763 unsigned getParameterIndexLarge()
const;
1804 TK_DependentFunctionTemplateSpecialization
1812 unsigned NumLookups;
1820 return {getTrailingObjects<DeclAccessPair>(), NumLookups};
1866 TemplateOrSpecialization;
1893 void setFunctionTemplateSpecialization(
ASTContext &
C,
1894 FunctionTemplateDecl *Template,
1924 Expr *TrailingRequiresClause =
nullptr);
1929 return getNextRedeclaration();
1947 using redeclarable_base::redecls_begin;
1948 using redeclarable_base::redecls_end;
1949 using redeclarable_base::redecls;
1950 using redeclarable_base::getPreviousDecl;
1951 using redeclarable_base::getMostRecentDecl;
1952 using redeclarable_base::isFirstDecl;
1958 bool hasWrittenPrototype =
true,
1960 Expr *TrailingRequiresClause =
nullptr) {
1963 isInlineSpecified, hasWrittenPrototype,
1964 ConstexprKind, TrailingRequiresClause);
1971 bool isInlineSpecified,
bool hasWrittenPrototype,
1973 Expr *TrailingRequiresClause);
1981 void getNameForDiagnostic(raw_ostream &OS,
const PrintingPolicy &Policy,
1982 bool Qualified)
const override;
1989 if (FPT && FPT->isVariadic())
2024 bool hasTrivialBody()
const;
2035 return isDefined(Definition);
2041 if (isDefined(Definition))
2072 return isDeletedAsWritten() || isDefaulted() ||
2073 doesThisDeclarationHaveABody() || hasSkippedBody() ||
2080 isLateTemplateParsed();
2083 void setBody(
Stmt *B);
2093 bool isVariadic()
const;
2106 void setPure(
bool P =
true);
2148 auto *DeclAsWritten =
this;
2149 if (
FunctionDecl *Pattern = getTemplateInstantiationPattern())
2150 DeclAsWritten = Pattern;
2151 return !(DeclAsWritten->isDeleted() ||
2152 DeclAsWritten->getCanonicalDecl()->isDefaulted());
2174 return hasWrittenPrototype() || hasInheritedPrototype();
2271 bool isMain()
const;
2275 bool isMSVCRTEntryPoint()
const;
2290 bool isReservedGlobalPlacementOperator()
const;
2310 bool isReplaceableGlobalAllocationFunction(
bool *IsAligned =
nullptr)
const;
2313 bool isInlineBuiltinDeclaration()
const;
2316 bool isDestroyingOperatorDelete()
const;
2327 bool isInExternCContext()
const;
2331 bool isInExternCXXContext()
const;
2334 bool isGlobal()
const;
2338 bool isNoReturn()
const;
2369 bool isCPUDispatchMultiVersion()
const;
2372 bool isCPUSpecificMultiVersion()
const;
2376 bool isTargetMultiVersion()
const;
2385 if (
auto *TRC = getTrailingRequiresClause())
2396 unsigned getBuiltinID(
bool ConsiderWrapperFunctions =
false)
const;
2400 return {ParamInfo, getNumParams()};
2403 return {ParamInfo, getNumParams()};
2420 unsigned getNumParams()
const;
2423 assert(i < getNumParams() &&
"Illegal param #");
2424 return ParamInfo[i];
2427 assert(i < getNumParams() &&
"Illegal param #");
2428 return ParamInfo[i];
2437 unsigned getMinRequiredArguments()
const;
2463 auto *TSI = getTypeSourceInfo();
2464 QualType T = TSI ? TSI->getType() : getType();
2470 auto *TSI = getTypeSourceInfo();
2471 QualType T = TSI ? TSI->getType() : getType();
2515 bool isInlineDefinitionExternallyVisible()
const;
2517 bool isMSExternInline()
const;
2519 bool doesDeclarationForceExternallyVisibleDefinition()
const;
2526 return getOverloadedOperator() !=
OO_None;
2554 FunctionDecl *getInstantiatedFromMemberFunction()
const;
2562 MemberSpecializationInfo *getMemberSpecializationInfo()
const;
2583 FunctionTemplateDecl *getDescribedFunctionTemplate()
const;
2585 void setDescribedFunctionTemplate(FunctionTemplateDecl *Template);
2590 return getPrimaryTemplate() !=
nullptr;
2596 FunctionTemplateSpecializationInfo *getTemplateSpecializationInfo()
const;
2601 bool isImplicitlyInstantiable()
const;
2617 FunctionTemplateDecl *getPrimaryTemplate()
const;
2634 getTemplateSpecializationArgsAsWritten()
const;
2661 setFunctionTemplateSpecialization(
getASTContext(), Template, TemplateArgs,
2662 InsertPos, TSK, TemplateArgsAsWritten,
2663 PointOfInstantiation);
2668 void setDependentTemplateSpecialization(
ASTContext &Context,
2673 getDependentSpecializationInfo()
const;
2682 getTemplateSpecializationKindForInstantiation()
const;
2705 unsigned getMemoryFunctionKind()
const;
2709 unsigned getODRHash();
2713 unsigned getODRHash()
const;
2718 return K >= firstFunction && K <= lastFunction;
2730 unsigned BitField : 1;
2731 unsigned Mutable : 1;
2732 mutable unsigned CachedFieldIndex : 30;
2738 enum InitStorageKind {
2754 ISK_CapturedVLAType,
2759 struct InitAndBitWidth {
2773 llvm::PointerIntPair<void *, 2, InitStorageKind> InitStorage;
2781 BitField(
false), Mutable(Mutable), CachedFieldIndex(0),
2782 InitStorage(nullptr, (InitStorageKind) InitStyle) {
2801 unsigned getFieldIndex()
const;
2816 bool isAnonymousStructOrUnion()
const;
2821 void *Ptr = InitStorage.getPointer();
2822 if (getInClassInitStyle())
2823 return static_cast<InitAndBitWidth*
>(Ptr)->BitWidth;
2824 return static_cast<Expr*
>(Ptr);
2827 unsigned getBitWidthValue(
const ASTContext &Ctx)
const;
2832 assert(!hasCapturedVLAType() && !BitField &&
2833 "bit width or captured type already set");
2834 assert(Width &&
"no bit width specified");
2835 InitStorage.setPointer(
2836 InitStorage.getInt()
2838 InitAndBitWidth{getInClassInitializer(), Width}
2839 :
static_cast<void*
>(Width));
2846 assert(isBitField() &&
"no bitfield width to remove");
2847 InitStorage.setPointer(getInClassInitializer());
2854 bool isZeroLengthBitField(
const ASTContext &Ctx)
const;
2859 bool isZeroSize(
const ASTContext &Ctx)
const;
2863 InitStorageKind storageKind = InitStorage.getInt();
2864 return (storageKind == ISK_CapturedVLAType
2877 if (!hasInClassInitializer())
2879 void *Ptr = InitStorage.getPointer();
2881 return static_cast<InitAndBitWidth*
>(Ptr)->Init;
2882 return static_cast<Expr*
>(Ptr);
2887 assert(hasInClassInitializer() && !getInClassInitializer());
2889 static_cast<InitAndBitWidth*
>(InitStorage.getPointer())->Init = Init;
2891 InitStorage.setPointer(Init);
2896 assert(hasInClassInitializer() &&
"no initializer to remove");
2897 InitStorage.setPointerAndInt(getBitWidth(), ISK_NoInit);
2903 return InitStorage.getInt() == ISK_CapturedVLAType;
2909 InitStorage.getPointer())
2949 :
ValueDecl(EnumConstant, DC, L, Id, T), Init((
Stmt*)E), Val(V) {}
2983 unsigned ChainingSize;
2989 void anchor()
override;
3003 return llvm::makeArrayRef(Chaining, ChainingSize);
3011 assert(chain().size() >= 2);
3012 return cast<FieldDecl>(chain().back());
3016 assert(chain().size() >= 2);
3017 return dyn_cast<
VarDecl>(chain().front());
3036 mutable const Type *TypeForDecl =
nullptr;
3041 void anchor()
override;
3046 :
NamedDecl(DK, DC, L, Id), LocStart(StartL) {}
3072 struct alignas(8) ModedTInfo {
3079 mutable llvm::PointerIntPair<
3080 llvm::PointerUnion<TypeSourceInfo *, ModedTInfo *>, 2>
3083 void anchor()
override;
3090 MaybeModedTInfo(TInfo, 0) {}
3095 return getNextRedeclaration();
3110 using redeclarable_base::redecls_begin;
3111 using redeclarable_base::redecls_end;
3112 using redeclarable_base::redecls;
3113 using redeclarable_base::getPreviousDecl;
3114 using redeclarable_base::getMostRecentDecl;
3115 using redeclarable_base::isFirstDecl;
3118 return MaybeModedTInfo.getPointer().is<ModedTInfo *>();
3122 return isModed() ? MaybeModedTInfo.getPointer().get<ModedTInfo *>()->first
3127 return isModed() ? MaybeModedTInfo.getPointer().get<ModedTInfo *>()->second
3128 : MaybeModedTInfo.getPointer()
3134 MaybeModedTInfo.setPointer(newType);
3139 ModedTInfo({unmodedTSI, modedTy}));
3151 TagDecl *getAnonDeclWithTypedefName(
bool AnyRedecl =
false)
const;
3156 if (MaybeModedTInfo.getInt())
3157 return MaybeModedTInfo.getInt() & 0x2;
3158 return isTransparentTagSlow();
3164 return K >= firstTypedefName && K <= lastTypedefName;
3168 bool isTransparentTagSlow()
const;
3200 Template(
nullptr) {}
3243 llvm::PointerUnion<TypedefNameDecl *, ExtInfo *> TypedefNameDeclOrQualifier;
3245 bool hasExtInfo()
const {
return TypedefNameDeclOrQualifier.is<
ExtInfo *>(); }
3246 ExtInfo *getExtInfo() {
return TypedefNameDeclOrQualifier.get<
ExtInfo *>(); }
3247 const ExtInfo *getExtInfo()
const {
3248 return TypedefNameDeclOrQualifier.get<
ExtInfo *>();
3259 return getNextRedeclaration();
3273 void completeDefinition();
3293 using redeclarable_base::redecls_begin;
3294 using redeclarable_base::redecls_end;
3295 using redeclarable_base::redecls;
3296 using redeclarable_base::getPreviousDecl;
3297 using redeclarable_base::getMostRecentDecl;
3298 using redeclarable_base::isFirstDecl;
3320 return isCompleteDefinition();
3355 TagDeclBits.IsEmbeddedInDeclarator = isInDeclarator;
3382 void startDefinition();
3426 return (getDeclName() || getTypedefNameForAnonDecl());
3430 return hasExtInfo() ? nullptr
3439 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
3447 return hasExtInfo() ? getExtInfo()->QualifierLoc
3454 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
3458 assert(i < getNumTemplateParameterLists());
3459 return getExtInfo()->TemplParamLists[i];
3462 void setTemplateParameterListsInfo(
ASTContext &Context,
3499 llvm::PointerUnion<const Type *, TypeSourceInfo *> IntegerType;
3510 MemberSpecializationInfo *SpecializationInfo =
nullptr;
3519 bool Scoped,
bool ScopedUsingClassTag,
bool Fixed);
3521 void anchor()
override;
3528 void setNumPositiveBits(
unsigned Num) {
3530 assert(
EnumDeclBits.NumPositiveBits == Num &&
"can't store this bitcount");
3535 void setNumNegativeBits(
unsigned Num) {
EnumDeclBits.NumNegativeBits = Num; }
3539 void setScoped(
bool Scoped =
true) {
EnumDeclBits.IsScoped = Scoped; }
3545 void setScopedUsingClassTag(
bool ScopedUCT =
true) {
3551 void setFixed(
bool Fixed =
true) {
EnumDeclBits.IsFixed = Fixed; }
3554 bool hasODRHash()
const {
return EnumDeclBits.HasODRHash; }
3555 void setHasODRHash(
bool Hash =
true) {
EnumDeclBits.HasODRHash = Hash; }
3568 return cast_or_null<EnumDecl>(
3589 bool IsScoped,
bool IsScopedUsingClassTag,
3598 void completeDefinition(
QualType NewType,
3600 unsigned NumPositiveBits,
3601 unsigned NumNegativeBits);
3606 llvm::iterator_range<specific_decl_iterator<EnumConstantDecl>>;
3638 if (
const Type *T = IntegerType.dyn_cast<
const Type*>())
3640 return IntegerType.get<
TypeSourceInfo*>()->getType().getUnqualifiedType();
3657 SourceRange getIntegerTypeRange()
const LLVM_READONLY;
3686 unsigned getODRHash();
3692 return isCompleteDefinition() || IntegerType;
3697 bool isClosed()
const;
3701 bool isClosedFlag()
const;
3705 bool isClosedNonFlag()
const;
3709 EnumDecl *getTemplateInstantiationPattern()
const;
3714 EnumDecl *getInstantiatedFromMemberEnum()
const;
3730 return SpecializationInfo;
3773 APK_CanNeverPassInRegs
3788 return cast_or_null<RecordDecl>(
3872 return RecordDeclBits.HasNonTrivialToPrimitiveDefaultInitializeCUnion;
3899 return getArgPassingRestrictions() == APK_CanPassInRegs;
3931 bool isInjectedClassName()
const;
3935 bool isLambda()
const;
3939 bool isCapturedRecord()
const;
3943 void setCapturedRecord();
3961 using field_range = llvm::iterator_range<specific_decl_iterator<FieldDecl>>;
3972 return field_begin() == field_end();
3976 virtual void completeDefinition();
3980 return K >= firstRecord && K <= lastRecord;
3991 bool mayInsertExtraPadding(
bool EmitRemark =
false)
const;
3995 const FieldDecl *findFirstNamedDataMember()
const;
3999 void LoadFieldsFromExternalStorage()
const;
4008 :
Decl(FileScopeAsm, DC, StartL), AsmString(asmstring), RParenLoc(EndL) {}
4010 virtual void anchor();
4050 llvm::PointerIntPair<VarDecl*, 2> VariableAndFlags;
4059 : VariableAndFlags(variable,
4060 (byRef ? flag_isByRef : 0) | (nested ? flag_isNested : 0)),
4068 bool isByRef()
const {
return VariableAndFlags.getInt() & flag_isByRef; }
4071 return getVariable()->isEscapingByref();
4075 return getVariable()->isNonEscapingByref();
4080 bool isNested()
const {
return VariableAndFlags.getInt() & flag_isNested; }
4092 unsigned NumParams = 0;
4094 Stmt *Body =
nullptr;
4097 const Capture *Captures =
nullptr;
4098 unsigned NumCaptures = 0;
4100 unsigned ManglingNumber = 0;
4101 Decl *ManglingContextDecl =
nullptr;
4124 return {ParamInfo, getNumParams()};
4127 return {ParamInfo, getNumParams()};
4144 assert(i < getNumParams() &&
"Illegal param #");
4145 return ParamInfo[i];
4148 assert(i < getNumParams() &&
"Illegal param #");
4149 return ParamInfo[i];
4198 bool capturesVariable(
const VarDecl *var)
const;
4201 bool CapturesCXXThis);
4208 ManglingNumber = Number;
4209 ManglingContextDecl = Ctx;
4240 unsigned ContextParam;
4243 llvm::PointerIntPair<Stmt *, 1, bool> BodyAndNothrow;
4248 return getTrailingObjects<ImplicitParamDecl *>();
4252 return getTrailingObjects<ImplicitParamDecl *>();
4261 unsigned NumParams);
4263 unsigned NumParams);
4266 void setBody(
Stmt *B);
4268 bool isNothrow()
const;
4269 void setNothrow(
bool Nothrow =
true);
4274 assert(i < NumParams);
4275 return getParams()[i];
4278 assert(i < NumParams);
4284 return {getParams(), getNumParams()};
4287 return {getParams(), getNumParams()};
4292 assert(ContextParam < NumParams);
4293 return getParam(ContextParam);
4296 assert(i < NumParams);
4344 llvm::PointerIntPair<Module *, 1, bool> ImportedAndComplete;
4372 unsigned NumLocations);
4397 virtual void anchor();
4446 virtual void anchor();
4472 template<
typename decl_type>
4476 assert(RedeclLink.isFirst() &&
4477 "setPreviousDecl on a decl already in a redeclaration chain");
4483 First = PrevDecl->getFirstDecl();
4484 assert(
First->RedeclLink.isFirst() &&
"Expected first");
4485 decl_type *MostRecent =
First->getNextRedeclaration();
4486 RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4491 MostRecent->getIdentifierNamespace() &
4495 First =
static_cast<decl_type*
>(
this);
4499 First->RedeclLink.setLatest(static_cast<decl_type*>(
this));
4501 assert(!isa<NamedDecl>(static_cast<decl_type*>(
this)) ||
4502 cast<NamedDecl>(static_cast<decl_type*>(
this))->isLinkageValid());
4525 #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
void setImplicit(bool I=true)
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)
no exception specification
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)
void setCompleteDefinition(bool V=true)
True if this decl has its body fully specified.
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...
void setMayHaveOutOfDateDef(bool V=true)
Indicates whether it is possible for declarations of this kind to have an out-of-date definition...
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
const Expr * getTrailingRequiresClause() const
InClassInitStyle getInClassInitStyle() const
Get the kind of (C++11) default member initializer that this field has.
virtual Stmt * getBody() const
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
VarDecl * getVarDecl() const
Module * getOwningModuleForLinkage(bool IgnoreLinkage=false) const
Get the module that owns this declaration for linkage purposes.
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.
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)
True if this tag declaration is "embedded" (i.e., defined or declared for the very first time) in the...
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
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
EnumDecl * getPreviousDecl()
SourceLocation getBeginLoc() const LLVM_READONLY
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
Whether this function has a written prototype.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
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.
SourceLocation getEndLoc() const LLVM_READONLY
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()
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, ConstexprSpecKind ConstexprKind=CSK_unspecified, Expr *TrailingRequiresClause=nullptr)
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
void setBeingDefined(bool V=true)
True if this decl is currently being defined.
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. ...
bool isParameterPack() const
Whether this declaration is a parameter pack.
static DeclContext * castToDeclContext(const ExportDecl *D)
BlockDeclBitfields BlockDeclBits
static const NamedDecl * getDefinition(const Decl *D)
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
Get the identifier that names this declaration, if there is one.
Types, declared with 'struct foo', typedefs, etc.
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)
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.
ConstexprSpecKind getConstexprKind() const
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.
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
bool usesFPIntrin() const
Indicates the function uses Floating Point constrained intrinsics.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
LazyDeclStmtPtr Body
The body of the function.
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)
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
FieldDecl * getAnonField() const
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 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.
void getAssociatedConstraints(SmallVectorImpl< const Expr *> &AC) const
Get the associated-constraints of this function declaration.
void setARCPseudoStrong(bool PS)
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 ...
void setUsesFPIntrin(bool Val)
TypedefNameDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this typedef-name.
unsigned getNumParams() const
bool hasNonTrivialToPrimitiveCopyCUnion() 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.
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...
Wrapper for source info for functions.
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)
State that falling off this function implicitly returns null/zero.
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.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
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)
virtual Decl * getMostRecentDeclImpl()
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
ArrayRef< DeclAccessPair > getUnqualifiedLookups() const
Get the unqualified lookup results that should be used in this defaulted function definition...
void setInitExpr(Expr *E)
void setStmt(LabelStmt *T)
void setLocStart(SourceLocation L)
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Decl & operator=(const Decl &)=delete
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()
bool isConstexprSpecified() const
void setHasInheritedPrototype(bool P=true)
State that this function inherited its prototype from a previous declaration.
Defines the clang::Visibility enumeration and various utility functions.
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
bool isEscapingByref() const
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.
QualType getDeclaredReturnType() const
Get the declared return type, which may differ from the actual return type if the return type is dedu...
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 }.
Represents a prototype with parameter type info, e.g.
static bool classof(const Decl *D)
bool isFileVarDecl() const
Returns true for file scoped variable declaration.
static bool classofKind(Kind K)
void setImplicitlyInline(bool I=true)
Flag that this function is implicitly inline.
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.
void setStorageClass(StorageClass SClass)
Sets the storage class as written in the source.
bool canAvoidCopyToHeap() const
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)
DefaultedFunctionInfo * DefaultedInfo
Information about a future defaulted function definition.
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.
Represents 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 ...
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 StorageClass getStorageClass(const Decl *D)
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration...
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
const T * castAs() const
Member-template castAs<specific type>.
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
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.
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
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
bool isFileContext() const
TemplateParameterList * getTemplateParameterList(unsigned index) const
DeclContext * getDeclContext()
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.
ExceptionSpecificationType getExceptionSpecType() const
Gets the ExceptionSpecificationType as declared.
static bool classof(const Decl *D)
void setCompleteDefinitionRequired(bool V=true)
True if this complete decl is required to be complete for some existing use.
EnumDecl * getDefinition() const
EnumDecl * getMostRecentDecl()
void setLateTemplateParsed(bool ILT=true)
State that this templated function will be late parsed.
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
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
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)
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)
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)
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
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)
FunctionDeclBitfields FunctionDeclBits
void setDoesNotEscape(bool B=true)
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
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
virtual bool hasBody() const
Returns true if this Decl represents a declaration for a body of code, such as a function or method d...
param_iterator param_begin()
void setIsVariadic(bool value)
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
bool hasInheritedPrototype() const
Whether this function inherited its prototype from a previous declaration.
virtual void printName(raw_ostream &os) const
void setTypeForDecl(const Type *TD)
static bool classof(const Decl *D)
Expr * getTrailingRequiresClause()
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
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)
void setIsConversionFromLambda(bool val=true)
static bool classof(const Decl *D)
static ExternCContextDecl * castFromDeclContext(const DeclContext *DC)
const VarDecl * getActingDefinition() const
ArrayRef< NamedDecl * >::const_iterator chain_iterator
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
bool mayHaveOutOfDateDef() const
Indicates whether it is possible for declarations of this kind to have an out-of-date definition...
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)
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)
True if this tag is free standing, e.g. "struct foo;".
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
static Error setTypedefNameForAnonDecl(TagDecl *From, TagDecl *To, ASTImporter &Importer)
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.
bool hasCachedLinkage() const
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)
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.
SourceLocation getEllipsisLoc() const
Returns the location of the ellipsis of a variadic function.
bool hasNonTrivialToPrimitiveDestructCUnion() const
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted per C++0x.
DeclarationNameInfo getNameInfo() const
virtual Decl * getNextRedeclarationImpl()
Returns the next redeclaration or itself if this is the only decl.
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)
State that this function is explicitly defaulted per C++0x.
void setHasInheritedDefaultArg(bool I=true)
bool hasFlexibleArrayMember() const
bool isTrivialForCall() const
virtual bool isOutOfLine() const
Determine whether this declaration is declared out of line (outside its semantic context).
static bool classofKind(Kind K)
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
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)
State that this function is marked as virtual explicitly.
void setHasWrittenPrototype(bool P=true)
State that this function has a written prototype.
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)
ConstexprSpecKind
Define the kind of constexpr specifier.
bool isValid() const
Return true if this is a valid SourceLocation object.
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
bool HasConstantDestruction
Whether this variable is known to have constant destruction.
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.
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
bool isEmbeddedInDeclarator() const
True if this tag declaration is "embedded" (i.e., defined or declared for the very first time) in the...
unsigned getNumTemplateParameterLists() const
IdentifierNamespace
IdentifierNamespace - The different namespaces in which declarations may appear.
TLSKind
Kinds of thread-local storage.
void setWillHaveBody(bool V=true)
The name of a declaration.
void setInstantiationIsPending(bool IC)
State that the instantiation of this function is pending.
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.
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
EnumDeclBitfields EnumDeclBits
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 setCapturesCXXThis(bool B=true)
Assembly: we accept this only so that we can preprocess it.
void setImplicitlyInline()
Do an LV computation for, ultimately, a type.
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...
void setUnparsedDefaultArg()
Specify that this parameter has an unparsed default argument.
NonParmVarDeclBitfields NonParmVarDeclBits
void setConstexprKind(ConstexprSpecKind CSK)
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 VarDecl * getInitializingDeclaration() 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 setHasNonTrivialToPrimitiveDestructCUnion(bool V)
void setCXXForRangeDecl(bool FRD)
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
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]...
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.
void setAsmString(StringLiteral *Asm)
void setRParenLoc(SourceLocation L)
A template argument list.
void setRBraceLoc(SourceLocation L)
const VarDecl * getDefinition(ASTContext &C) const
NestedNameSpecifierLoc QualifierLoc
static constexpr unsigned getMaxFunctionScopeDepth()
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.
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 TranslationUnitDecl * Create(ASTContext &C)
static bool classofKind(Kind K)
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
RecordDeclBitfields RecordDeclBits
Provides information a specialization of a member of a class template, which may be a member function...
void setCanAvoidCopyToHeap(bool B=true)
VarDecl * getDefinition()
void setHasNonTrivialToPrimitiveCopyCUnion(bool V)
virtual Decl * getPreviousDeclImpl()
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain...
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)
SourceLocation getEllipsisLoc() const
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)
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()
void setHasLoadedFieldsFromExternalStorage(bool val) const
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.
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.
void setHasNonTrivialToPrimitiveDefaultInitializeCUnion(bool V)
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.
bool isNonEscapingByref() const
Automatic storage duration (most local variables).
bool isInline() const
Whether this variable is (C++1z) inline.
LazyOffsetPtr< Stmt, uint64_t, &ExternalASTSource::GetExternalDeclStmt > LazyDeclStmtPtr
A lazy pointer to a statement.
Stashed information about a defaulted function definition whose body has not yet been lazily generate...
ImplicitParamKind getParameterKind() const
Returns the implicit parameter kind.
bool hasDefiningAttr() const
Return true if this declaration has an attribute which acts as definition of the entity, such as 'alias' or 'ifunc'.
Represents a #pragma detect_mismatch line.
void setBlockMissingReturnType(bool val=true)
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
True if this tag is free standing, e.g. "struct foo;".
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.
bool isDeletedAsWritten() const
SourceLocation getLocation() const
const StringLiteral * getAsmString() const
bool isExternallyVisible() const
bool isBeingDefined() const
Return true if this decl is currently being defined.
SourceLocation getRBraceLoc() const
TagDeclBitfields TagDeclBits
decl_iterator decls_end() const
param_const_iterator param_begin() const
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.