14 #ifndef LLVM_CLANG_AST_DECL_H 15 #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;
64 class MemberSpecializationInfo;
72 class TemplateArgumentList;
73 class TemplateArgumentListInfo;
74 class TemplateParameterList;
75 class TypeAliasTemplateDecl;
77 class UnresolvedSetImpl;
78 class VarTemplateDecl;
117 virtual void anchor();
151 :
Decl(PragmaComment, TU, CommentLoc), CommentKind(CommentKind) {}
153 virtual void anchor();
165 StringRef
getArg()
const {
return getTrailingObjects<char>(); }
185 :
Decl(PragmaDetectMismatch, TU, Loc), ValueStart(ValueStart) {}
187 virtual void anchor();
195 CreateDeserialized(
ASTContext &
C,
unsigned ID,
unsigned NameValueSize);
197 StringRef
getName()
const {
return getTrailingObjects<char>(); }
198 StringRef
getValue()
const {
return getTrailingObjects<char>() + ValueStart; }
227 virtual void anchor();
255 virtual void anchor();
258 NamedDecl *getUnderlyingDeclImpl() LLVM_READONLY;
262 :
Decl(DK, DC, L), Name(N) {}
277 assert(Name.
isIdentifier() &&
"Name is not a simple identifier");
294 virtual void printName(raw_ostream &os)
const;
311 void printQualifiedName(raw_ostream &OS)
const;
312 void printQualifiedName(raw_ostream &OS,
const PrintingPolicy &Policy)
const;
315 std::string getQualifiedNameAsString()
const;
323 virtual void getNameForDiagnostic(raw_ostream &OS,
325 bool Qualified)
const;
337 bool declarationReplaces(
NamedDecl *OldD,
bool IsKnownNewer =
true)
const;
340 bool hasLinkage()
const;
352 if (isa<EnumDecl>(DC))
360 bool isCXXInstanceMember()
const;
367 Linkage getLinkageInternal()
const;
392 return getLinkageAndVisibility().getVisibility();
418 bool isLinkageValid()
const;
427 return hasCachedLinkage();
434 if (this->
getKind() != UsingShadow &&
435 this->
getKind() != ConstructorUsingShadow &&
436 this->
getKind() != ObjCCompatibleAlias &&
437 this->
getKind() != NamespaceAlias)
440 return getUnderlyingDeclImpl();
443 return const_cast<NamedDecl*
>(
this)->getUnderlyingDecl();
447 return cast<NamedDecl>(
static_cast<Decl *
>(
this)->getMostRecentDecl());
450 return const_cast<NamedDecl*
>(
this)->getMostRecentDecl();
472 bool MSAsmNameResolved =
false;
481 :
NamedDecl(
Label, DC, IdentL, II), TheStmt(S), LocStart(StartL) {}
483 void anchor()
override;
496 bool isGnuLocal()
const {
return LocStart != getLocation(); }
505 void setMSAsmLabel(StringRef Name);
529 llvm::PointerIntPair<NamespaceDecl *, 1, bool> AnonOrFirstNamespaceAndInline;
555 using redeclarable_base::redecls_begin;
556 using redeclarable_base::redecls_end;
557 using redeclarable_base::redecls;
558 using redeclarable_base::getPreviousDecl;
559 using redeclarable_base::getMostRecentDecl;
560 using redeclarable_base::isFirstDecl;
577 return AnonOrFirstNamespaceAndInline.getInt();
582 AnonOrFirstNamespaceAndInline.setInt(Inline);
594 bool isOriginalNamespace()
const;
599 return getOriginalNamespace()->AnonOrFirstNamespaceAndInline.getPointer();
603 getOriginalNamespace()->AnonOrFirstNamespaceAndInline.setPointer(D);
608 return getOriginalNamespace();
611 return getOriginalNamespace();
640 void anchor()
override;
645 :
NamedDecl(DK, DC, L, N), DeclType(T) {}
669 unsigned NumTemplParamLists = 0;
683 void setTemplateParameterListsInfo(
ASTContext &Context,
696 llvm::PointerUnion<TypeSourceInfo *, ExtInfo *> DeclInfo;
702 bool hasExtInfo()
const {
return DeclInfo.is<ExtInfo*>(); }
703 ExtInfo *getExtInfo() {
return DeclInfo.get<ExtInfo*>(); }
704 const ExtInfo *getExtInfo()
const {
return DeclInfo.get<ExtInfo*>(); }
710 :
ValueDecl(DK, DC, L, N, T), DeclInfo(TInfo), InnerLocStart(StartL) {}
718 ? getExtInfo()->TInfo
724 getExtInfo()->TInfo = TI;
740 return getOuterLocStart();
746 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
754 return hasExtInfo() ? getExtInfo()->QualifierLoc
761 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
765 assert(index < getNumTemplateParameterLists());
766 return getExtInfo()->TemplParamLists[index];
769 void setTemplateParameterListsInfo(
ASTContext &Context,
777 return K >= firstDeclarator && K <= lastDeclarator;
842 static const char *getStorageClassSpecifierString(
StorageClass SC);
852 using InitType = llvm::PointerUnion<Stmt *, EvaluatedStmt *>;
863 class VarDeclBitfields {
868 unsigned TSCSpec : 2;
869 unsigned InitStyle : 2;
873 unsigned ARCPseudoStrong : 1;
875 enum { NumVarDeclBits = 8 };
878 enum { NumParameterIndexBits = 8 };
891 unsigned : NumVarDeclBits;
895 unsigned HasInheritedDefaultArg : 1;
904 unsigned IsKNRPromoted : 1;
907 unsigned IsObjCMethodParam : 1;
913 unsigned ScopeDepthOrObjCQuals : 7;
917 unsigned ParameterIndex : NumParameterIndexBits;
925 unsigned : NumVarDeclBits;
930 unsigned IsThisDeclarationADemotedDefinition : 1;
934 unsigned ExceptionVar : 1;
939 unsigned NRVOVariable : 1;
943 unsigned CXXForRangeDecl : 1;
946 unsigned ObjCForDecl : 1;
949 unsigned IsInline : 1;
952 unsigned IsInlineSpecified : 1;
955 unsigned IsConstexpr : 1;
959 unsigned IsInitCapture : 1;
964 unsigned PreviousDeclInSameBlockScope : 1;
968 unsigned ImplicitParamKind : 3;
970 unsigned EscapingByref : 1;
987 return getNextRedeclaration();
991 return getPreviousDecl();
995 return getMostRecentDecl();
1002 using redeclarable_base::redecls_begin;
1003 using redeclarable_base::redecls_end;
1004 using redeclarable_base::redecls;
1005 using redeclarable_base::getPreviousDecl;
1006 using redeclarable_base::getMostRecentDecl;
1007 using redeclarable_base::isFirstDecl;
1026 VarDeclBits.TSCSpec = TSC;
1027 assert(VarDeclBits.TSCSpec == TSC &&
"truncation");
1037 if (getStorageClass() ==
SC_None) {
1049 if (getStorageClass() ==
SC_Register && !isLocalVarDeclOrParm())
1055 return getStorageClass() >=
SC_Auto;
1061 return (getStorageClass() ==
SC_Static ||
1064 && !isFileVarDecl();
1070 return getStorageClass() ==
SC_Extern ||
1094 bool isInExternCContext()
const;
1098 bool isInExternCXXContext()
const;
1108 if (
const DeclContext *DC = getLexicalDeclContext())
1109 return DC->getRedeclContext()->isFunctionOrMethod();
1115 return isLocalVarDecl() ||
getKind() == Decl::ParmVar;
1137 return getKind() != Decl::ParmVar && getDeclContext()->isRecord();
1161 return isThisDeclarationADefinition(getASTContext());
1172 VarDecl *getActingDefinition();
1174 return const_cast<VarDecl*
>(
this)->getActingDefinition();
1191 bool isOutOfLine()
const override;
1196 if (K == ParmVar || K == ImplicitParam)
1199 if (getLexicalDeclContext()->getRedeclContext()->isFileContext())
1202 if (isStaticDataMember())
1212 return getAnyInitializer(D);
1217 const Expr *getAnyInitializer(
const VarDecl *&D)
const;
1219 bool hasInit()
const;
1221 return const_cast<VarDecl *
>(
this)->getInit();
1226 Stmt **getInitAddress();
1228 void setInit(
Expr *I);
1234 bool isUsableInConstantExpressions(
ASTContext &
C)
const;
1242 APValue *evaluateValue()
const;
1248 APValue *getEvaluatedValue()
const;
1252 bool isInitKnownICE()
const;
1259 bool isInitICE()
const;
1263 bool checkInitIsICE()
const;
1266 VarDeclBits.InitStyle =
Style;
1285 return getInitStyle() != CInit;
1290 return isa<ParmVarDecl>(
this) ?
false :
1291 NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
1300 assert(isThisDeclarationADefinition() &&
"Not a definition!");
1301 assert(!isa<ParmVarDecl>(
this) &&
"Cannot demote ParmVarDecls!");
1302 NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
1308 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.ExceptionVar;
1311 assert(!isa<ParmVarDecl>(
this));
1312 NonParmVarDeclBits.ExceptionVar = EV;
1326 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.NRVOVariable;
1329 assert(!isa<ParmVarDecl>(
this));
1330 NonParmVarDeclBits.NRVOVariable = NRVO;
1336 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.CXXForRangeDecl;
1339 assert(!isa<ParmVarDecl>(
this));
1340 NonParmVarDeclBits.CXXForRangeDecl = FRD;
1346 return NonParmVarDeclBits.ObjCForDecl;
1350 NonParmVarDeclBits.ObjCForDecl = FRD;
1365 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsInline;
1368 return isa<ParmVarDecl>(
this) ?
false 1369 : NonParmVarDeclBits.IsInlineSpecified;
1372 assert(!isa<ParmVarDecl>(
this));
1373 NonParmVarDeclBits.IsInline =
true;
1374 NonParmVarDeclBits.IsInlineSpecified =
true;
1377 assert(!isa<ParmVarDecl>(
this));
1378 NonParmVarDeclBits.IsInline =
true;
1383 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsConstexpr;
1386 assert(!isa<ParmVarDecl>(
this));
1387 NonParmVarDeclBits.IsConstexpr = IC;
1392 return isa<ParmVarDecl>(
this) ?
false : NonParmVarDeclBits.IsInitCapture;
1395 assert(!isa<ParmVarDecl>(
this));
1396 NonParmVarDeclBits.IsInitCapture = IC;
1402 return isa<ParmVarDecl>(
this)
1404 : NonParmVarDeclBits.PreviousDeclInSameBlockScope;
1407 assert(!isa<ParmVarDecl>(
this));
1408 NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
1414 bool isEscapingByref()
const;
1418 bool isNonEscapingByref()
const;
1421 NonParmVarDeclBits.EscapingByref =
true;
1426 VarDecl *getTemplateInstantiationPattern()
const;
1431 VarDecl *getInstantiatedFromStaticDataMember()
const;
1455 void setInstantiationOfStaticDataMember(
VarDecl *VD,
1476 bool isKnownToBeDefined()
const;
1487 void anchor()
override;
1525 :
VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
1527 NonParmVarDeclBits.ImplicitParamKind = ParamKind;
1535 NonParmVarDeclBits.ImplicitParamKind = ParamKind;
1552 enum { MaxFunctionScopeDepth = 255 };
1553 enum { MaxFunctionScopeIndex = 255 };
1559 :
VarDecl(DK, C, DC, StartLoc, IdLoc, Id, T, TInfo, S) {
1560 assert(ParmVarDeclBits.HasInheritedDefaultArg ==
false);
1561 assert(ParmVarDeclBits.DefaultArgKind == DAK_None);
1562 assert(ParmVarDeclBits.IsKNRPromoted ==
false);
1563 assert(ParmVarDeclBits.IsObjCMethodParam ==
false);
1564 setDefaultArg(DefArg);
1579 ParmVarDeclBits.IsObjCMethodParam =
true;
1580 setParameterIndex(parameterIndex);
1584 assert(!ParmVarDeclBits.IsObjCMethodParam);
1586 ParmVarDeclBits.ScopeDepthOrObjCQuals = scopeDepth;
1587 assert(ParmVarDeclBits.ScopeDepthOrObjCQuals == scopeDepth
1590 setParameterIndex(parameterIndex);
1594 return ParmVarDeclBits.IsObjCMethodParam;
1598 if (ParmVarDeclBits.IsObjCMethodParam)
return 0;
1599 return ParmVarDeclBits.ScopeDepthOrObjCQuals;
1604 return getParameterIndex();
1608 if (!ParmVarDeclBits.IsObjCMethodParam)
return OBJC_TQ_None;
1612 assert(ParmVarDeclBits.IsObjCMethodParam);
1613 ParmVarDeclBits.ScopeDepthOrObjCQuals = QTVal;
1625 return ParmVarDeclBits.IsKNRPromoted;
1628 ParmVarDeclBits.IsKNRPromoted = promoted;
1631 Expr *getDefaultArg();
1633 return const_cast<ParmVarDecl *
>(
this)->getDefaultArg();
1636 void setDefaultArg(
Expr *defarg);
1641 void setUninstantiatedDefaultArg(
Expr *arg);
1642 Expr *getUninstantiatedDefaultArg();
1644 return const_cast<ParmVarDecl *
>(
this)->getUninstantiatedDefaultArg();
1649 bool hasDefaultArg()
const;
1661 return ParmVarDeclBits.DefaultArgKind == DAK_Unparsed;
1665 return ParmVarDeclBits.DefaultArgKind == DAK_Uninstantiated;
1673 ParmVarDeclBits.DefaultArgKind = DAK_Unparsed;
1677 return ParmVarDeclBits.HasInheritedDefaultArg;
1681 ParmVarDeclBits.HasInheritedDefaultArg = I;
1688 bool isParameterPack()
const;
1701 enum { ParameterIndexSentinel = (1 << NumParameterIndexBits) - 1 };
1703 void setParameterIndex(
unsigned parameterIndex) {
1704 if (parameterIndex >= ParameterIndexSentinel) {
1705 setParameterIndexLarge(parameterIndex);
1709 ParmVarDeclBits.ParameterIndex = parameterIndex;
1710 assert(ParmVarDeclBits.ParameterIndex == parameterIndex &&
"truncation!");
1712 unsigned getParameterIndex()
const {
1713 unsigned d = ParmVarDeclBits.ParameterIndex;
1714 return d == ParameterIndexSentinel ? getParameterIndexLarge() : d;
1717 void setParameterIndexLarge(
unsigned parameterIndex);
1718 unsigned getParameterIndexLarge()
const;
1750 TK_DependentFunctionTemplateSpecialization
1788 TemplateOrSpecialization;
1815 void setFunctionTemplateSpecialization(
ASTContext &
C,
1816 FunctionTemplateDecl *Template,
1833 bool isDeletedBit()
const {
return FunctionDeclBits.IsDeleted; }
1836 bool hasODRHash()
const {
return FunctionDeclBits.HasODRHash; }
1839 void setHasODRHash(
bool B =
true) { FunctionDeclBits.HasODRHash = B; }
1845 bool isConstexprSpecified);
1850 return getNextRedeclaration();
1854 return getPreviousDecl();
1858 return getMostRecentDecl();
1868 using redeclarable_base::redecls_begin;
1869 using redeclarable_base::redecls_end;
1870 using redeclarable_base::redecls;
1871 using redeclarable_base::getPreviousDecl;
1872 using redeclarable_base::getMostRecentDecl;
1873 using redeclarable_base::isFirstDecl;
1880 bool isInlineSpecified =
false,
1881 bool hasWrittenPrototype =
true,
1882 bool isConstexprSpecified =
false) {
1886 isInlineSpecified, hasWrittenPrototype,
1887 isConstexprSpecified);
1895 bool isInlineSpecified,
1896 bool hasWrittenPrototype,
1897 bool isConstexprSpecified =
false);
1905 void getNameForDiagnostic(raw_ostream &OS,
const PrintingPolicy &Policy,
1906 bool Qualified)
const override;
1935 return hasBody(Definition);
1940 bool hasTrivialBody()
const;
1951 return isDefined(Definition);
1957 if (isDefined(Definition))
1975 return getBody(Definition);
1984 return isDeletedAsWritten() || isDefaulted() || Body || hasSkippedBody() ||
1985 isLateTemplateParsed() || willHaveBody() || hasDefiningAttr();
1990 return Body || isLateTemplateParsed();
1993 void setBody(
Stmt *B);
1997 bool isVariadic()
const;
2001 return FunctionDeclBits.IsVirtualAsWritten;
2009 bool isPure()
const {
return FunctionDeclBits.IsPure; }
2010 void setPure(
bool P =
true);
2014 return FunctionDeclBits.IsLateTemplateParsed;
2019 FunctionDeclBits.IsLateTemplateParsed = ILT;
2026 bool isTrivial()
const {
return FunctionDeclBits.IsTrivial; }
2040 return FunctionDeclBits.IsExplicitlyDefaulted;
2046 FunctionDeclBits.IsExplicitlyDefaulted = ED;
2053 return FunctionDeclBits.HasImplicitReturnZero;
2060 FunctionDeclBits.HasImplicitReturnZero = IRZ;
2068 return hasWrittenPrototype() || hasInheritedPrototype();
2073 return FunctionDeclBits.HasWrittenPrototype;
2078 FunctionDeclBits.HasWrittenPrototype =
P;
2084 return FunctionDeclBits.HasInheritedPrototype;
2090 FunctionDeclBits.HasInheritedPrototype =
P;
2104 return FunctionDeclBits.InstantiationIsPending;
2110 FunctionDeclBits.InstantiationIsPending = IC;
2141 return FunctionDeclBits.IsDeleted && !isDefaulted();
2148 bool isMain()
const;
2152 bool isMSVCRTEntryPoint()
const;
2167 bool isReservedGlobalPlacementOperator()
const;
2187 bool isReplaceableGlobalAllocationFunction(
bool *IsAligned =
nullptr)
const;
2190 bool isDestroyingOperatorDelete()
const;
2201 bool isInExternCContext()
const;
2205 bool isInExternCXXContext()
const;
2208 bool isGlobal()
const;
2212 bool isNoReturn()
const;
2217 FunctionDeclBits.HasSkippedBody = Skipped;
2243 bool isCPUDispatchMultiVersion()
const;
2246 bool isCPUSpecificMultiVersion()
const;
2250 bool isTargetMultiVersion()
const;
2259 unsigned getBuiltinID()
const;
2263 return {ParamInfo, getNumParams()};
2266 return {ParamInfo, getNumParams()};
2283 unsigned getNumParams()
const;
2286 assert(i < getNumParams() &&
"Illegal param #");
2287 return ParamInfo[i];
2290 assert(i < getNumParams() &&
"Illegal param #");
2291 return ParamInfo[i];
2294 setParams(getASTContext(), NewParamInfo);
2300 unsigned getMinRequiredArguments()
const;
2314 auto *TSI = getTypeSourceInfo();
2332 return static_cast<StorageClass>(FunctionDeclBits.SClass);
2337 FunctionDeclBits.SClass = SClass;
2346 FunctionDeclBits.IsInlineSpecified = I;
2347 FunctionDeclBits.IsInline = I;
2356 bool isInlined()
const {
return FunctionDeclBits.IsInline; }
2360 return FunctionDeclBits.IsExplicitSpecified;
2365 FunctionDeclBits.IsExplicitSpecified = ExpSpec;
2368 bool isInlineDefinitionExternallyVisible()
const;
2370 bool isMSExternInline()
const;
2372 bool doesDeclarationForceExternallyVisibleDefinition()
const;
2377 return getOverloadedOperator() !=
OO_None;
2405 FunctionDecl *getInstantiatedFromMemberFunction()
const;
2413 MemberSpecializationInfo *getMemberSpecializationInfo()
const;
2419 setInstantiationOfMemberFunction(getASTContext(), FD, TSK);
2434 FunctionTemplateDecl *getDescribedFunctionTemplate()
const;
2436 void setDescribedFunctionTemplate(FunctionTemplateDecl *Template);
2441 return getPrimaryTemplate() !=
nullptr;
2446 FunctionDecl *getClassScopeSpecializationPattern()
const;
2451 FunctionTemplateSpecializationInfo *getTemplateSpecializationInfo()
const;
2456 bool isImplicitlyInstantiable()
const;
2472 FunctionTemplateDecl *getPrimaryTemplate()
const;
2489 getTemplateSpecializationArgsAsWritten()
const;
2516 setFunctionTemplateSpecialization(getASTContext(), Template, TemplateArgs,
2517 InsertPos, TSK, TemplateArgsAsWritten,
2518 PointOfInstantiation);
2523 void setDependentTemplateSpecialization(
ASTContext &Context,
2528 getDependentSpecializationInfo()
const;
2549 bool isOutOfLine()
const override;
2555 unsigned getMemoryFunctionKind()
const;
2559 unsigned getODRHash();
2563 unsigned getODRHash()
const;
2568 return K >= firstFunction && K <= lastFunction;
2580 unsigned BitField : 1;
2581 unsigned Mutable : 1;
2582 mutable unsigned CachedFieldIndex : 30;
2588 enum InitStorageKind {
2604 ISK_CapturedVLAType,
2609 struct InitAndBitWidth {
2623 llvm::PointerIntPair<void *, 2, InitStorageKind> InitStorage;
2631 BitField(
false), Mutable(Mutable), CachedFieldIndex(0),
2632 InitStorage(nullptr, (InitStorageKind) InitStyle) {
2651 unsigned getFieldIndex()
const;
2666 bool isAnonymousStructOrUnion()
const;
2671 void *Ptr = InitStorage.getPointer();
2672 if (getInClassInitStyle())
2673 return static_cast<InitAndBitWidth*
>(Ptr)->BitWidth;
2674 return static_cast<Expr*
>(Ptr);
2677 unsigned getBitWidthValue(
const ASTContext &Ctx)
const;
2682 assert(!hasCapturedVLAType() && !BitField &&
2683 "bit width or captured type already set");
2684 assert(Width &&
"no bit width specified");
2685 InitStorage.setPointer(
2686 InitStorage.getInt()
2687 ?
new (getASTContext())
2688 InitAndBitWidth{getInClassInitializer(), Width}
2689 :
static_cast<void*
>(Width));
2696 assert(isBitField() &&
"no bitfield width to remove");
2697 InitStorage.setPointer(getInClassInitializer());
2704 bool isZeroLengthBitField(
const ASTContext &Ctx)
const;
2708 InitStorageKind storageKind = InitStorage.getInt();
2709 return (storageKind == ISK_CapturedVLAType
2722 if (!hasInClassInitializer())
2724 void *Ptr = InitStorage.getPointer();
2726 return static_cast<InitAndBitWidth*
>(Ptr)->Init;
2727 return static_cast<Expr*
>(Ptr);
2732 assert(hasInClassInitializer() && !getInClassInitializer());
2734 static_cast<InitAndBitWidth*
>(InitStorage.getPointer())->Init = Init;
2736 InitStorage.setPointer(Init);
2741 assert(hasInClassInitializer() &&
"no initializer to remove");
2742 InitStorage.setPointerAndInt(getBitWidth(), ISK_NoInit);
2748 return InitStorage.getInt() == ISK_CapturedVLAType;
2754 InitStorage.getPointer())
2764 return cast<RecordDecl>(getDeclContext());
2768 return cast<RecordDecl>(getDeclContext());
2793 const llvm::APSInt &V)
2794 :
ValueDecl(EnumConstant, DC, L, Id, T), Init((
Stmt*)E), Val(V) {}
2802 const llvm::APSInt &V);
2828 unsigned ChainingSize;
2834 void anchor()
override;
2848 return llvm::makeArrayRef(Chaining, ChainingSize);
2856 assert(chain().size() >= 2);
2857 return cast<FieldDecl>(chain().back());
2861 assert(chain().size() >= 2);
2862 return dyn_cast<
VarDecl>(chain().front());
2881 mutable const Type *TypeForDecl =
nullptr;
2886 void anchor()
override;
2891 :
NamedDecl(DK, DC, L, Id), LocStart(StartL) {}
2917 struct alignas(8) ModedTInfo {
2924 mutable llvm::PointerIntPair<
2925 llvm::PointerUnion<TypeSourceInfo *, ModedTInfo *>, 2>
2928 void anchor()
override;
2935 MaybeModedTInfo(TInfo, 0) {}
2940 return getNextRedeclaration();
2944 return getPreviousDecl();
2948 return getMostRecentDecl();
2955 using redeclarable_base::redecls_begin;
2956 using redeclarable_base::redecls_end;
2957 using redeclarable_base::redecls;
2958 using redeclarable_base::getPreviousDecl;
2959 using redeclarable_base::getMostRecentDecl;
2960 using redeclarable_base::isFirstDecl;
2963 return MaybeModedTInfo.getPointer().is<ModedTInfo *>();
2967 return isModed() ? MaybeModedTInfo.getPointer().get<ModedTInfo *>()->first
2972 return isModed() ? MaybeModedTInfo.getPointer().get<ModedTInfo *>()->second
2973 : MaybeModedTInfo.getPointer()
2979 MaybeModedTInfo.setPointer(newType);
2983 MaybeModedTInfo.setPointer(
new (getASTContext(), 8)
2984 ModedTInfo({unmodedTSI, modedTy}));
2996 TagDecl *getAnonDeclWithTypedefName(
bool AnyRedecl =
false)
const;
3001 if (MaybeModedTInfo.getInt())
3002 return MaybeModedTInfo.getInt() & 0x2;
3003 return isTransparentTagSlow();
3009 return K >= firstTypedefName && K <= lastTypedefName;
3013 bool isTransparentTagSlow()
const;
3045 Template(
nullptr) {}
3088 llvm::PointerUnion<TypedefNameDecl *, ExtInfo *> TypedefNameDeclOrQualifier;
3090 bool hasExtInfo()
const {
return TypedefNameDeclOrQualifier.is<
ExtInfo *>(); }
3091 ExtInfo *getExtInfo() {
return TypedefNameDeclOrQualifier.get<
ExtInfo *>(); }
3092 const ExtInfo *getExtInfo()
const {
3093 return TypedefNameDeclOrQualifier.get<
ExtInfo *>();
3104 return getNextRedeclaration();
3108 return getPreviousDecl();
3112 return getMostRecentDecl();
3118 void completeDefinition();
3128 TagDeclBits.MayHaveOutOfDateDef = V;
3138 using redeclarable_base::redecls_begin;
3139 using redeclarable_base::redecls_end;
3140 using redeclarable_base::redecls;
3141 using redeclarable_base::getPreviousDecl;
3142 using redeclarable_base::getMostRecentDecl;
3143 using redeclarable_base::isFirstDecl;
3165 return isCompleteDefinition();
3173 TagDeclBits.IsCompleteDefinition = V;
3179 return TagDeclBits.IsCompleteDefinitionRequired;
3185 TagDeclBits.IsCompleteDefinitionRequired = V;
3194 return TagDeclBits.IsEmbeddedInDeclarator;
3200 TagDeclBits.IsEmbeddedInDeclarator = isInDeclarator;
3208 TagDeclBits.IsFreeStanding = isFreeStanding;
3227 void startDefinition();
3244 return static_cast<TagKind>(TagDeclBits.TagDeclKind);
3271 return (getDeclName() || getTypedefNameForAnonDecl());
3275 return hasExtInfo() ? nullptr
3284 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
3292 return hasExtInfo() ? getExtInfo()->QualifierLoc
3299 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
3303 assert(i < getNumTemplateParameterLists());
3304 return getExtInfo()->TemplParamLists[i];
3307 void setTemplateParameterListsInfo(
ASTContext &Context,
3344 llvm::PointerUnion<const Type *, TypeSourceInfo *> IntegerType;
3355 MemberSpecializationInfo *SpecializationInfo =
nullptr;
3364 bool Scoped,
bool ScopedUsingClassTag,
bool Fixed);
3366 void anchor()
override;
3373 void setNumPositiveBits(
unsigned Num) {
3374 EnumDeclBits.NumPositiveBits = Num;
3375 assert(EnumDeclBits.NumPositiveBits == Num &&
"can't store this bitcount");
3380 void setNumNegativeBits(
unsigned Num) { EnumDeclBits.NumNegativeBits = Num; }
3384 void setScoped(
bool Scoped =
true) { EnumDeclBits.IsScoped = Scoped; }
3390 void setScopedUsingClassTag(
bool ScopedUCT =
true) {
3391 EnumDeclBits.IsScopedUsingClassTag = ScopedUCT;
3396 void setFixed(
bool Fixed =
true) { EnumDeclBits.IsFixed = Fixed; }
3399 bool hasODRHash()
const {
return EnumDeclBits.HasODRHash; }
3400 void setHasODRHash(
bool Hash =
true) { EnumDeclBits.HasODRHash = Hash; }
3413 return cast_or_null<EnumDecl>(
3414 static_cast<TagDecl *
>(
this)->getPreviousDecl());
3417 return const_cast<EnumDecl*
>(
this)->getPreviousDecl();
3421 return cast<EnumDecl>(
static_cast<TagDecl *
>(
this)->getMostRecentDecl());
3424 return const_cast<EnumDecl*
>(
this)->getMostRecentDecl();
3434 bool IsScoped,
bool IsScopedUsingClassTag,
3443 void completeDefinition(
QualType NewType,
3445 unsigned NumPositiveBits,
3446 unsigned NumNegativeBits);
3451 llvm::iterator_range<specific_decl_iterator<EnumConstantDecl>>;
3483 if (
const Type *T = IntegerType.dyn_cast<
const Type*>())
3502 SourceRange getIntegerTypeRange()
const LLVM_READONLY;
3520 bool isScoped()
const {
return EnumDeclBits.IsScoped; }
3524 return EnumDeclBits.IsScopedUsingClassTag;
3529 bool isFixed()
const {
return EnumDeclBits.IsFixed; }
3531 unsigned getODRHash();
3537 return isCompleteDefinition() || IntegerType;
3542 bool isClosed()
const;
3546 bool isClosedFlag()
const;
3550 bool isClosedNonFlag()
const;
3554 EnumDecl *getTemplateInstantiationPattern()
const;
3559 EnumDecl *getInstantiatedFromMemberEnum()
const;
3575 return SpecializationInfo;
3582 setInstantiationOfMemberEnum(getASTContext(), ED, TSK);
3618 APK_CanNeverPassInRegs
3633 return cast_or_null<RecordDecl>(
3634 static_cast<TagDecl *
>(
this)->getPreviousDecl());
3637 return const_cast<RecordDecl*
>(
this)->getPreviousDecl();
3641 return cast<RecordDecl>(
static_cast<TagDecl *
>(
this)->getMostRecentDecl());
3644 return const_cast<RecordDecl*
>(
this)->getMostRecentDecl();
3648 return RecordDeclBits.HasFlexibleArrayMember;
3652 RecordDeclBits.HasFlexibleArrayMember = V;
3667 return RecordDeclBits.AnonymousStructOrUnion;
3671 RecordDeclBits.AnonymousStructOrUnion = Anon;
3680 RecordDeclBits.HasVolatileMember = val;
3684 return RecordDeclBits.LoadedFieldsFromExternalStorage;
3688 RecordDeclBits.LoadedFieldsFromExternalStorage = val;
3693 return RecordDeclBits.NonTrivialToPrimitiveDefaultInitialize;
3697 RecordDeclBits.NonTrivialToPrimitiveDefaultInitialize = V;
3701 return RecordDeclBits.NonTrivialToPrimitiveCopy;
3705 RecordDeclBits.NonTrivialToPrimitiveCopy = V;
3709 return RecordDeclBits.NonTrivialToPrimitiveDestroy;
3713 RecordDeclBits.NonTrivialToPrimitiveDestroy = V;
3720 return getArgPassingRestrictions() == APK_CanPassInRegs;
3724 return static_cast<ArgPassingKind>(RecordDeclBits.ArgPassingRestrictions);
3728 RecordDeclBits.ArgPassingRestrictions =
Kind;
3732 return RecordDeclBits.ParamDestroyedInCallee;
3736 RecordDeclBits.ParamDestroyedInCallee = V;
3752 bool isInjectedClassName()
const;
3756 bool isLambda()
const;
3760 bool isCapturedRecord()
const;
3764 void setCapturedRecord();
3782 using field_range = llvm::iterator_range<specific_decl_iterator<FieldDecl>>;
3793 return field_begin() == field_end();
3797 virtual void completeDefinition();
3801 return K >= firstRecord && K <= lastRecord;
3812 bool mayInsertExtraPadding(
bool EmitRemark =
false)
const;
3816 const FieldDecl *findFirstNamedDataMember()
const;
3820 void LoadFieldsFromExternalStorage()
const;
3829 :
Decl(FileScopeAsm, DC, StartL), AsmString(asmstring), RParenLoc(EndL) {}
3831 virtual void anchor();
3871 llvm::PointerIntPair<VarDecl*, 2> VariableAndFlags;
3880 : VariableAndFlags(variable,
3881 (byRef ? flag_isByRef : 0) | (nested ? flag_isNested : 0)),
3889 bool isByRef()
const {
return VariableAndFlags.getInt() & flag_isByRef; }
3892 return getVariable()->isEscapingByref();
3896 return getVariable()->isNonEscapingByref();
3901 bool isNested()
const {
return VariableAndFlags.getInt() & flag_isNested; }
3913 unsigned NumParams = 0;
3915 Stmt *Body =
nullptr;
3918 const Capture *Captures =
nullptr;
3919 unsigned NumCaptures = 0;
3921 unsigned ManglingNumber = 0;
3922 Decl *ManglingContextDecl =
nullptr;
3945 return {ParamInfo, getNumParams()};
3948 return {ParamInfo, getNumParams()};
3965 assert(i < getNumParams() &&
"Illegal param #");
3966 return ParamInfo[i];
3969 assert(i < getNumParams() &&
"Illegal param #");
3970 return ParamInfo[i];
3994 return BlockDeclBits.BlockMissingReturnType;
3998 BlockDeclBits.BlockMissingReturnType = val;
4002 return BlockDeclBits.IsConversionFromLambda;
4006 BlockDeclBits.IsConversionFromLambda = val;
4012 bool capturesVariable(
const VarDecl *var)
const;
4015 bool CapturesCXXThis);
4018 return ManglingNumber;
4022 return ManglingContextDecl;
4026 ManglingNumber = Number;
4027 ManglingContextDecl = Ctx;
4058 unsigned ContextParam;
4061 llvm::PointerIntPair<Stmt *, 1, bool> BodyAndNothrow;
4066 return getTrailingObjects<ImplicitParamDecl *>();
4070 return getTrailingObjects<ImplicitParamDecl *>();
4079 unsigned NumParams);
4081 unsigned NumParams);
4083 Stmt *getBody()
const override;
4084 void setBody(
Stmt *B);
4086 bool isNothrow()
const;
4087 void setNothrow(
bool Nothrow =
true);
4092 assert(i < NumParams);
4093 return getParams()[i];
4096 assert(i < NumParams);
4102 return {getParams(), getNumParams()};
4105 return {getParams(), getNumParams()};
4110 assert(ContextParam < NumParams);
4111 return getParam(ContextParam);
4114 assert(i < NumParams);
4162 llvm::PointerIntPair<Module *, 1, bool> ImportedAndComplete;
4190 unsigned NumLocations);
4215 virtual void anchor();
4241 return decls_empty() ? getLocation() : decls_begin()->getEndLoc();
4262 virtual void anchor();
4288 template<
typename decl_type>
4292 assert(RedeclLink.isFirst() &&
4293 "setPreviousDecl on a decl already in a redeclaration chain");
4299 First = PrevDecl->getFirstDecl();
4300 assert(
First->RedeclLink.isFirst() &&
"Expected first");
4301 decl_type *MostRecent =
First->getNextRedeclaration();
4302 RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent));
4306 static_cast<decl_type*
>(
this)->IdentifierNamespace |=
4307 MostRecent->getIdentifierNamespace() &
4311 First =
static_cast<decl_type*
>(
this);
4315 First->RedeclLink.setLatest(static_cast<decl_type*>(
this));
4317 assert(!isa<NamedDecl>(static_cast<decl_type*>(
this)) ||
4318 cast<NamedDecl>(static_cast<decl_type*>(
this))->isLinkageValid());
4341 #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.
void setNonTrivialToPrimitiveDestroy(bool V)
Other implicit parameter.
static bool classof(const Decl *D)
Expr * getCopyExpr() const
static DeclContext * castToDeclContext(const ExternCContextDecl *D)
void setAnonymousStructOrUnion(bool Anon)
A class which contains all the information about a particular captured value.
A (possibly-)qualified type.
TagDecl * getDefinition() const
Returns the TagDecl that actually defines this struct/union/class/enum.
static bool classofKind(Kind K)
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.
static ClassTemplateDecl * getDefinition(ClassTemplateDecl *D)
bool isObjCMethodParameter() const
capture_const_iterator capture_begin() const
SourceRange getBraceRange() const
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
const NamedDecl * getUnderlyingDecl() const
InClassInitStyle getInClassInitStyle() const
Get the kind of (C++11) default member initializer that this field has.
VarDecl * getVarDecl() const
redeclarable_base::redecl_iterator redecl_iterator
void setNonTrivialToPrimitiveDefaultInitialize(bool V)
static TranslationUnitDecl * castFromDeclContext(const DeclContext *DC)
bool IsEnumDeclScoped(EnumDecl *ED)
Check if the given decl is scoped.
static bool classofKind(Kind K)
void setExplicitSpecified(bool ExpSpec=true)
State that this function is marked as explicit explicitly.
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)
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)
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.
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
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)
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInlineSpecified=false, bool hasWrittenPrototype=true, bool isConstexprSpecified=false)
ArgPassingKind getArgPassingRestrictions() const
VarDecl * getPreviousDeclImpl() override
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain...
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
param_iterator param_begin()
void setHasInheritedPrototype(bool P=true)
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 }.
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 isInlineSpecified() const
TypeSourceInfo * getTypeSourceInfo() const
static bool classof(const Decl *D)
void setInClassInitializer(Expr *Init)
Set the C++11 in-class initializer for this member.
FieldDecl(Kind DK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
bool isTransparentTag() const
Determines if this typedef shares a name and spelling location with its underlying tag type...
static bool classof(const Decl *D)
void setTrivialForCall(bool IT)
TypedefNameDecl * getMostRecentDeclImpl() override
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
unsigned getFunctionScopeDepth() const
bool isMultiVersion() const
True if this function is considered a multiversioned function.
bool isDependentType() const
Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
This represents one expression.
StringRef getKindName() const
TypedefNameDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
unsigned getChainingSize() const
void setBitWidth(Expr *Width)
Set the bit-field width for this member.
static bool classofKind(Kind K)
bool isDefaulted() const
Whether this function is defaulted per C++0x.
static bool classof(const Decl *D)
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
bool hasLocalStorage() const
Returns true if a variable with function scope is a non-static local variable.
NamespaceDecl * getAnonymousNamespace() const
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.
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...
bool isExplicitSpecified() const
Whether this function is marked as explicit explicitly.
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 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 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)
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)
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
chain_iterator chain_begin() const
llvm::iterator_range< param_iterator > param_range
bool isObjCForDecl() const
Determine whether this variable is a for-loop declaration for a for-in statement in Objective-C...
void setTypeSourceInfo(TypeSourceInfo *TI)
bool isStaticLocal() const
Returns true if a variable with function scope is a static local variable.
size_t param_size() const
const Expr * getUninstantiatedDefaultArg() const
TypeSourceInfo * getTypeSourceInfo() const
void setUsesSEHTry(bool UST)
static bool classof(const Decl *D)
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
ImplicitParamDecl * getParam(unsigned i) const
void setCXXForRangeDecl(bool FRD)
bool isParamDestroyedInCallee() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static bool classofKind(Kind K)
redeclarable_base::redecl_iterator redecl_iterator
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
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)
void setConstexpr(bool IC)
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
Provides information a specialization of a member of a class template, which may be a member function...
VarDecl * getDefinition()
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
bool hasExternalStorage() const
Returns true if a variable has extern or private_extern storage.
static bool classof(const Decl *D)
static bool classofKind(Kind K)
StringLiteral - This represents a string literal expression, e.g.
TLS with a known-constant initializer.
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Kind
Lists the kind of concrete classes of Decl.
bool blockMissingReturnType() const
static TagDecl * castFromDeclContext(const DeclContext *DC)
static Decl::Kind getKind(const Decl *D)
VarDeclBitfields VarDeclBits
The top declaration context.
bool isFunctionOrMethodVarDecl() const
Similar to isLocalVarDecl, but excludes variables declared in blocks.
static bool classofKind(Kind K)
static bool classof(const Decl *D)
const TagDecl * getCanonicalDecl() const
ArrayRef< ParmVarDecl * > parameters() const
NamedDecl * getMostRecentDecl()
Visibility getVisibility() const
Determines the visibility of this entity.
bool isDeleted() const
Whether this function has been deleted.
bool hasObjectMember() const
EnumConstantDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, Expr *E, const llvm::APSInt &V)
void setObjCDeclQualifier(ObjCDeclQualifier QTVal)
void setMSAsmLabelResolved()
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.
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.