13 #ifndef LLVM_CLANG_AST_DECL_H 14 #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();
639 void anchor()
override;
644 :
NamedDecl(DK, DC, L, N), DeclType(T) {}
668 unsigned NumTemplParamLists = 0;
682 void setTemplateParameterListsInfo(
ASTContext &Context,
695 llvm::PointerUnion<TypeSourceInfo *, ExtInfo *> DeclInfo;
701 bool hasExtInfo()
const {
return DeclInfo.is<ExtInfo*>(); }
702 ExtInfo *getExtInfo() {
return DeclInfo.get<ExtInfo*>(); }
703 const ExtInfo *getExtInfo()
const {
return DeclInfo.get<ExtInfo*>(); }
709 :
ValueDecl(DK, DC, L, N, T), DeclInfo(TInfo), InnerLocStart(StartL) {}
717 ? getExtInfo()->TInfo
723 getExtInfo()->TInfo = TI;
739 return getOuterLocStart();
745 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
753 return hasExtInfo() ? getExtInfo()->QualifierLoc
760 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
764 assert(index < getNumTemplateParameterLists());
765 return getExtInfo()->TemplParamLists[index];
768 void setTemplateParameterListsInfo(
ASTContext &Context,
776 return K >= firstDeclarator && K <= lastDeclarator;
841 static const char *getStorageClassSpecifierString(
StorageClass SC);
851 using InitType = llvm::PointerUnion<Stmt *, EvaluatedStmt *>;
862 class VarDeclBitfields {
867 unsigned TSCSpec : 2;
868 unsigned InitStyle : 2;
872 unsigned ARCPseudoStrong : 1;
874 enum { NumVarDeclBits = 8 };
877 enum { NumParameterIndexBits = 8 };
890 unsigned : NumVarDeclBits;
894 unsigned HasInheritedDefaultArg : 1;
903 unsigned IsKNRPromoted : 1;
906 unsigned IsObjCMethodParam : 1;
912 unsigned ScopeDepthOrObjCQuals : 7;
916 unsigned ParameterIndex : NumParameterIndexBits;
924 unsigned : NumVarDeclBits;
929 unsigned IsThisDeclarationADemotedDefinition : 1;
933 unsigned ExceptionVar : 1;
938 unsigned NRVOVariable : 1;
942 unsigned CXXForRangeDecl : 1;
945 unsigned ObjCForDecl : 1;
948 unsigned IsInline : 1;
951 unsigned IsInlineSpecified : 1;
954 unsigned IsConstexpr : 1;
958 unsigned IsInitCapture : 1;
963 unsigned PreviousDeclInSameBlockScope : 1;
967 unsigned ImplicitParamKind : 3;
969 unsigned EscapingByref : 1;
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");
1063 && !isFileVarDecl();
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 mightBeUsableInConstantExpressions(
ASTContext &
C)
const;
1238 bool isUsableInConstantExpressions(
ASTContext &C)
const;
1246 APValue *evaluateValue()
const;
1252 APValue *getEvaluatedValue()
const;
1256 bool isInitKnownICE()
const;
1263 bool isInitICE()
const;
1267 bool checkInitIsICE()
const;
1270 VarDeclBits.InitStyle =
Style;
1289 return getInitStyle() != CInit;
1294 return isa<ParmVarDecl>(
this) ?
false :
1295 NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
1304 assert(isThisDeclarationADefinition() &&
"Not a definition!");
1305 assert(!isa<ParmVarDecl>(
this) &&
"Cannot demote ParmVarDecls!");
1306 NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
1312 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.ExceptionVar;
1315 assert(!isa<ParmVarDecl>(
this));
1316 NonParmVarDeclBits.ExceptionVar = EV;
1330 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.NRVOVariable;
1333 assert(!isa<ParmVarDecl>(
this));
1334 NonParmVarDeclBits.NRVOVariable = NRVO;
1340 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.CXXForRangeDecl;
1343 assert(!isa<ParmVarDecl>(
this));
1344 NonParmVarDeclBits.CXXForRangeDecl = FRD;
1350 return NonParmVarDeclBits.ObjCForDecl;
1354 NonParmVarDeclBits.ObjCForDecl = FRD;
1369 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsInline;
1372 return isa<ParmVarDecl>(
this) ?
false 1373 : NonParmVarDeclBits.IsInlineSpecified;
1376 assert(!isa<ParmVarDecl>(
this));
1377 NonParmVarDeclBits.IsInline =
true;
1378 NonParmVarDeclBits.IsInlineSpecified =
true;
1381 assert(!isa<ParmVarDecl>(
this));
1382 NonParmVarDeclBits.IsInline =
true;
1387 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsConstexpr;
1390 assert(!isa<ParmVarDecl>(
this));
1391 NonParmVarDeclBits.IsConstexpr = IC;
1396 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsInitCapture;
1399 assert(!isa<ParmVarDecl>(
this));
1400 NonParmVarDeclBits.IsInitCapture = IC;
1405 bool isParameterPack()
const;
1410 return isa<ParmVarDecl>(
this)
1412 : NonParmVarDeclBits.PreviousDeclInSameBlockScope;
1415 assert(!isa<ParmVarDecl>(
this));
1416 NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
1422 bool isEscapingByref()
const;
1426 bool isNonEscapingByref()
const;
1429 NonParmVarDeclBits.EscapingByref =
true;
1434 VarDecl *getTemplateInstantiationPattern()
const;
1439 VarDecl *getInstantiatedFromStaticDataMember()
const;
1450 getTemplateSpecializationKindForInstantiation()
const;
1469 void setInstantiationOfStaticDataMember(
VarDecl *VD,
1490 bool isKnownToBeDefined()
const;
1501 void anchor()
override;
1539 :
VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
1541 NonParmVarDeclBits.ImplicitParamKind = ParamKind;
1549 NonParmVarDeclBits.ImplicitParamKind = ParamKind;
1566 enum { MaxFunctionScopeDepth = 255 };
1567 enum { MaxFunctionScopeIndex = 255 };
1573 :
VarDecl(DK, C, DC, StartLoc, IdLoc, Id, T, TInfo, S) {
1574 assert(ParmVarDeclBits.HasInheritedDefaultArg ==
false);
1575 assert(ParmVarDeclBits.DefaultArgKind == DAK_None);
1576 assert(ParmVarDeclBits.IsKNRPromoted ==
false);
1577 assert(ParmVarDeclBits.IsObjCMethodParam ==
false);
1578 setDefaultArg(DefArg);
1593 ParmVarDeclBits.IsObjCMethodParam =
true;
1594 setParameterIndex(parameterIndex);
1598 assert(!ParmVarDeclBits.IsObjCMethodParam);
1600 ParmVarDeclBits.ScopeDepthOrObjCQuals = scopeDepth;
1601 assert(ParmVarDeclBits.ScopeDepthOrObjCQuals == scopeDepth
1604 setParameterIndex(parameterIndex);
1608 return ParmVarDeclBits.IsObjCMethodParam;
1612 if (ParmVarDeclBits.IsObjCMethodParam)
return 0;
1613 return ParmVarDeclBits.ScopeDepthOrObjCQuals;
1618 return getParameterIndex();
1622 if (!ParmVarDeclBits.IsObjCMethodParam)
return OBJC_TQ_None;
1626 assert(ParmVarDeclBits.IsObjCMethodParam);
1627 ParmVarDeclBits.ScopeDepthOrObjCQuals = QTVal;
1639 return ParmVarDeclBits.IsKNRPromoted;
1642 ParmVarDeclBits.IsKNRPromoted = promoted;
1645 Expr *getDefaultArg();
1647 return const_cast<ParmVarDecl *
>(
this)->getDefaultArg();
1650 void setDefaultArg(
Expr *defarg);
1655 void setUninstantiatedDefaultArg(
Expr *arg);
1656 Expr *getUninstantiatedDefaultArg();
1658 return const_cast<ParmVarDecl *
>(
this)->getUninstantiatedDefaultArg();
1663 bool hasDefaultArg()
const;
1675 return ParmVarDeclBits.DefaultArgKind == DAK_Unparsed;
1679 return ParmVarDeclBits.DefaultArgKind == DAK_Uninstantiated;
1687 ParmVarDeclBits.DefaultArgKind = DAK_Unparsed;
1691 return ParmVarDeclBits.HasInheritedDefaultArg;
1695 ParmVarDeclBits.HasInheritedDefaultArg = I;
1711 enum { ParameterIndexSentinel = (1 << NumParameterIndexBits) - 1 };
1713 void setParameterIndex(
unsigned parameterIndex) {
1714 if (parameterIndex >= ParameterIndexSentinel) {
1715 setParameterIndexLarge(parameterIndex);
1719 ParmVarDeclBits.ParameterIndex = parameterIndex;
1720 assert(ParmVarDeclBits.ParameterIndex == parameterIndex &&
"truncation!");
1722 unsigned getParameterIndex()
const {
1723 unsigned d = ParmVarDeclBits.ParameterIndex;
1724 return d == ParameterIndexSentinel ? getParameterIndexLarge() :
d;
1727 void setParameterIndexLarge(
unsigned parameterIndex);
1728 unsigned getParameterIndexLarge()
const;
1769 TK_DependentFunctionTemplateSpecialization
1807 TemplateOrSpecialization;
1834 void setFunctionTemplateSpecialization(
ASTContext &
C,
1835 FunctionTemplateDecl *Template,
1852 bool isDeletedBit()
const {
return FunctionDeclBits.IsDeleted; }
1855 bool hasODRHash()
const {
return FunctionDeclBits.HasODRHash; }
1858 void setHasODRHash(
bool B =
true) { FunctionDeclBits.HasODRHash = B; }
1869 return getNextRedeclaration();
1873 return getPreviousDecl();
1877 return getMostRecentDecl();
1887 using redeclarable_base::redecls_begin;
1888 using redeclarable_base::redecls_end;
1889 using redeclarable_base::redecls;
1890 using redeclarable_base::getPreviousDecl;
1891 using redeclarable_base::getMostRecentDecl;
1892 using redeclarable_base::isFirstDecl;
1898 bool hasWrittenPrototype =
true,
1902 isInlineSpecified, hasWrittenPrototype,
1910 bool isInlineSpecified,
bool hasWrittenPrototype,
1919 void getNameForDiagnostic(raw_ostream &OS,
const PrintingPolicy &Policy,
1920 bool Qualified)
const override;
1949 return hasBody(Definition);
1954 bool hasTrivialBody()
const;
1965 return isDefined(Definition);
1971 if (isDefined(Definition))
1989 return getBody(Definition);
1998 return isDeletedAsWritten() || isDefaulted() || Body || hasSkippedBody() ||
1999 isLateTemplateParsed() || willHaveBody() || hasDefiningAttr();
2004 return Body || isLateTemplateParsed();
2007 void setBody(
Stmt *B);
2011 bool isVariadic()
const;
2015 return FunctionDeclBits.IsVirtualAsWritten;
2023 bool isPure()
const {
return FunctionDeclBits.IsPure; }
2024 void setPure(
bool P =
true);
2028 return FunctionDeclBits.IsLateTemplateParsed;
2033 FunctionDeclBits.IsLateTemplateParsed = ILT;
2040 bool isTrivial()
const {
return FunctionDeclBits.IsTrivial; }
2054 return FunctionDeclBits.IsExplicitlyDefaulted;
2060 FunctionDeclBits.IsExplicitlyDefaulted = ED;
2067 return FunctionDeclBits.HasImplicitReturnZero;
2074 FunctionDeclBits.HasImplicitReturnZero = IRZ;
2082 return hasWrittenPrototype() || hasInheritedPrototype();
2087 return FunctionDeclBits.HasWrittenPrototype;
2092 FunctionDeclBits.HasWrittenPrototype =
P;
2098 return FunctionDeclBits.HasInheritedPrototype;
2104 FunctionDeclBits.HasInheritedPrototype =
P;
2112 FunctionDeclBits.ConstexprKind = CSK;
2131 return FunctionDeclBits.InstantiationIsPending;
2137 FunctionDeclBits.InstantiationIsPending = IC;
2168 return FunctionDeclBits.IsDeleted && !isDefaulted();
2175 bool isMain()
const;
2179 bool isMSVCRTEntryPoint()
const;
2194 bool isReservedGlobalPlacementOperator()
const;
2214 bool isReplaceableGlobalAllocationFunction(
bool *IsAligned =
nullptr)
const;
2217 bool isDestroyingOperatorDelete()
const;
2228 bool isInExternCContext()
const;
2232 bool isInExternCXXContext()
const;
2235 bool isGlobal()
const;
2239 bool isNoReturn()
const;
2244 FunctionDeclBits.HasSkippedBody = Skipped;
2270 bool isCPUDispatchMultiVersion()
const;
2273 bool isCPUSpecificMultiVersion()
const;
2277 bool isTargetMultiVersion()
const;
2286 unsigned getBuiltinID(
bool ConsiderWrapperFunctions =
false)
const;
2290 return {ParamInfo, getNumParams()};
2293 return {ParamInfo, getNumParams()};
2310 unsigned getNumParams()
const;
2313 assert(i < getNumParams() &&
"Illegal param #");
2314 return ParamInfo[
i];
2317 assert(i < getNumParams() &&
"Illegal param #");
2318 return ParamInfo[
i];
2321 setParams(getASTContext(), NewParamInfo);
2327 unsigned getMinRequiredArguments()
const;
2341 auto *TSI = getTypeSourceInfo();
2348 auto *TSI = getTypeSourceInfo();
2367 return static_cast<StorageClass>(FunctionDeclBits.SClass);
2372 FunctionDeclBits.SClass = SClass;
2381 FunctionDeclBits.IsInlineSpecified = I;
2382 FunctionDeclBits.IsInline = I;
2391 bool isInlined()
const {
return FunctionDeclBits.IsInline; }
2393 bool isInlineDefinitionExternallyVisible()
const;
2395 bool isMSExternInline()
const;
2397 bool doesDeclarationForceExternallyVisibleDefinition()
const;
2404 return getOverloadedOperator() !=
OO_None;
2432 FunctionDecl *getInstantiatedFromMemberFunction()
const;
2440 MemberSpecializationInfo *getMemberSpecializationInfo()
const;
2446 setInstantiationOfMemberFunction(getASTContext(), FD, TSK);
2461 FunctionTemplateDecl *getDescribedFunctionTemplate()
const;
2463 void setDescribedFunctionTemplate(FunctionTemplateDecl *Template);
2468 return getPrimaryTemplate() !=
nullptr;
2474 FunctionTemplateSpecializationInfo *getTemplateSpecializationInfo()
const;
2479 bool isImplicitlyInstantiable()
const;
2495 FunctionTemplateDecl *getPrimaryTemplate()
const;
2512 getTemplateSpecializationArgsAsWritten()
const;
2539 setFunctionTemplateSpecialization(getASTContext(), Template, TemplateArgs,
2540 InsertPos, TSK, TemplateArgsAsWritten,
2541 PointOfInstantiation);
2546 void setDependentTemplateSpecialization(
ASTContext &Context,
2551 getDependentSpecializationInfo()
const;
2560 getTemplateSpecializationKindForInstantiation()
const;
2577 bool isOutOfLine()
const override;
2583 unsigned getMemoryFunctionKind()
const;
2587 unsigned getODRHash();
2591 unsigned getODRHash()
const;
2596 return K >= firstFunction && K <= lastFunction;
2608 unsigned BitField : 1;
2609 unsigned Mutable : 1;
2610 mutable unsigned CachedFieldIndex : 30;
2616 enum InitStorageKind {
2632 ISK_CapturedVLAType,
2637 struct InitAndBitWidth {
2651 llvm::PointerIntPair<void *, 2, InitStorageKind> InitStorage;
2659 BitField(
false), Mutable(Mutable), CachedFieldIndex(0),
2660 InitStorage(nullptr, (InitStorageKind) InitStyle) {
2679 unsigned getFieldIndex()
const;
2694 bool isAnonymousStructOrUnion()
const;
2699 void *Ptr = InitStorage.getPointer();
2700 if (getInClassInitStyle())
2701 return static_cast<InitAndBitWidth*
>(Ptr)->BitWidth;
2702 return static_cast<Expr*
>(Ptr);
2705 unsigned getBitWidthValue(
const ASTContext &Ctx)
const;
2710 assert(!hasCapturedVLAType() && !BitField &&
2711 "bit width or captured type already set");
2712 assert(Width &&
"no bit width specified");
2713 InitStorage.setPointer(
2714 InitStorage.getInt()
2715 ?
new (getASTContext())
2716 InitAndBitWidth{getInClassInitializer(), Width}
2717 :
static_cast<void*
>(Width));
2724 assert(isBitField() &&
"no bitfield width to remove");
2725 InitStorage.setPointer(getInClassInitializer());
2732 bool isZeroLengthBitField(
const ASTContext &Ctx)
const;
2737 bool isZeroSize(
const ASTContext &Ctx)
const;
2741 InitStorageKind storageKind = InitStorage.getInt();
2742 return (storageKind == ISK_CapturedVLAType
2755 if (!hasInClassInitializer())
2757 void *Ptr = InitStorage.getPointer();
2759 return static_cast<InitAndBitWidth*
>(Ptr)->Init;
2760 return static_cast<Expr*
>(Ptr);
2765 assert(hasInClassInitializer() && !getInClassInitializer());
2767 static_cast<InitAndBitWidth*
>(InitStorage.getPointer())->Init = Init;
2769 InitStorage.setPointer(Init);
2774 assert(hasInClassInitializer() &&
"no initializer to remove");
2775 InitStorage.setPointerAndInt(getBitWidth(), ISK_NoInit);
2781 return InitStorage.getInt() == ISK_CapturedVLAType;
2787 InitStorage.getPointer())
2797 return cast<RecordDecl>(getDeclContext());
2801 return cast<RecordDecl>(getDeclContext());
2826 const llvm::APSInt &
V)
2827 :
ValueDecl(EnumConstant, DC, L, Id, T), Init((
Stmt*)E), Val(V) {}
2835 const llvm::APSInt &
V);
2861 unsigned ChainingSize;
2867 void anchor()
override;
2881 return llvm::makeArrayRef(Chaining, ChainingSize);
2889 assert(chain().size() >= 2);
2890 return cast<FieldDecl>(chain().back());
2894 assert(chain().size() >= 2);
2895 return dyn_cast<
VarDecl>(chain().front());
2914 mutable const Type *TypeForDecl =
nullptr;
2919 void anchor()
override;
2924 :
NamedDecl(DK, DC, L, Id), LocStart(StartL) {}
2950 struct alignas(8) ModedTInfo {
2957 mutable llvm::PointerIntPair<
2958 llvm::PointerUnion<TypeSourceInfo *, ModedTInfo *>, 2>
2961 void anchor()
override;
2968 MaybeModedTInfo(TInfo, 0) {}
2973 return getNextRedeclaration();
2977 return getPreviousDecl();
2981 return getMostRecentDecl();
2988 using redeclarable_base::redecls_begin;
2989 using redeclarable_base::redecls_end;
2990 using redeclarable_base::redecls;
2991 using redeclarable_base::getPreviousDecl;
2992 using redeclarable_base::getMostRecentDecl;
2993 using redeclarable_base::isFirstDecl;
2996 return MaybeModedTInfo.getPointer().is<ModedTInfo *>();
3000 return isModed() ? MaybeModedTInfo.getPointer().get<ModedTInfo *>()->first
3005 return isModed() ? MaybeModedTInfo.getPointer().get<ModedTInfo *>()->second
3006 : MaybeModedTInfo.getPointer()
3012 MaybeModedTInfo.setPointer(newType);
3016 MaybeModedTInfo.setPointer(
new (getASTContext(), 8)
3017 ModedTInfo({unmodedTSI, modedTy}));
3029 TagDecl *getAnonDeclWithTypedefName(
bool AnyRedecl =
false)
const;
3034 if (MaybeModedTInfo.getInt())
3035 return MaybeModedTInfo.getInt() & 0x2;
3036 return isTransparentTagSlow();
3042 return K >= firstTypedefName && K <= lastTypedefName;
3046 bool isTransparentTagSlow()
const;
3078 Template(
nullptr) {}
3121 llvm::PointerUnion<TypedefNameDecl *, ExtInfo *> TypedefNameDeclOrQualifier;
3123 bool hasExtInfo()
const {
return TypedefNameDeclOrQualifier.is<
ExtInfo *>(); }
3124 ExtInfo *getExtInfo() {
return TypedefNameDeclOrQualifier.get<
ExtInfo *>(); }
3125 const ExtInfo *getExtInfo()
const {
3126 return TypedefNameDeclOrQualifier.get<
ExtInfo *>();
3137 return getNextRedeclaration();
3141 return getPreviousDecl();
3145 return getMostRecentDecl();
3151 void completeDefinition();
3161 TagDeclBits.MayHaveOutOfDateDef =
V;
3171 using redeclarable_base::redecls_begin;
3172 using redeclarable_base::redecls_end;
3173 using redeclarable_base::redecls;
3174 using redeclarable_base::getPreviousDecl;
3175 using redeclarable_base::getMostRecentDecl;
3176 using redeclarable_base::isFirstDecl;
3198 return isCompleteDefinition();
3206 TagDeclBits.IsCompleteDefinition =
V;
3212 return TagDeclBits.IsCompleteDefinitionRequired;
3218 TagDeclBits.IsCompleteDefinitionRequired =
V;
3227 return TagDeclBits.IsEmbeddedInDeclarator;
3233 TagDeclBits.IsEmbeddedInDeclarator = isInDeclarator;
3241 TagDeclBits.IsFreeStanding = isFreeStanding;
3260 void startDefinition();
3277 return static_cast<TagKind>(TagDeclBits.TagDeclKind);
3304 return (getDeclName() || getTypedefNameForAnonDecl());
3308 return hasExtInfo() ? nullptr
3317 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
3325 return hasExtInfo() ? getExtInfo()->QualifierLoc
3332 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
3336 assert(i < getNumTemplateParameterLists());
3337 return getExtInfo()->TemplParamLists[
i];
3340 void setTemplateParameterListsInfo(
ASTContext &Context,
3377 llvm::PointerUnion<const Type *, TypeSourceInfo *> IntegerType;
3388 MemberSpecializationInfo *SpecializationInfo =
nullptr;
3397 bool Scoped,
bool ScopedUsingClassTag,
bool Fixed);
3399 void anchor()
override;
3406 void setNumPositiveBits(
unsigned Num) {
3407 EnumDeclBits.NumPositiveBits = Num;
3408 assert(EnumDeclBits.NumPositiveBits == Num &&
"can't store this bitcount");
3413 void setNumNegativeBits(
unsigned Num) { EnumDeclBits.NumNegativeBits = Num; }
3417 void setScoped(
bool Scoped =
true) { EnumDeclBits.IsScoped = Scoped; }
3423 void setScopedUsingClassTag(
bool ScopedUCT =
true) {
3424 EnumDeclBits.IsScopedUsingClassTag = ScopedUCT;
3429 void setFixed(
bool Fixed =
true) { EnumDeclBits.IsFixed = Fixed; }
3432 bool hasODRHash()
const {
return EnumDeclBits.HasODRHash; }
3433 void setHasODRHash(
bool Hash =
true) { EnumDeclBits.HasODRHash = Hash; }
3446 return cast_or_null<EnumDecl>(
3447 static_cast<TagDecl *
>(
this)->getPreviousDecl());
3450 return const_cast<EnumDecl*
>(
this)->getPreviousDecl();
3454 return cast<EnumDecl>(
static_cast<TagDecl *
>(
this)->getMostRecentDecl());
3457 return const_cast<EnumDecl*
>(
this)->getMostRecentDecl();
3467 bool IsScoped,
bool IsScopedUsingClassTag,
3476 void completeDefinition(
QualType NewType,
3478 unsigned NumPositiveBits,
3479 unsigned NumNegativeBits);
3484 llvm::iterator_range<specific_decl_iterator<EnumConstantDecl>>;
3516 if (
const Type *T = IntegerType.dyn_cast<
const Type*>())
3535 SourceRange getIntegerTypeRange()
const LLVM_READONLY;
3553 bool isScoped()
const {
return EnumDeclBits.IsScoped; }
3557 return EnumDeclBits.IsScopedUsingClassTag;
3562 bool isFixed()
const {
return EnumDeclBits.IsFixed; }
3564 unsigned getODRHash();
3570 return isCompleteDefinition() || IntegerType;
3575 bool isClosed()
const;
3579 bool isClosedFlag()
const;
3583 bool isClosedNonFlag()
const;
3587 EnumDecl *getTemplateInstantiationPattern()
const;
3592 EnumDecl *getInstantiatedFromMemberEnum()
const;
3608 return SpecializationInfo;
3615 setInstantiationOfMemberEnum(getASTContext(), ED, TSK);
3651 APK_CanNeverPassInRegs
3666 return cast_or_null<RecordDecl>(
3667 static_cast<TagDecl *
>(
this)->getPreviousDecl());
3670 return const_cast<RecordDecl*
>(
this)->getPreviousDecl();
3674 return cast<RecordDecl>(
static_cast<TagDecl *
>(
this)->getMostRecentDecl());
3677 return const_cast<RecordDecl*
>(
this)->getMostRecentDecl();
3681 return RecordDeclBits.HasFlexibleArrayMember;
3685 RecordDeclBits.HasFlexibleArrayMember =
V;
3700 return RecordDeclBits.AnonymousStructOrUnion;
3704 RecordDeclBits.AnonymousStructOrUnion = Anon;
3713 RecordDeclBits.HasVolatileMember = val;
3717 return RecordDeclBits.LoadedFieldsFromExternalStorage;
3721 RecordDeclBits.LoadedFieldsFromExternalStorage = val;
3726 return RecordDeclBits.NonTrivialToPrimitiveDefaultInitialize;
3730 RecordDeclBits.NonTrivialToPrimitiveDefaultInitialize =
V;
3734 return RecordDeclBits.NonTrivialToPrimitiveCopy;
3738 RecordDeclBits.NonTrivialToPrimitiveCopy =
V;
3742 return RecordDeclBits.NonTrivialToPrimitiveDestroy;
3746 RecordDeclBits.NonTrivialToPrimitiveDestroy =
V;
3750 return RecordDeclBits.HasNonTrivialToPrimitiveDefaultInitializeCUnion;
3754 RecordDeclBits.HasNonTrivialToPrimitiveDefaultInitializeCUnion =
V;
3758 return RecordDeclBits.HasNonTrivialToPrimitiveDestructCUnion;
3762 RecordDeclBits.HasNonTrivialToPrimitiveDestructCUnion =
V;
3766 return RecordDeclBits.HasNonTrivialToPrimitiveCopyCUnion;
3770 RecordDeclBits.HasNonTrivialToPrimitiveCopyCUnion =
V;
3777 return getArgPassingRestrictions() == APK_CanPassInRegs;
3781 return static_cast<ArgPassingKind>(RecordDeclBits.ArgPassingRestrictions);
3785 RecordDeclBits.ArgPassingRestrictions =
Kind;
3789 return RecordDeclBits.ParamDestroyedInCallee;
3793 RecordDeclBits.ParamDestroyedInCallee =
V;
3809 bool isInjectedClassName()
const;
3813 bool isLambda()
const;
3817 bool isCapturedRecord()
const;
3821 void setCapturedRecord();
3839 using field_range = llvm::iterator_range<specific_decl_iterator<FieldDecl>>;
3850 return field_begin() == field_end();
3854 virtual void completeDefinition();
3858 return K >= firstRecord && K <= lastRecord;
3869 bool mayInsertExtraPadding(
bool EmitRemark =
false)
const;
3873 const FieldDecl *findFirstNamedDataMember()
const;
3877 void LoadFieldsFromExternalStorage()
const;
3886 :
Decl(FileScopeAsm, DC, StartL), AsmString(asmstring), RParenLoc(EndL) {}
3888 virtual void anchor();
3928 llvm::PointerIntPair<VarDecl*, 2> VariableAndFlags;
3937 : VariableAndFlags(variable,
3938 (byRef ? flag_isByRef : 0) | (nested ? flag_isNested : 0)),
3946 bool isByRef()
const {
return VariableAndFlags.getInt() & flag_isByRef; }
3949 return getVariable()->isEscapingByref();
3953 return getVariable()->isNonEscapingByref();
3958 bool isNested()
const {
return VariableAndFlags.getInt() & flag_isNested; }
3970 unsigned NumParams = 0;
3972 Stmt *Body =
nullptr;
3975 const Capture *Captures =
nullptr;
3976 unsigned NumCaptures = 0;
3978 unsigned ManglingNumber = 0;
3979 Decl *ManglingContextDecl =
nullptr;
4002 return {ParamInfo, getNumParams()};
4005 return {ParamInfo, getNumParams()};
4022 assert(i < getNumParams() &&
"Illegal param #");
4023 return ParamInfo[
i];
4026 assert(i < getNumParams() &&
"Illegal param #");
4027 return ParamInfo[
i];
4051 return BlockDeclBits.BlockMissingReturnType;
4055 BlockDeclBits.BlockMissingReturnType = val;
4059 return BlockDeclBits.IsConversionFromLambda;
4063 BlockDeclBits.IsConversionFromLambda = val;
4070 return BlockDeclBits.CanAvoidCopyToHeap;
4073 BlockDeclBits.CanAvoidCopyToHeap = B;
4076 bool capturesVariable(
const VarDecl *var)
const;
4079 bool CapturesCXXThis);
4082 return ManglingNumber;
4086 return ManglingContextDecl;
4090 ManglingNumber = Number;
4091 ManglingContextDecl = Ctx;
4122 unsigned ContextParam;
4125 llvm::PointerIntPair<Stmt *, 1, bool> BodyAndNothrow;
4130 return getTrailingObjects<ImplicitParamDecl *>();
4134 return getTrailingObjects<ImplicitParamDecl *>();
4143 unsigned NumParams);
4145 unsigned NumParams);
4147 Stmt *getBody()
const override;
4148 void setBody(
Stmt *B);
4150 bool isNothrow()
const;
4151 void setNothrow(
bool Nothrow =
true);
4156 assert(i < NumParams);
4157 return getParams()[
i];
4160 assert(i < NumParams);
4166 return {getParams(), getNumParams()};
4169 return {getParams(), getNumParams()};
4174 assert(ContextParam < NumParams);
4175 return getParam(ContextParam);
4178 assert(i < NumParams);
4226 llvm::PointerIntPair<Module *, 1, bool> ImportedAndComplete;
4254 unsigned NumLocations);
4279 virtual void anchor();
4307 return decls_empty() ? getLocation() : decls_begin()->getEndLoc();
4328 virtual void anchor();
4354 template<
typename decl_type>
4358 assert(RedeclLink.isFirst() &&
4359 "setPreviousDecl on a decl already in a redeclaration chain");
4365 First = PrevDecl->getFirstDecl();
4366 assert(
First->RedeclLink.isFirst() &&
"Expected first");
4367 decl_type *MostRecent =
First->getNextRedeclaration();
4368 RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4372 static_cast<decl_type*
>(
this)->IdentifierNamespace |=
4373 MostRecent->getIdentifierNamespace() &
4377 First =
static_cast<decl_type*
>(
this);
4381 First->RedeclLink.setLatest(static_cast<decl_type*>(
this));
4383 assert(!isa<NamedDecl>(static_cast<decl_type*>(
this)) ||
4384 cast<NamedDecl>(static_cast<decl_type*>(
this))->isLinkageValid());
4407 #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 const Decl * getCanonicalDecl(const Decl *D)
Represents a function declaration or definition.
bool isThisDeclarationADemotedDefinition() const
If this definition should pretend to be a declaration.
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)
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
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.
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()
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.
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
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. ...
static DeclContext * castToDeclContext(const ExportDecl *D)
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.
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)
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
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 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 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 ...
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...
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.
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)
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)
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)
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.
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.
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)
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)
void setDoesNotEscape(bool B=true)
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 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)
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.
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.
bool hasNonTrivialToPrimitiveDestructCUnion() const
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)
State that this function is explicitly defaulted per C++0x.
void setHasInheritedDefaultArg(bool I=true)
bool hasFlexibleArrayMember() const
bool isTrivialForCall() const
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
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
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
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)
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 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.
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)
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...
void setCanAvoidCopyToHeap(bool B=true)
VarDecl * getDefinition()
void setHasNonTrivialToPrimitiveCopyCUnion(bool V)
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()
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.
ImplicitParamKind getParameterKind() const
Returns the implicit parameter kind.
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
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.