14 #ifndef LLVM_CLANG_AST_DECL_H
15 #define LLVM_CLANG_AST_DECL_H
27 #include "llvm/ADT/ArrayRef.h"
28 #include "llvm/ADT/Optional.h"
29 #include "llvm/Support/Compiler.h"
30 #include "llvm/Support/raw_ostream.h"
31 #include "llvm/Support/TrailingObjects.h"
34 struct ASTTemplateArgumentListInfo;
37 class DependentFunctionTemplateSpecializationInfo;
39 class FunctionTemplateDecl;
40 class FunctionTemplateSpecializationInfo;
42 class MemberSpecializationInfo;
43 class NestedNameSpecifier;
47 class TemplateArgumentList;
48 class TemplateParameterList;
49 class TypeAliasTemplateDecl;
51 class UnresolvedSetImpl;
52 class VarTemplateDecl;
81 virtual void anchor();
112 virtual void anchor();
116 friend TrailingObjects;
122 :
Decl(PragmaComment, TU, CommentLoc), CommentKind(CommentKind) {}
134 StringRef
getArg()
const {
return getTrailingObjects<char>(); }
146 virtual void anchor();
150 friend TrailingObjects;
156 :
Decl(PragmaDetectMismatch, TU, Loc), ValueStart(ValueStart) {}
166 StringRef
getName()
const {
return getTrailingObjects<char>(); }
167 StringRef
getValue()
const {
return getTrailingObjects<char>() + ValueStart; }
192 virtual void anchor();
214 virtual void anchor();
221 NamedDecl *getUnderlyingDeclImpl() LLVM_READONLY;
225 :
Decl(DK, DC, L), Name(N) { }
238 assert(Name.
isIdentifier() &&
"Name is not a simple identifier");
254 virtual void printName(raw_ostream &os)
const;
284 bool Qualified)
const;
311 if (isa<EnumDecl>(DC))
379 if (this->
getKind() != UsingShadow &&
380 this->
getKind() != ConstructorUsingShadow &&
381 this->
getKind() != ObjCCompatibleAlias &&
382 this->
getKind() != NamespaceAlias)
385 return getUnderlyingDeclImpl();
415 void anchor()
override;
418 bool MSAsmNameResolved;
428 MSAsmNameResolved(
false),
474 llvm::PointerIntPair<NamespaceDecl *, 1, bool> AnonOrFirstNamespaceAndInline;
517 return AnonOrFirstNamespaceAndInline.getInt();
522 AnonOrFirstNamespaceAndInline.setInt(Inline);
581 void anchor()
override;
587 :
NamedDecl(DK, DC, L, N), DeclType(T) {}
643 llvm::PointerUnion<TypeSourceInfo*, ExtInfo*> DeclInfo;
649 bool hasExtInfo()
const {
return DeclInfo.is<ExtInfo*>(); }
650 ExtInfo *getExtInfo() {
return DeclInfo.get<ExtInfo*>(); }
651 const ExtInfo *getExtInfo()
const {
return DeclInfo.get<ExtInfo*>(); }
657 :
ValueDecl(DK, DC, L, N, T), DeclInfo(TInfo), InnerLocStart(StartL) {
663 ? getExtInfo()->TInfo
668 getExtInfo()->TInfo = TI;
690 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
698 return hasExtInfo() ? getExtInfo()->QualifierLoc
705 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
709 return getExtInfo()->TemplParamLists[index];
719 return K >= firstDeclarator && K <= lastDeclarator;
788 typedef llvm::PointerUnion<Stmt *, EvaluatedStmt *>
InitType;
795 class VarDeclBitfields {
800 unsigned TSCSpec : 2;
801 unsigned InitStyle : 2;
803 enum { NumVarDeclBits = 7 };
823 unsigned : NumVarDeclBits;
827 unsigned HasInheritedDefaultArg : 1;
836 unsigned IsKNRPromoted : 1;
839 unsigned IsObjCMethodParam : 1;
845 unsigned ScopeDepthOrObjCQuals : 7;
857 unsigned : NumVarDeclBits;
862 unsigned IsThisDeclarationADemotedDefinition : 1;
866 unsigned ExceptionVar : 1;
871 unsigned NRVOVariable : 1;
875 unsigned CXXForRangeDecl : 1;
879 unsigned ARCPseudoStrong : 1;
882 unsigned IsInline : 1;
885 unsigned IsInlineSpecified : 1;
888 unsigned IsConstexpr : 1;
892 unsigned IsInitCapture : 1;
897 unsigned PreviousDeclInSameBlockScope : 1;
901 unsigned ImplicitParamKind : 3;
954 assert(
VarDeclBits.TSCSpec == TSC &&
"truncation");
1038 return DC->getRedeclContext()->isFunctionOrMethod();
1122 if (K == ParmVar || K == ImplicitParam)
1215 return isa<ParmVarDecl>(
this) ?
false :
1226 assert (!isa<ParmVarDecl>(
this) &&
"Cannot demote ParmVarDecls!");
1236 assert(!isa<ParmVarDecl>(
this));
1254 assert(!isa<ParmVarDecl>(
this));
1264 assert(!isa<ParmVarDecl>(
this));
1276 assert(!isa<ParmVarDecl>(
this));
1285 return isa<ParmVarDecl>(
this) ?
false
1289 assert(!isa<ParmVarDecl>(
this));
1294 assert(!isa<ParmVarDecl>(
this));
1303 assert(!isa<ParmVarDecl>(
this));
1312 assert(!isa<ParmVarDecl>(
this));
1319 return isa<ParmVarDecl>(
this)
1324 assert(!isa<ParmVarDecl>(
this));
1383 void anchor()
override;
1410 :
VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
1443 :
VarDecl(DK, C, DC, StartLoc, IdLoc, Id, T, TInfo, S) {
1464 setParameterIndex(parameterIndex);
1474 setParameterIndex(parameterIndex);
1488 return getParameterIndex();
1589 void setParameterIndex(
unsigned parameterIndex) {
1590 if (parameterIndex >= ParameterIndexSentinel) {
1591 setParameterIndexLarge(parameterIndex);
1596 assert(
ParmVarDeclBits.ParameterIndex == parameterIndex &&
"truncation!");
1598 unsigned getParameterIndex()
const {
1600 return d == ParameterIndexSentinel ? getParameterIndexLarge() : d;
1603 void setParameterIndexLarge(
unsigned parameterIndex);
1604 unsigned getParameterIndexLarge()
const;
1627 TK_DependentFunctionTemplateSpecialization
1640 unsigned SClass : 3;
1641 unsigned IsInline : 1;
1642 unsigned IsInlineSpecified : 1;
1646 unsigned IsExplicitSpecified : 1;
1648 unsigned IsVirtualAsWritten : 1;
1649 unsigned IsPure : 1;
1650 unsigned HasInheritedPrototype : 1;
1651 unsigned HasWrittenPrototype : 1;
1652 unsigned IsDeleted : 1;
1653 unsigned IsTrivial : 1;
1654 unsigned IsDefaulted : 1;
1655 unsigned IsExplicitlyDefaulted : 1;
1656 unsigned HasImplicitReturnZero : 1;
1657 unsigned IsLateTemplateParsed : 1;
1658 unsigned IsConstexpr : 1;
1659 unsigned InstantiationIsPending:1;
1662 unsigned UsesSEHTry : 1;
1666 unsigned HasSkippedBody : 1;
1670 unsigned WillHaveBody : 1;
1697 TemplateOrSpecialization;
1724 void setFunctionTemplateSpecialization(
ASTContext &C,
1743 bool isConstexprSpecified)
1747 SClass(S), IsInline(isInlineSpecified),
1748 IsInlineSpecified(isInlineSpecified), IsExplicitSpecified(
false),
1750 HasInheritedPrototype(
false), HasWrittenPrototype(
true),
1752 IsExplicitlyDefaulted(
false), HasImplicitReturnZero(
false),
1753 IsLateTemplateParsed(
false), IsConstexpr(isConstexprSpecified),
1754 InstantiationIsPending(
false),
1756 EndRangeLoc(NameInfo.getEndLoc()), TemplateOrSpecialization(),
1786 bool hasWrittenPrototype =
true,
1787 bool isConstexprSpecified =
false) {
1792 isConstexprSpecified);
1801 bool hasWrittenPrototype,
1802 bool isConstexprSpecified =
false);
1811 bool Qualified)
const override;
1831 bool hasTrivialBody()
const;
1840 return isDefined(Definition);
1846 if (isDefined(Definition))
1875 return IsDeleted || IsDefaulted || Body || IsLateTemplateParsed ||
1883 return Body || IsLateTemplateParsed;
1886 void setBody(
Stmt *B);
1890 bool isVariadic()
const;
1899 void setPure(
bool P =
true);
1933 return HasWrittenPrototype || HasInheritedPrototype;
1985 bool isMain()
const;
1989 bool isMSVCRTEntryPoint()
const;
2004 bool isReservedGlobalPlacementOperator()
const;
2024 bool isReplaceableGlobalAllocationFunction(
bool *IsAligned =
nullptr)
const;
2042 bool isGlobal()
const;
2046 bool isNoReturn()
const;
2063 unsigned getBuiltinID()
const;
2067 return {ParamInfo, getNumParams()};
2070 return {ParamInfo, getNumParams()};
2086 unsigned getNumParams()
const;
2089 assert(i < getNumParams() &&
"Illegal param #");
2090 return ParamInfo[i];
2093 assert(i < getNumParams() &&
"Illegal param #");
2094 return ParamInfo[i];
2104 unsigned getMinRequiredArguments()
const;
2107 assert(
getType()->getAs<FunctionType>() &&
"Expected a FunctionType!");
2122 assert(
getType()->getAs<FunctionType>() &&
"Expected a FunctionType!");
2128 const Attr *getUnusedResultAttr()
const;
2144 IsInlineSpecified =
I;
2158 bool isInlineDefinitionExternallyVisible()
const;
2160 bool isMSExternInline()
const;
2162 bool doesDeclarationForceExternallyVisibleDefinition()
const;
2167 return getOverloadedOperator() !=
OO_None;
2195 FunctionDecl *getInstantiatedFromMemberFunction()
const;
2198 TemplatedKind getTemplatedKind()
const;
2231 return getPrimaryTemplate() !=
nullptr;
2236 FunctionDecl *getClassScopeSpecializationPattern()
const;
2246 bool isImplicitlyInstantiable()
const;
2279 getTemplateSpecializationArgsAsWritten()
const;
2306 setFunctionTemplateSpecialization(
getASTContext(), Template, TemplateArgs,
2307 InsertPos, TSK, TemplateArgsAsWritten,
2308 PointOfInstantiation);
2318 getDependentSpecializationInfo()
const;
2345 unsigned getMemoryFunctionKind()
const;
2350 return K >= firstFunction && K <= lastFunction;
2368 unsigned Mutable : 1;
2369 mutable unsigned CachedFieldIndex : 31;
2375 enum InitStorageKind {
2391 ISK_CapturedVLAType,
2405 llvm::PointerIntPair<void *, 2, InitStorageKind> InitStorage;
2412 Mutable(Mutable), CachedFieldIndex(0),
2413 InitStorage(BW, (InitStorageKind) InitStyle) {
2414 assert((!BW || InitStyle ==
ICIS_NoInit) &&
"got initializer for bitfield");
2435 return InitStorage.getInt() == ISK_BitWidthOrNothing &&
2436 InitStorage.getPointer() !=
nullptr;
2446 bool isAnonymousStructOrUnion()
const;
2450 ?
static_cast<Expr *
>(InitStorage.getPointer())
2453 unsigned getBitWidthValue(
const ASTContext &Ctx)
const;
2458 assert(InitStorage.getInt() == ISK_BitWidthOrNothing &&
2459 InitStorage.getPointer() ==
nullptr &&
2460 "bit width, initializer or captured type already set");
2461 InitStorage.setPointerAndInt(Width, ISK_BitWidthOrNothing);
2467 assert(isBitField() &&
"no bitfield width to remove");
2468 InitStorage.setPointerAndInt(
nullptr, ISK_BitWidthOrNothing);
2474 InitStorageKind storageKind = InitStorage.getInt();
2475 return (storageKind == ISK_CapturedVLAType
2490 return hasInClassInitializer()
2491 ?
static_cast<Expr *
>(InitStorage.getPointer())
2498 assert(hasInClassInitializer() &&
2499 InitStorage.getPointer() ==
nullptr &&
2500 "bit width, initializer or captured type already set");
2501 InitStorage.setPointer(Init);
2507 assert(hasInClassInitializer() &&
"no initializer to remove");
2508 InitStorage.setPointerAndInt(
nullptr, ISK_BitWidthOrNothing);
2514 return InitStorage.getInt() == ISK_CapturedVLAType;
2520 InitStorage.getPointer())
2560 const llvm::APSInt &V)
2568 const llvm::APSInt &V);
2596 void anchor()
override;
2598 unsigned ChainingSize;
2614 return llvm::makeArrayRef(Chaining, ChainingSize);
2622 assert(chain().size() >= 2);
2623 return cast<FieldDecl>(chain().back());
2627 assert(chain().size() >= 2);
2628 return dyn_cast<
VarDecl>(chain().front());
2643 void anchor()
override;
2648 mutable const Type *TypeForDecl;
2656 :
NamedDecl(DK, DC, L, Id), TypeForDecl(nullptr), LocStart(StartL) {}
2669 if (LocStart.isValid())
2683 void anchor()
override;
2684 typedef std::pair<TypeSourceInfo*, QualType> ModedTInfo;
2685 llvm::PointerUnion<TypeSourceInfo*, ModedTInfo*> MaybeModedTInfo;
2690 mutable unsigned CacheIsTransparentTag : 2;
2697 MaybeModedTInfo(TInfo), CacheIsTransparentTag(0) {}
2720 bool isModed()
const {
return MaybeModedTInfo.is<ModedTInfo*>(); }
2724 ? MaybeModedTInfo.get<ModedTInfo*>()->first
2729 ? MaybeModedTInfo.get<ModedTInfo*>()->second
2733 MaybeModedTInfo = newType;
2736 MaybeModedTInfo =
new (
getASTContext()) ModedTInfo(unmodedTSI, modedTy);
2748 TagDecl *getAnonDeclWithTypedefName(
bool AnyRedecl =
false)
const;
2753 if (CacheIsTransparentTag)
2754 return CacheIsTransparentTag & 0x2;
2755 return isTransparentTagSlow();
2761 return K >= firstTypedefName && K <= lastTypedefName;
2765 bool isTransparentTagSlow()
const;
2797 Template(
nullptr) {}
2825 unsigned TagDeclKind : 3;
2830 unsigned IsCompleteDefinition : 1;
2834 unsigned IsBeingDefined : 1;
2840 unsigned IsEmbeddedInDeclarator : 1;
2843 unsigned IsFreeStanding : 1;
2847 unsigned NumPositiveBits : 8;
2848 unsigned NumNegativeBits : 8;
2852 unsigned IsScoped : 1;
2857 unsigned IsScopedUsingClassTag : 1;
2861 unsigned IsFixed : 1;
2867 unsigned MayHaveOutOfDateDef : 1;
2871 unsigned IsCompleteDefinitionRequired : 1;
2887 llvm::PointerUnion<TypedefNameDecl *, ExtInfo *> TypedefNameDeclOrQualifier;
2889 bool hasExtInfo()
const {
return TypedefNameDeclOrQualifier.is<
ExtInfo *>(); }
2890 ExtInfo *getExtInfo() {
return TypedefNameDeclOrQualifier.get<ExtInfo *>(); }
2891 const ExtInfo *getExtInfo()
const {
2892 return TypedefNameDeclOrQualifier.get<ExtInfo *>();
2900 TagDeclKind(TK), IsCompleteDefinition(
false), IsBeingDefined(
false),
2901 IsEmbeddedInDeclarator(
false), IsFreeStanding(
false),
2902 IsCompleteDefinitionRequired(
false),
2904 assert((DK != Enum || TK ==
TTK_Enum) &&
2905 "EnumDecl not matched with TTK_Enum");
2923 void completeDefinition();
2955 return isCompleteDefinition();
2961 return IsCompleteDefinition;
2967 return IsCompleteDefinitionRequired;
2972 return IsBeingDefined;
2976 return IsEmbeddedInDeclarator;
2979 IsEmbeddedInDeclarator = isInDeclarator;
2984 IsFreeStanding = isFreeStanding;
2997 void startDefinition();
3012 IsCompleteDefinitionRequired = V;
3047 return (
getDeclName() || getTypedefNameForAnonDecl());
3051 return hasExtInfo() ?
nullptr
3060 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
3068 return hasExtInfo() ? getExtInfo()->QualifierLoc
3075 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
3079 return getExtInfo()->TemplParamLists[i];
3103 void anchor()
override;
3119 llvm::PointerUnion<const Type*, TypeSourceInfo*> IntegerType;
3134 bool Scoped,
bool ScopedUsingClassTag,
bool Fixed)
3136 SpecializationInfo(
nullptr) {
3137 assert(Scoped || !ScopedUsingClassTag);
3138 IntegerType = (
const Type *)
nullptr;
3139 NumNegativeBits = 0;
3140 NumPositiveBits = 0;
3142 IsScopedUsingClassTag = ScopedUsingClassTag;
3157 return cast_or_null<EnumDecl>(
3178 bool IsScoped,
bool IsScopedUsingClassTag,
3187 void completeDefinition(
QualType NewType,
3189 unsigned NumPositiveBits,
3190 unsigned NumNegativeBits);
3195 typedef llvm::iterator_range<specific_decl_iterator<EnumConstantDecl>>
3229 if (
const Type *T = IntegerType.dyn_cast<
const Type*>())
3248 SourceRange getIntegerTypeRange() const LLVM_READONLY;
3252 unsigned getNumPositiveBits()
const {
3253 return NumPositiveBits;
3256 NumPositiveBits = Num;
3257 assert(NumPositiveBits == Num &&
"can't store this bitcount");
3270 return NumNegativeBits;
3273 NumNegativeBits = Num;
3283 return IsScopedUsingClassTag;
3294 return isCompleteDefinition() || isFixed();
3299 bool isClosed()
const;
3303 bool isClosedFlag()
const;
3307 bool isClosedNonFlag()
const;
3316 EnumDecl *getInstantiatedFromMemberEnum()
const;
3332 return SpecializationInfo;
3359 bool HasFlexibleArrayMember : 1;
3363 bool AnonymousStructOrUnion : 1;
3367 bool HasObjectMember : 1;
3371 bool HasVolatileMember : 1;
3377 mutable bool LoadedFieldsFromExternalStorage : 1;
3392 return cast_or_null<RecordDecl>(
3423 AnonymousStructOrUnion = Anon;
3433 return LoadedFieldsFromExternalStorage;
3436 LoadedFieldsFromExternalStorage = val;
3452 bool isInjectedClassName()
const;
3456 bool isLambda()
const;
3460 bool isCapturedRecord()
const;
3463 void setCapturedRecord();
3481 typedef llvm::iterator_range<specific_decl_iterator<FieldDecl>>
field_range;
3484 field_iterator field_begin()
const;
3493 return field_begin() == field_end();
3498 virtual void completeDefinition();
3502 return K >= firstRecord && K <= lastRecord;
3513 bool mayInsertExtraPadding(
bool EmitRemark =
false)
const;
3517 const FieldDecl *findFirstNamedDataMember()
const;
3521 void LoadFieldsFromExternalStorage()
const;
3525 virtual void anchor();
3530 :
Decl(FileScopeAsm, DC, StartL), AsmString(asmstring), RParenLoc(EndL) {}
3568 llvm::PointerIntPair<VarDecl*, 2> VariableAndFlags;
3577 : VariableAndFlags(variable,
3578 (byRef ? flag_isByRef : 0) | (nested ? flag_isNested : 0)),
3586 bool isByRef()
const {
return VariableAndFlags.getInt() & flag_isByRef; }
3590 bool isNested()
const {
return VariableAndFlags.getInt() & flag_isNested; }
3599 bool IsVariadic : 1;
3600 bool CapturesCXXThis : 1;
3601 bool BlockMissingReturnType : 1;
3602 bool IsConversionFromLambda : 1;
3612 const Capture *Captures;
3613 unsigned NumCaptures;
3615 unsigned ManglingNumber;
3616 Decl *ManglingContextDecl;
3622 BlockMissingReturnType(
true), IsConversionFromLambda(
false),
3623 ParamInfo(nullptr), NumParams(0), Body(nullptr),
3624 SignatureAsWritten(nullptr), Captures(nullptr), NumCaptures(0),
3625 ManglingNumber(0), ManglingContextDecl(nullptr) {}
3645 return {ParamInfo, getNumParams()};
3648 return {ParamInfo, getNumParams()};
3663 assert(i < getNumParams() &&
"Illegal param #");
3664 return ParamInfo[i];
3667 assert(i < getNumParams() &&
"Illegal param #");
3668 return ParamInfo[i];
3674 bool hasCaptures()
const {
return NumCaptures != 0 || CapturesCXXThis; }
3694 bool capturesVariable(
const VarDecl *var)
const;
3697 bool CapturesCXXThis);
3700 return ManglingNumber;
3703 return ManglingContextDecl;
3707 ManglingNumber = Number;
3708 ManglingContextDecl = Ctx;
3739 unsigned ContextParam;
3741 llvm::PointerIntPair<Stmt *, 1, bool> BodyAndNothrow;
3746 return getTrailingObjects<ImplicitParamDecl *>();
3749 ImplicitParamDecl **getParams() {
3750 return getTrailingObjects<ImplicitParamDecl *>();
3755 unsigned NumParams);
3757 unsigned NumParams);
3759 Stmt *
getBody()
const override;
3760 void setBody(Stmt *B);
3762 bool isNothrow()
const;
3763 void setNothrow(
bool Nothrow =
true);
3768 assert(i < NumParams);
3769 return getParams()[i];
3772 assert(i < NumParams);
3778 return {getParams(), getNumParams()};
3781 return {getParams(), getNumParams()};
3786 assert(ContextParam < NumParams);
3787 return getParam(ContextParam);
3790 assert(i < NumParams);
3837 llvm::PointerIntPair<Module *, 1, bool> ImportedAndComplete;
3870 unsigned NumLocations);
3895 virtual void anchor();
3916 if (RBraceLoc.isValid())
3920 return decls_empty() ?
getLocation() : decls_begin()->getLocEnd();
3939 virtual void anchor();
3941 :
Decl(Empty, DC, L) { }
3967 template<
typename decl_type>
3972 "setPreviousDecl on a decl already in a redeclaration chain");
3986 MostRecent->getIdentifierNamespace() &
3990 First =
static_cast<decl_type*
>(
this);
3996 assert(!isa<NamedDecl>(static_cast<decl_type*>(
this)) ||
3997 cast<NamedDecl>(static_cast<decl_type*>(
this))->
isLinkageValid());
static bool classof(const Decl *D)
static bool classofKind(Kind K)
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
void setHasSkippedBody(bool Skipped=true)
llvm::iterator_range< specific_decl_iterator< FieldDecl > > field_range
FunctionDecl * getDefinition()
Get the definition for this declaration.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
void setOwningFunction(DeclContext *FD)
setOwningFunction - Sets the function declaration that owns this ParmVarDecl.
static unsigned getFieldIndex(Decl *F)
void setImplicit(bool I=true)
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
Parameter for captured context.
static bool classof(const Decl *D)
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
static DeclContext * castToDeclContext(const ExternCContextDecl *D)
void setAnonymousStructOrUnion(bool Anon)
A class which contains all the information about a particular captured value.
ArrayRef< NamedDecl * >::const_iterator chain_iterator
APValue * evaluateValue() const
Attempt to evaluate the value of the initializer attached to this declaration, and produce notes expl...
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
A (possibly-)qualified type.
ArrayRef< Capture > captures() const
static bool classofKind(Kind K)
param_const_iterator param_end() const
bool isBitField() const
Determines whether this field is a bitfield.
bool isByRef() const
Whether this is a "by ref" capture, i.e.
StringRef getMSAsmLabel() const
QualType getCallResultType() const
Determine the type of an expression that calls this function.
bool hasLinkageBeenComputed() const
True if something has required us to compute the linkage of this declaration.
static bool classofKind(Kind K)
static VarDecl * CreateDeserialized(ASTContext &C, unsigned ID)
QualifierInfo()
Default constructor.
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
static TranslationUnitDecl * castFromDeclContext(const DeclContext *DC)
bool hasDefaultArg() const
hasDefaultArg - Determines whether this parameter has a default argument, either parsed or not...
bool IsEnumDeclScoped(EnumDecl *ED)
Check if the given decl is scoped.
static bool classofKind(Kind K)
Stmt - This represents one statement.
param_const_iterator param_begin() const
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
bool hasDefiningAttr() const
Return true if this declaration has an attribute which acts as definition of the entity, such as 'alias' or 'ifunc'.
bool isInitICE() const
Determines whether the initializer is an integral constant expression, or in C++11, whether the initializer is a constant expression.
void setPreviousDecl(VarDecl *PrevDecl)
Set the previous declaration.
FunctionType - C99 6.7.5.3 - Function Declarators.
TagDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, TagDecl *PrevDecl, SourceLocation StartL)
bool IsICE
Whether this statement is an integral constant expression, or in C++11, whether the statement is a co...
const Expr * getInitExpr() const
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
void setEmbeddedInDeclarator(bool isInDeclarator)
redeclarable_base::redecl_range redecl_range
TypedefDecl - Represents the declaration of a typedef-name via the 'typedef' type specifier...
CompoundStmt * getCompoundBody() const
C Language Family Type Representation.
void setParam(unsigned i, ImplicitParamDecl *P)
bool IsEvaluating
Whether this statement is being evaluated.
Expr * getCopyExpr() const
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
QualType getUnderlyingType() const
Defines the clang::Module class, which describes a module in the source code.
DeclaratorDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL)
redeclarable_base::redecl_iterator redecl_iterator
Decl - This represents one declaration (or definition), e.g.
void setRangeEnd(SourceLocation E)
EnumDecl * getPreviousDecl()
const VariableArrayType * getCapturedVLAType() const
Get the captured variable length array type.
param_iterator param_end()
NamedDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N)
Parameter for Objective-C '_cmd' argument.
const RecordDecl * getMostRecentDecl() const
bool hasFlexibleArrayMember() const
bool hasUnusedResultAttr() const
Returns true if this function or its return type has the warn_unused_result attribute.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization...
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)
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier.
The base class of the type hierarchy.
Represents an empty-declaration.
void setCopyExpr(Expr *e)
enumerator_iterator enumerator_end() const
bool hasLinkage() const
Determine whether this declaration has linkage.
const EnumDecl * getMostRecentDecl() const
Declaration of a variable template.
const Expr * getInit() const
NamespaceDecl - Represent a C++ namespace.
ObjCDeclQualifier getObjCDeclQualifier() const
Redeclarable< TagDecl > redeclarable_base
A container of type source information.
StorageDuration
The storage duration for an object (per C++ [basic.stc]).
StringLiteral * getAsmString()
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists...
bool CheckingICE
Whether we are checking whether this statement is an integral constant expression.
enumerator_iterator enumerator_begin() const
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of this declaration, if it was present in ...
SourceLocation getLocEnd() const LLVM_READONLY
void setInitStyle(InitializationStyle Style)
redeclarable_base::redecl_iterator redecl_iterator
Expr * getInClassInitializer() const
getInClassInitializer - Get the C++11 in-class initializer for this member, or null if one has not be...
InClassInitStyle getInClassInitStyle() const
getInClassInitStyle - Get the kind of (C++11) in-class initializer which this field has...
const VarDecl * getDefinition() const
static CapturedDecl * castFromDeclContext(const DeclContext *DC)
bool hasLoadedFieldsFromExternalStorage() const
VarDecl * getMostRecentDeclImpl() override
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
ExplicitVisibilityKind
Kinds of explicit visibility.
bool isUsableInConstantExpressions(ASTContext &C) const
Determine whether this variable's value can be used in a constant expression, according to the releva...
VarDecl - An instance of this class is created to represent a variable declaration or definition...
bool isFileVarDecl() const
isFileVarDecl - Returns true for file scoped variable declaration.
bool WasEvaluated
Whether this statement was already evaluated.
bool capturesCXXThis() const
RecordDecl * getPreviousDecl()
unsigned getBlockManglingNumber() const
bool isInlineSpecified() const
const FunctionDecl * getDefinition() const
TLSKind getTLSKind() const
static bool classofKind(Kind K)
bool hasCaptures() const
hasCaptures - True if this block (or its nested blocks) captures anything of local storage from its e...
size_t numTrailingObjects(OverloadToken< ImplicitParamDecl >)
Declaration context for names declared as extern "C" in C++.
The "__interface" keyword.
Parameter for Objective-C 'self' argument.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
bool hasGlobalStorage() const
Returns true for all variables that do not have local storage.
NamespaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this namespace.
const TypedefNameDecl * getCanonicalDecl() const
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.
static StringRef getTagTypeKindName(TagTypeKind Kind)
static bool classof(const Decl *D)
Visibility getVisibility() const
Determines the visibility of this entity.
NamespaceDecl * getAnonymousNamespace() const
Describes how types, statements, expressions, and declarations should be printed. ...
decl_iterator decls_end() const
static DeclContext * castToDeclContext(const ExportDecl *D)
ParmVarDecl - Represents a parameter to a function.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
llvm::PointerUnion< Stmt *, EvaluatedStmt * > InitType
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
Provides information about a dependent function-template specialization declaration.
MutableArrayRef< ParmVarDecl * > parameters()
EvaluatedStmt * ensureEvaluatedStmt() const
Convert the initializer for this declaration to the elaborated EvaluatedStmt form, which contains extra information on the evaluated value of the initializer.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
bool hasExternalFormalLinkage() const
True if this decl has external linkage.
Types, declared with 'struct foo', typedefs, etc.
Base wrapper for a particular "section" of type source info.
LabelStmt - Represents a label, which has a substatement.
RecordDecl - Represents a struct/union/class.
Visibility getVisibility() const
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
bool hasUninstantiatedDefaultArg() const
Provides common interface for the Decls that can be redeclared.
FunctionDecl * getPreviousDeclImpl() override
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain...
static bool classofKind(Kind K)
One of these records is kept for each identifier that is lexed.
void setIntegerType(QualType T)
Set the underlying integer type.
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
static bool classofKind(Kind K)
Defines the Linkage enumeration and various utility functions.
static bool classof(const Decl *D)
redeclarable_base::redecl_iterator redecl_iterator
void setCompleteDefinition(bool V)
void setUninstantiatedDefaultArg(Expr *arg)
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 CheckedICE
Whether we already checked whether this statement was an integral constant expression.
SourceLocation getPointOfInstantiation() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
static bool classof(const Decl *D)
bool isIdentifier() const
Predicate functions for querying what type of name this is.
QualType getReturnType() const
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
void setBlockMissingReturnType(bool val)
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
Parameter for C++ 'this' argument.
void setLocStart(SourceLocation L)
bool isAnonymousNamespace() const
Returns true if this is an anonymous namespace declaration.
bool declarationReplaces(NamedDecl *OldD, bool IsKnownNewer=true) const
Determine whether this declaration, if known to be well-formed within its context, will replace the declaration OldD if introduced into scope.
const EnumDecl * getCanonicalDecl() const
bool isPure() const
Whether this virtual function is pure, i.e.
static DeclContext * castToDeclContext(const FunctionDecl *D)
redecl_iterator redecls_begin() const
ImplicitParamDecl(ASTContext &C, QualType Type, ImplicitParamKind ParamKind)
TagKind getTagKind() const
bool isPreviousDeclInSameBlockScope() const
Whether this local extern variable declaration's previous declaration was declared in the same block ...
void overrideType(QualType T)
Override the type stored in this TypeSourceInfo. Use with caution!
Linkage getFormalLinkage(Linkage L)
This declaration is definitely a definition.
static bool classofKind(Kind K)
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
void setNumPositiveBits(unsigned Num)
llvm::iterator_range< param_iterator > param_range
unsigned getNumCaptures() const
getNumCaptures - Returns the number of captured variables.
TypedefNameDecl * getNextRedeclarationImpl() override
Returns the next redeclaration or itself if this is the only decl.
static NamespaceDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Describes a module or submodule.
bool isThisDeclarationADefinition() const
isThisDeclarationADefinition() - Return true if this declaration is a completion definition of the ty...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
bool hasExternalStorage() const
Returns true if a variable has extern or private_extern storage.
static bool classofKind(Kind K)
virtual void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const
getNameForDiagnostic - Appends a human-readable name for this declaration into the given stream...
bool isLinkageValid() const
True if the computed linkage is valid.
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.
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted per C++0x.
VarDecl * getActingDefinition()
Get the tentative definition that acts as the real definition in a TU.
ImplicitParamDecl * getParam(unsigned i) const
static NamespaceDecl * castFromDeclContext(const DeclContext *DC)
TemplateParameterList ** TemplParamLists
TemplParamLists - A new-allocated array of size NumTemplParamLists, containing pointers to the "outer...
InitializationStyle
Initialization styles.
static bool classof(const Decl *D)
VarDecl * getNextRedeclaration() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
TypeDecl(Kind DK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, SourceLocation StartL=SourceLocation())
QualType getOriginalType() const
bool isInline() const
Returns true if this is an inline namespace declaration.
static ExternCContextDecl * Create(const ASTContext &C, TranslationUnitDecl *TU)
DeclLink RedeclLink
Points to the next redeclaration in the chain.
SourceLocation getRBraceLoc() const
A convenient class for passing around template argument information.
bool isLocalVarDeclOrParm() const
Similar to isLocalVarDecl but also includes parameters.
ImplicitParamKind getParameterKind() const
Returns the implicit parameter kind.
virtual void printName(raw_ostream &os) const
bool isFunctionOrMethodVarDecl() const
isFunctionOrMethodVarDecl - Similar to isLocalVarDecl, but excludes variables declared in blocks...
Parameter for C++ virtual table pointers.
bool isDefaulted() const
Whether this function is defaulted per C++0x.
bool isExternC() const
Determines whether this variable is a variable with external, C linkage.
Visibility
Describes the different kinds of visibility that a declaration may have.
field_range fields() const
VarDecl * getVarDecl() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
TypeDecl - Represents a declaration of a type.
void setHasObjectMember(bool val)
bool isInitKnownICE() const
Determines whether it is already known whether the initializer is an integral constant expression or ...
A set of unresolved declarations.
bool hasCapturedVLAType() const
Determine whether this member captures the variable length array type.
void setHasImplicitReturnZero(bool IRZ)
void setExceptionVariable(bool EV)
bool isOverloadedOperator() const
isOverloadedOperator - Whether this function declaration represents an C++ overloaded operator...
std::string getNameAsString() const
getNameAsString - Get a human-readable name for the declaration, even if it is one of the special kin...
LabelStmt * getStmt() const
chain_iterator chain_begin() const
static bool classof(const Decl *D)
FunctionDecl * getMostRecentDeclImpl() override
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
static BlockDecl * castFromDeclContext(const DeclContext *DC)
TagDecl * getPreviousDeclImpl() override
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain...
bool isWeak() const
Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr...
static bool classof(const Decl *D)
TypedefNameDecl * getPreviousDeclImpl() override
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain...
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
std::string getAsString() const
getNameAsString - Retrieve the human-readable string for this name.
void setNumNegativeBits(unsigned Num)
bool isStaticLocal() const
isStaticLocal - Returns true if a variable with function scope is a static local variable.
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
static bool classofKind(Kind K)
bool isThisDeclarationADemotedDefinition() const
If this definition should pretend to be a declaration.
void setTemplateParameterListsInfo(ASTContext &Context, ArrayRef< TemplateParameterList * > TPLists)
This represents the body of a CapturedStmt, and serves as its DeclContext.
static ParmVarDecl * CreateDeserialized(ASTContext &C, unsigned ID)
decl_iterator decls_begin() const
const EnumConstantDecl * getCanonicalDecl() const
detail::InMemoryDirectory::const_iterator I
size_t param_size() const
void setInitVal(const llvm::APSInt &V)
void setInitExpr(Expr *E)
void setStmt(LabelStmt *T)
void setLocStart(SourceLocation L)
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInlineSpecified=false, bool hasWrittenPrototype=true, bool isConstexprSpecified=false)
SourceLocation getLocEnd() const LLVM_READONLY
bool isUnnamedBitfield() const
Determines whether this is an unnamed bitfield.
VarDecl * getPreviousDeclImpl() override
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain...
param_iterator param_begin()
void setHasInheritedPrototype(bool P=true)
field_iterator field_end() const
bool hasPrototype() const
Whether this function has a prototype, either because one was explicitly written or because it was "i...
VarDecl * getTemplateInstantiationPattern() const
Retrieve the variable declaration from which this variable could be instantiated, if it is an instant...
static bool classof(const Decl *D)
static bool classof(const Decl *D)
void removeInClassInitializer()
removeInClassInitializer - Remove the C++11 in-class initializer from this member.
void setInline(bool Inline)
Set whether this is an inline namespace declaration.
bool isKNRPromoted() const
True if the value passed to this parameter must undergo K&R-style default argument promotion: ...
unsigned getNumParams() const
static ImplicitParamDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, ImplicitParamKind ParamKind)
Create implicit parameter.
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
ArrayRef< ParmVarDecl * >::const_iterator param_const_iterator
llvm::iterator_range< redecl_iterator > redecl_range
void setLazyBody(uint64_t Offset)
bool isExternalFormalLinkage(Linkage L)
RecordDecl * getMostRecentDecl()
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x alias-declaration.
A little helper class used to produce diagnostics.
CompoundStmt - This represents a group of statements like { stmt stmt }.
void setHasLoadedFieldsFromExternalStorage(bool val)
unsigned NumTemplParamLists
NumTemplParamLists - The number of "outer" template parameter lists.
bool isConversionFromLambda() const
static bool classof(const Decl *D)
static bool classofKind(Kind K)
SourceLocation getLocStart() const LLVM_READONLY
bool isParameterPack() const
Determine whether this parameter is actually a function parameter pack.
Represents a ValueDecl that came out of a declarator.
FieldDecl * getAnonField() const
unsigned getChainingSize() const
SourceLocation getTypeSpecStartLoc() const
SourceLocation getInnerLocStart() const
getInnerLocStart - Return SourceLocation representing start of source range ignoring outer template d...
bool usesSEHTry() const
Indicates the function uses __try.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization, retrieves the member specialization information.
bool isCXXInstanceMember() const
Determine whether the given declaration is an instance member of a C++ class.
Redeclarable< TypedefNameDecl > redeclarable_base
StorageClass getStorageClass() const
Returns the storage class as written in the source.
static bool classof(const Decl *D)
void setInClassInitializer(Expr *Init)
setInClassInitializer - Set the C++11 in-class initializer for this member.
bool isCXXClassMember() const
Determine whether this declaration is a C++ class member.
FieldDecl(Kind DK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
static bool classof(const Decl *D)
Stmt ** getInitAddress()
Retrieve the address of the initializer expression.
TypedefNameDecl * getMostRecentDeclImpl() override
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
bool isDeleted() const
Whether this function has been deleted.
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
const Type * getTypeForDecl() const
const Type * getTypePtrOrNull() const
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
bool isDirectInit() const
Whether the initializer is a direct-initializer (list or call).
TypedefNameDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
StringRef getName() const
Return the actual identifier string.
const EnumDecl * getPreviousDecl() const
void setBitWidth(Expr *Width)
setBitWidth - Set the bit-field width for this member.
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
static bool classofKind(Kind K)
static bool classof(const Decl *D)
bool isDeletedAsWritten() const
VarDecl * getVariable() const
The variable being captured.
const NamedDecl * getMostRecentDecl() const
const NamedDecl * getUnderlyingDecl() const
Expr * getBitWidth() const
ArrayRef< NamedDecl * > chain() const
void setRBraceLoc(SourceLocation L)
void setContextParam(unsigned i, ImplicitParamDecl *P)
capture_const_iterator capture_begin() const
Defines an enumeration for C++ overloaded operators.
const ParmVarDecl * getParamDecl(unsigned i) const
static DeclLink PreviousDeclLink(VarDecl *D)
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
DeclContext * getDeclContext()
Redeclarable< VarDecl > redeclarable_base
static bool classofKind(Kind K)
This declaration is a tentative definition.
unsigned getContextParamPosition() const
static bool classof(const Decl *D)
void setCompleteDefinitionRequired(bool V=true)
bool isMSAsmLabel() const
bool isInExternCContext() const
Determines whether this variable's context is, or is nested within, a C++ extern "C" linkage spec...
EnumDecl * getMostRecentDecl()
bool isTransparentTag() const
Determines if this typedef shares a name and spelling location with its underlying tag type...
const FieldDecl * getCanonicalDecl() const
void setLateTemplateParsed(bool ILT=true)
SourceRange getDefaultArgRange() const
Retrieve the source range that covers the entire default argument.
void setLocStart(SourceLocation L)
static DeclContext * castToDeclContext(const CapturedDecl *D)
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
bool isObjCMethodParameter() const
MutableArrayRef< ParmVarDecl * > parameters()
void setModulePrivate()
Specify that this declaration was marked as being private to the module in which it was defined...
void setConstexpr(bool IC)
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
StorageClass
Storage classes.
SourceLocation getRParenLoc() const
bool isExceptionVariable() const
Determine whether this variable is the exception variable in a C++ catch statememt or an Objective-C ...
Direct list-initialization (C++11)
bool isFunctionOrMethod() const
InClassInitStyle
In-class initialization styles for non-static data members.
Declaration of an alias template.
bool isExternallyVisible(Linkage L)
SourceLocation getExportLoc() const
bool isExternallyVisible() const
void setModedTypeSourceInfo(TypeSourceInfo *unmodedTSI, QualType modedTy)
param_const_iterator param_end() const
void setParams(ArrayRef< ParmVarDecl * > NewParamInfo)
ArrayRef< ParmVarDecl * > parameters() const
specific_decl_iterator< FieldDecl > field_iterator
static bool classof(const Decl *D)
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
TagDecl * getMostRecentDeclImpl() override
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
TagDecl * getDefinition() const
getDefinition - Returns the TagDecl that actually defines this struct/union/class/enum.
static DeclContext * castToDeclContext(const NamespaceDecl *D)
Linkage getFormalLinkage() const
Get the linkage from a semantic point of view.
void setStorageClass(StorageClass SC)
ObjCStringFormatFamily getObjCFStringFormattingFamily() const
This template specialization was implicitly instantiated from a template.
bool hasNameForLinkage() const
Is this tag type named, either directly or via being defined in a typedef of this type...
const VarDecl * getCanonicalDecl() const
RecordDecl * getDefinition() const
getDefinition - Returns the RecordDecl that actually defines this struct/union/class.
bool hasInheritedPrototype() const
Whether this function inherited its prototype from a previous declaration.
bool checkInitIsICE() const
Determine whether the value of the initializer attached to this declaration is an integral constant e...
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...
TypeSourceInfo * getTypeSourceInfo() const
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
TypedefNameDecl * getTypedefNameForAnonDecl() const
VarDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
static bool classofKind(Kind K)
static bool classof(const Decl *D)
const Expr * getAnyInitializer() const
getAnyInitializer - Get the initializer for this variable, no matter which declaration it is attached...
Optional< Visibility > getExplicitVisibility(ExplicitVisibilityKind kind) const
If visibility was explicitly specified for this declaration, return that visibility.
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
VarDecl * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
const ParmVarDecl * getParamDecl(unsigned i) const
bool instantiationIsPending() const
Whether the instantiation of this function is pending.
param_iterator param_begin()
bool isEmbeddedInDeclarator() const
void setIsVariadic(bool value)
BlockDecl(DeclContext *DC, SourceLocation CaretLoc)
static PragmaDetectMismatchDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NameValueSize)
void setTypeForDecl(const Type *TD)
static bool classof(const Decl *D)
Represents a C++ Modules TS module export declaration.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool doesThisDeclarationHaveABody() const
doesThisDeclarationHaveABody - Returns whether this specific declaration of the function has a body -...
QualifierInfo - A struct with extended info about a syntactic name qualifier, to be used for the case...
static bool classofKind(Kind K)
StringRef getValue() const
ArrayRef< Capture >::const_iterator capture_const_iterator
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
static bool classofKind(Kind K)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
static bool classof(const Decl *D)
static ExternCContextDecl * castFromDeclContext(const DeclContext *DC)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
NamespaceDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
void setIsConversionFromLambda(bool val)
redeclarable_base::redecl_range redecl_range
void setKNRPromoted(bool promoted)
SourceLocation getOuterLocStart() const
getOuterLocStart - Return SourceLocation representing start of source range taking into account any o...
Encodes a location in the source.
enumerator_range enumerators() const
static DeclContext * castToDeclContext(const TranslationUnitDecl *D)
static bool classof(const Decl *D)
static bool classofKind(Kind K)
void setBraceRange(SourceRange R)
ParmVarDecl * getParamDecl(unsigned i)
void setAnonymousNamespace(NamespaceDecl *D)
static bool classofKind(Kind K)
SourceLocation getLocStart() const LLVM_READONLY
SourceRange getBraceRange() const
void setFreeStanding(bool isFreeStanding=true)
TagDecl - Represents the declaration of a struct/union/class/enum.
LanguageLinkage
Describes the different kinds of language linkage (C++ [dcl.link]) that an entity may have...
ASTContext & getASTContext() const LLVM_READONLY
bool isLocalVarDecl() const
isLocalVarDecl - Returns true for local variable declarations other than parameters.
capture_const_iterator capture_end() const
LabelDecl - Represents the declaration of a label.
TagDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
redeclarable_base::redecl_range redecl_range
void setDefaulted(bool D=true)
void setHasFlexibleArrayMember(bool V)
EnumDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool blockMissingReturnType() const
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
C-style initialization with assignment.
redecl_iterator redecls_end() const
void setInstantiationOfMemberEnum(EnumDecl *ED, TemplateSpecializationKind TSK)
Specify that this enumeration is an instantiation of the member enumeration ED.
param_iterator param_begin() const
Retrieve an iterator pointing to the first parameter decl.
ArrayRef< ParmVarDecl * > parameters() const
static bool classof(const Decl *D)
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
void demoteThisDefinitionToDeclaration()
This is a definition which should be demoted to a declaration.
virtual Stmt * getBody() const
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
ASTContext & getASTContext() const
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
IndirectFieldDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
redeclarable_base::redecl_range redecl_range
void setDeclName(DeclarationName N)
Set the name of this declaration.
Capture(VarDecl *variable, bool byRef, bool nested, Expr *copy)
FunctionDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass S, bool isInlineSpecified, bool isConstexprSpecified)
ParmVarDecl * getParamDecl(unsigned i)
bool hasVolatileMember() const
void setTagKind(TagKind TK)
This declaration is only a declaration.
Direct list-initialization.
void removeBitWidth()
removeBitWidth - Remove the bit-field width from this member.
LinkageInfo getLinkageAndVisibility() const
Determines the linkage and visibility of this entity.
static ExportDecl * castFromDeclContext(const DeclContext *DC)
ThreadStorageClassSpecifier getTSCSpec() const
llvm::iterator_range< specific_decl_iterator< EnumConstantDecl > > enumerator_range
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isDependentType() const
Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...
VarDecl * getInstantiatedFromStaticDataMember() const
If this variable is an instantiated static data member of a class template specialization, returns the templated static data member from which it was instantiated.
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
bool hasObjectMember() const
bool hasCachedLinkage() const
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
static DeclContext * castToDeclContext(const BlockDecl *D)
void setExplicitlyDefaulted(bool ED=true)
void setHasInheritedDefaultArg(bool I=true)
QualType getType() const
Return the type wrapped by this type source info.
static bool classofKind(Kind K)
void printQualifiedName(raw_ostream &OS) const
printQualifiedName - Returns human-readable qualified name for declaration, like A::B::i, for i being member of namespace A::B.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
void setVirtualAsWritten(bool V)
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
static const char * getStorageClassSpecifierString(StorageClass SC)
getStorageClassSpecifierString - Return the string used to specify the storage class SC...
Decl * getBlockManglingContextDecl() const
decl_iterator - Iterates through the declarations stored within this context.
const RecordDecl * getPreviousDecl() const
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
For a static data member that was instantiated from a static data member of a class template...
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
Base class for declarations which introduce a typedef-name.
const VarDecl * getDefinition(ASTContext &C) const
bool isAnonymousStructOrUnion() const
isAnonymousStructOrUnion - Whether this is an anonymous struct or union.
TLS with a dynamic initializer.
void setAnonymousNamespace(NamespaceDecl *D)
TagTypeKind
The kind of a tag type.
unsigned getNumParams() const
static bool classofKind(Kind K)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
void setDescribedAliasTemplate(TypeAliasTemplateDecl *TAT)
void setBody(CompoundStmt *B)
void setImplicitlyInline()
Flag that this function is implicitly inline.
MutableArrayRef< ImplicitParamDecl * > parameters()
void setHasVolatileMember(bool val)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
FunctionDecl * getNextRedeclarationImpl() override
Returns the next redeclaration or itself if this is the only decl.
bool hasUnparsedDefaultArg() const
hasUnparsedDefaultArg - Determines whether this parameter has a default argument that has not yet bee...
redeclarable_base::redecl_range redecl_range
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
static PragmaDetectMismatchDecl * Create(const ASTContext &C, TranslationUnitDecl *DC, SourceLocation Loc, StringRef Name, StringRef Value)
VarDecl * getNextRedeclarationImpl() override
Returns the next redeclaration or itself if this is the only decl.
QualType getPromotionType() const
getPromotionType - Return the integer type that enumerators should promote to.
unsigned getNumTemplateParameterLists() const
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)
Redeclarable< FunctionDecl > redeclarable_base
Reads an AST files chain containing the contents of a translation unit.
TagDecl * getNextRedeclarationImpl() override
Returns the next redeclaration or itself if this is the only decl.
void setARCPseudoStrong(bool ps)
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
bool isFreeStanding() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
const llvm::APSInt & getInitVal() const
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
IdentifierNamespace
IdentifierNamespace - The different namespaces in which declarations may appear.
bool hasWrittenPrototype() const
TLSKind
Kinds of thread-local storage.
void setWillHaveBody(bool V=true)
DeclarationName - The name of a declaration.
chain_iterator chain_end() const
void setInstantiationIsPending(bool IC)
void setInstantiationOfMemberFunction(FunctionDecl *FD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member function FD.
specific_decl_iterator< EnumConstantDecl > enumerator_iterator
ParmVarDeclBitfields ParmVarDeclBits
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
SourceLocation getLocStart() const LLVM_READONLY
size_t param_size() const
EnumDecl - Represents an enum.
unsigned getFunctionScopeDepth() const
detail::InMemoryDirectory::const_iterator E
void setInlineSpecified()
static bool classof(const Decl *D)
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
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)
DefinitionKind hasDefinition() const
static LabelDecl * CreateDeserialized(ASTContext &C, unsigned ID)
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).
static LabelDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdentL, IdentifierInfo *II)
param_iterator param_end()
void setInitCapture(bool IC)
bool isCompleteDefinitionRequired() const
Return true if this complete decl is required to be complete for some existing use.
StringRef getName() const
bool hasInheritedDefaultArg() const
void setImplicitlyInline()
redeclarable_base::redecl_iterator redecl_iterator
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...
param_const_iterator param_begin() const
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
static const TypeInfo & getInfo(unsigned id)
void setUnparsedDefaultArg()
setUnparsedDefaultArg - Specify that this parameter has an unparsed default argument.
NonParmVarDeclBitfields NonParmVarDeclBits
Expr * getUninstantiatedDefaultArg()
SourceLocation getCaretLocation() const
const T * getAs() const
Member-template getAs<specific type>'.
Decl::Kind getDeclKind() const
static ImplicitParamDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
QualType getIntegerType() const
getIntegerType - Return the integer type this enum decl corresponds to.
void setTypeSourceInfo(TypeSourceInfo *TI)
void setInstantiationOfStaticDataMember(VarDecl *VD, TemplateSpecializationKind TSK)
Specify that this variable is an instantiation of the static data member VD.
MutableArrayRef< ParmVarDecl * >::iterator param_iterator
void setUsesSEHTry(bool UST)
static bool classof(const Decl *D)
bool isComplete() const
Returns true if this can be considered a complete type.
LanguageLinkage getLanguageLinkage() const
Compute the language linkage.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
SourceLocation getAsmLoc() const
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
void setCXXForRangeDecl(bool FRD)
ImplicitParamDecl * getContextParam() const
Retrieve the parameter containing captured variables.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static bool classofKind(Kind K)
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
bool isStaticDataMember() const
Determines whether this is a static data member.
redeclarable_base::redecl_iterator redecl_iterator
ArrayRef< ParmVarDecl * >::const_iterator param_const_iterator
static bool classofKind(Kind K)
void setInnerLocStart(SourceLocation L)
void setObjCMethodScopeInfo(unsigned parameterIndex)
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement...
std::string getQualifiedNameAsString() const
virtual bool isDefined() 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.
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
ImplicitParamDecl *const * param_iterator
void setRBraceLoc(SourceLocation L)
param_iterator param_end() const
Retrieve an iterator one past the last parameter decl.
NestedNameSpecifierLoc QualifierLoc
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.
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
void setDefaultArg(Expr *defarg)
void setTSCSpec(ThreadStorageClassSpecifier TSC)
TypeSourceInfo * getSignatureAsWritten() const
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
void setDescribedVarTemplate(VarTemplateDecl *Template)
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a static data member...
static TranslationUnitDecl * Create(ASTContext &C)
static bool classofKind(Kind K)
void setConstexpr(bool IC)
Provides information a specialization of a member of a class template, which may be a member function...
bool isInline() const
Whether this variable is (C++1z) inline.
void setMSAsmLabel(StringRef Name)
Decl(Kind DK, DeclContext *DC, SourceLocation L)
VarDecl * getDefinition()
const FunctionDecl * getCanonicalDecl() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
APValue * getEvaluatedValue() const
Return the already-evaluated value of this variable's initializer, or NULL if the value is not yet kn...
unsigned kind
All of the diagnostics that can be emitted by the frontend.
MutableArrayRef< ParmVarDecl * >::iterator param_iterator
const Expr * getUninstantiatedDefaultArg() const
TemplateParameterList * getTemplateParameterList(unsigned i) const
static bool classof(const Decl *D)
static bool classofKind(Kind K)
const VarDecl * getActingDefinition() const
const IndirectFieldDecl * getCanonicalDecl() const
bool isNested() const
Whether this is a nested capture, i.e.
StringLiteral - This represents a string literal expression, e.g.
TLS with a known-constant initializer.
Kind
Lists the kind of concrete classes of Decl.
const Expr * getDefaultArg() const
static TagDecl * castFromDeclContext(const DeclContext *DC)
VarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass SC)
VarDeclBitfields VarDeclBits
NamespaceDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
TranslationUnitDecl - The top declaration context.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of this declaration, if it was present in ...
static bool classofKind(Kind K)
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace nested inside this namespace, if any.
bool isInExternCXXContext() const
Determines whether this variable's context is, or is nested within, a C++ extern "C++" linkage spec...
static bool classof(const Decl *D)
NamedDecl * getMostRecentDecl()
DefinitionKind isThisDeclarationADefinition() const
EnumConstantDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, Expr *E, const llvm::APSInt &V)
SourceLocation getInnerLocStart() const
getInnerLocStart - Return SourceLocation representing start of source range ignoring outer template d...
bool isResolvedMSAsmLabel() const
void setObjCDeclQualifier(ObjCDeclQualifier QTVal)
void setMSAsmLabelResolved()
TemplateParameterList * getTemplateParameterList(unsigned index) const
StringRef getKindName() const
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.
SourceLocation getLocation() const
void setIntegerTypeSourceInfo(TypeSourceInfo *TInfo)
Set the underlying integer type source info.
SourceLocation getRBraceLoc() const
NamedDecl - This represents a decl with a name.
DeclarationNameInfo getNameInfo() const
void setTypeSourceInfo(TypeSourceInfo *newType)
Represents a C array with a specified size that is not an integer-constant-expression.
EnumDecl * getDefinition() const
Automatic storage duration (most local variables).
bool hasImplicitReturnZero() const
Whether falling off this function implicitly returns null/zero.
const NamespaceDecl * getCanonicalDecl() const
Represents a #pragma detect_mismatch line.
TypeSourceInfo * getTypeSourceInfo() const
static bool classofKind(Kind K)
void setNRVOVariable(bool NRVO)
StorageDuration getStorageDuration() const
Get the storage duration of this variable, per C++ [basic.stc].
static bool classof(const Decl *D)
void setType(QualType newType)
virtual bool hasBody() const
Returns true if this Decl represents a declaration for a body of code, such as a function or method d...
void setDeletedAsWritten(bool D=true)
void setInlineSpecified(bool I)
Set whether the "inline" keyword was specified for this function.
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined...
bool isBeingDefined() const
isBeingDefined - Return true if this decl is currently being defined.
Declaration of a template function.
ArrayRef< ImplicitParamDecl * > parameters() const
Attr - This represents one attribute.
bool hasLocalStorage() const
hasLocalStorage - Returns true if a variable with function scope is a non-static local variable...
const RecordDecl * getParent() const
getParent - Returns the parent of this field declaration, which is the struct in which this field is ...
void setTemplateParameterListsInfo(ASTContext &Context, ArrayRef< TemplateParameterList * > TPLists)
setTemplateParameterListsInfo - Sets info about "outer" template parameter lists. ...
bool isMutable() const
isMutable - Determines whether this field is mutable (C++ only).
bool hasInClassInitializer() const
hasInClassInitializer - Determine whether this member has a C++11 in-class initializer.
unsigned getNumTemplateParameterLists() const
Structure used to store a statement, the constant value to which it was evaluated (if any)...
const StringLiteral * getAsmString() const
TemplatedKind
The kind of templated function a FunctionDecl can be.