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");
284 bool Qualified)
const;
301 using Decl::isModulePrivate;
302 using Decl::setModulePrivate;
309 assert((!Hide || isFromASTFile() || hasLocalOwningModuleStorage()) &&
310 "declaration with no owning module can't be hidden");
321 if (isa<EnumDecl>(DC))
382 return hasCachedLinkage();
389 if (this->
getKind() != UsingShadow &&
390 this->
getKind() != ConstructorUsingShadow &&
391 this->
getKind() != ObjCCompatibleAlias &&
392 this->
getKind() != NamespaceAlias)
395 return getUnderlyingDeclImpl();
425 void anchor()
override;
428 bool MSAsmNameResolved;
438 MSAsmNameResolved(
false),
452 bool isGnuLocal()
const {
return LocStart != getLocation(); }
484 llvm::PointerIntPair<NamespaceDecl *, 1, bool> AnonOrFirstNamespaceAndInline;
527 return AnonOrFirstNamespaceAndInline.getInt();
532 AnonOrFirstNamespaceAndInline.setInt(Inline);
591 void anchor()
override;
597 :
NamedDecl(DK, DC, L, N), DeclType(T) {}
653 llvm::PointerUnion<TypeSourceInfo*, ExtInfo*> DeclInfo;
659 bool hasExtInfo()
const {
return DeclInfo.is<
ExtInfo*>(); }
661 const ExtInfo *getExtInfo()
const {
return DeclInfo.get<
ExtInfo*>(); }
667 :
ValueDecl(DK, DC, L, N, T), DeclInfo(TInfo), InnerLocStart(StartL) {
673 ? getExtInfo()->TInfo
678 getExtInfo()->TInfo = TI;
700 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
708 return hasExtInfo() ? getExtInfo()->QualifierLoc
715 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
719 return getExtInfo()->TemplParamLists[index];
729 return K >= firstDeclarator && K <= lastDeclarator;
798 typedef llvm::PointerUnion<Stmt *, EvaluatedStmt *>
InitType;
805 class VarDeclBitfields {
810 unsigned TSCSpec : 2;
811 unsigned InitStyle : 2;
813 enum { NumVarDeclBits = 7 };
833 unsigned : NumVarDeclBits;
837 unsigned HasInheritedDefaultArg : 1;
846 unsigned IsKNRPromoted : 1;
849 unsigned IsObjCMethodParam : 1;
855 unsigned ScopeDepthOrObjCQuals : 7;
866 unsigned : NumVarDeclBits;
870 unsigned ExceptionVar : 1;
875 unsigned NRVOVariable : 1;
879 unsigned CXXForRangeDecl : 1;
883 unsigned ARCPseudoStrong : 1;
886 unsigned IsInline : 1;
889 unsigned IsInlineSpecified : 1;
892 unsigned IsConstexpr : 1;
896 unsigned IsInitCapture : 1;
901 unsigned PreviousDeclInSameBlockScope : 1;
954 assert(
VarDeclBits.TSCSpec == TSC &&
"truncation");
1030 if (
const DeclContext *DC = getLexicalDeclContext())
1031 return DC->getRedeclContext()->isFunctionOrMethod();
1060 return getKind() != Decl::ParmVar && getDeclContext()->isRecord();
1115 if (K == ParmVar || K == ImplicitParam)
1118 if (getLexicalDeclContext()->getRedeclContext()->isFileContext())
1213 assert(!isa<ParmVarDecl>(
this));
1231 assert(!isa<ParmVarDecl>(
this));
1241 assert(!isa<ParmVarDecl>(
this));
1253 assert(!isa<ParmVarDecl>(
this));
1262 return isa<ParmVarDecl>(
this) ?
false
1266 assert(!isa<ParmVarDecl>(
this));
1271 assert(!isa<ParmVarDecl>(
this));
1280 assert(!isa<ParmVarDecl>(
this));
1289 assert(!isa<ParmVarDecl>(
this));
1296 return isa<ParmVarDecl>(
this)
1301 assert(!isa<ParmVarDecl>(
this));
1356 void anchor()
override;
1366 :
VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
1386 :
VarDecl(DK, C, DC, StartLoc, IdLoc, Id, T, TInfo, S) {
1407 setParameterIndex(parameterIndex);
1417 setParameterIndex(parameterIndex);
1431 return getParameterIndex();
1532 void setParameterIndex(
unsigned parameterIndex) {
1533 if (parameterIndex >= ParameterIndexSentinel) {
1534 setParameterIndexLarge(parameterIndex);
1539 assert(
ParmVarDeclBits.ParameterIndex == parameterIndex &&
"truncation!");
1541 unsigned getParameterIndex()
const {
1543 return d == ParameterIndexSentinel ? getParameterIndexLarge() : d;
1546 void setParameterIndexLarge(
unsigned parameterIndex);
1547 unsigned getParameterIndexLarge()
const;
1570 TK_DependentFunctionTemplateSpecialization
1588 unsigned SClass : 2;
1589 unsigned IsInline : 1;
1590 unsigned IsInlineSpecified : 1;
1591 unsigned IsVirtualAsWritten : 1;
1592 unsigned IsPure : 1;
1593 unsigned HasInheritedPrototype : 1;
1594 unsigned HasWrittenPrototype : 1;
1595 unsigned IsDeleted : 1;
1596 unsigned IsTrivial : 1;
1597 unsigned IsDefaulted : 1;
1598 unsigned IsExplicitlyDefaulted : 1;
1599 unsigned HasImplicitReturnZero : 1;
1600 unsigned IsLateTemplateParsed : 1;
1601 unsigned IsConstexpr : 1;
1604 unsigned UsesSEHTry : 1;
1608 unsigned HasSkippedBody : 1;
1635 TemplateOrSpecialization;
1662 void setFunctionTemplateSpecialization(
ASTContext &C,
1682 bool isConstexprSpecified)
1687 ParamInfo(nullptr), Body(),
1689 IsInline(isInlineSpecified), IsInlineSpecified(isInlineSpecified),
1690 IsVirtualAsWritten(
false), IsPure(
false), HasInheritedPrototype(
false),
1692 IsDefaulted(
false), IsExplicitlyDefaulted(
false),
1693 HasImplicitReturnZero(
false), IsLateTemplateParsed(
false),
1694 IsConstexpr(isConstexprSpecified), UsesSEHTry(
false),
1695 HasSkippedBody(
false), EndRangeLoc(NameInfo.getEndLoc()),
1696 TemplateOrSpecialization(),
1726 bool hasWrittenPrototype =
true,
1727 bool isConstexprSpecified =
false) {
1732 isConstexprSpecified);
1741 bool hasWrittenPrototype,
1742 bool isConstexprSpecified =
false);
1751 bool Qualified)
const override;
1764 bool hasBody()
const override {
1766 return hasBody(Definition);
1771 bool hasTrivialBody()
const;
1780 return isDefined(Definition);
1786 if (isDefined(Definition))
1805 return getBody(Definition);
1815 return IsDeleted || Body || IsLateTemplateParsed;
1822 return Body || IsLateTemplateParsed;
1825 void setBody(
Stmt *B);
1829 bool isVariadic()
const;
1838 void setPure(
bool P =
true);
1872 return HasWrittenPrototype || HasInheritedPrototype;
1915 bool isMain()
const;
1919 bool isMSVCRTEntryPoint()
const;
1934 bool isReservedGlobalPlacementOperator()
const;
1951 bool isReplaceableGlobalAllocationFunction()
const;
1969 bool isGlobal()
const;
1973 bool isNoReturn()
const;
1986 unsigned getBuiltinID()
const;
1990 return {ParamInfo, getNumParams()};
1993 return {ParamInfo, getNumParams()};
2009 unsigned getNumParams()
const;
2012 assert(i < getNumParams() &&
"Illegal param #");
2013 return ParamInfo[i];
2016 assert(i < getNumParams() &&
"Illegal param #");
2017 return ParamInfo[i];
2020 setParams(getASTContext(), NewParamInfo);
2024 return DeclsInPrototypeScope;
2032 unsigned getMinRequiredArguments()
const;
2035 assert(
getType()->getAs<FunctionType>() &&
"Expected a FunctionType!");
2046 assert(
getType()->getAs<FunctionType>() &&
"Expected a FunctionType!");
2052 const Attr *getUnusedResultAttr()
const;
2071 IsInlineSpecified =
I;
2085 bool isInlineDefinitionExternallyVisible()
const;
2087 bool isMSExternInline()
const;
2089 bool doesDeclarationForceExternallyVisibleDefinition()
const;
2094 return getOverloadedOperator() !=
OO_None;
2122 FunctionDecl *getInstantiatedFromMemberFunction()
const;
2125 TemplatedKind getTemplatedKind()
const;
2136 setInstantiationOfMemberFunction(getASTContext(), FD, TSK);
2158 return getPrimaryTemplate() !=
nullptr;
2163 FunctionDecl *getClassScopeSpecializationPattern()
const;
2173 bool isImplicitlyInstantiable()
const;
2206 getTemplateSpecializationArgsAsWritten()
const;
2233 setFunctionTemplateSpecialization(getASTContext(), Template, TemplateArgs,
2234 InsertPos, TSK, TemplateArgsAsWritten,
2235 PointOfInstantiation);
2245 getDependentSpecializationInfo()
const;
2272 unsigned getMemoryFunctionKind()
const;
2277 return K >= firstFunction && K <= lastFunction;
2295 unsigned Mutable : 1;
2296 mutable unsigned CachedFieldIndex : 31;
2302 enum InitStorageKind {
2318 ISK_CapturedVLAType,
2332 llvm::PointerIntPair<void *, 2, InitStorageKind> InitStorage;
2339 Mutable(Mutable), CachedFieldIndex(0),
2340 InitStorage(BW, (InitStorageKind) InitStyle) {
2341 assert((!BW || InitStyle ==
ICIS_NoInit) &&
"got initializer for bitfield");
2362 return InitStorage.getInt() == ISK_BitWidthOrNothing &&
2363 InitStorage.getPointer() !=
nullptr;
2373 bool isAnonymousStructOrUnion()
const;
2377 ?
static_cast<Expr *
>(InitStorage.getPointer())
2380 unsigned getBitWidthValue(
const ASTContext &Ctx)
const;
2385 assert(InitStorage.getInt() == ISK_BitWidthOrNothing &&
2386 InitStorage.getPointer() ==
nullptr &&
2387 "bit width, initializer or captured type already set");
2388 InitStorage.setPointerAndInt(Width, ISK_BitWidthOrNothing);
2394 assert(isBitField() &&
"no bitfield width to remove");
2395 InitStorage.setPointerAndInt(
nullptr, ISK_BitWidthOrNothing);
2401 InitStorageKind storageKind = InitStorage.getInt();
2402 return (storageKind == ISK_CapturedVLAType
2417 return hasInClassInitializer()
2418 ?
static_cast<Expr *
>(InitStorage.getPointer())
2425 assert(hasInClassInitializer() &&
2426 InitStorage.getPointer() ==
nullptr &&
2427 "bit width, initializer or captured type already set");
2428 InitStorage.setPointer(Init);
2434 assert(hasInClassInitializer() &&
"no initializer to remove");
2435 InitStorage.setPointerAndInt(
nullptr, ISK_BitWidthOrNothing);
2441 return InitStorage.getInt() == ISK_CapturedVLAType;
2447 InitStorage.getPointer())
2456 return cast<RecordDecl>(getDeclContext());
2460 return cast<RecordDecl>(getDeclContext());
2487 const llvm::APSInt &V)
2495 const llvm::APSInt &V);
2523 void anchor()
override;
2525 unsigned ChainingSize;
2541 return llvm::makeArrayRef(Chaining, ChainingSize);
2549 assert(chain().size() >= 2);
2550 return cast<FieldDecl>(chain().back());
2554 assert(chain().size() >= 2);
2555 return dyn_cast<
VarDecl>(chain().front());
2570 void anchor()
override;
2575 mutable const Type *TypeForDecl;
2583 :
NamedDecl(DK, DC, L, Id), TypeForDecl(nullptr), LocStart(StartL) {}
2596 if (LocStart.isValid())
2610 void anchor()
override;
2611 typedef std::pair<TypeSourceInfo*, QualType> ModedTInfo;
2612 llvm::PointerUnion<TypeSourceInfo*, ModedTInfo*> MaybeModedTInfo;
2619 MaybeModedTInfo(TInfo) {}
2642 bool isModed()
const {
return MaybeModedTInfo.is<ModedTInfo*>(); }
2646 ? MaybeModedTInfo.get<ModedTInfo*>()->first
2651 ? MaybeModedTInfo.get<ModedTInfo*>()->second
2655 MaybeModedTInfo = newType;
2658 MaybeModedTInfo =
new (getASTContext()) ModedTInfo(unmodedTSI, modedTy);
2670 TagDecl *getAnonDeclWithTypedefName(
bool AnyRedecl =
false)
const;
2675 return K >= firstTypedefName && K <= lastTypedefName;
2708 Template(
nullptr) {}
2736 unsigned TagDeclKind : 3;
2741 unsigned IsCompleteDefinition : 1;
2745 unsigned IsBeingDefined : 1;
2751 unsigned IsEmbeddedInDeclarator : 1;
2754 unsigned IsFreeStanding : 1;
2758 unsigned NumPositiveBits : 8;
2759 unsigned NumNegativeBits : 8;
2763 unsigned IsScoped : 1;
2768 unsigned IsScopedUsingClassTag : 1;
2772 unsigned IsFixed : 1;
2778 unsigned MayHaveOutOfDateDef : 1;
2782 unsigned IsCompleteDefinitionRequired : 1;
2798 llvm::PointerUnion<TypedefNameDecl *, ExtInfo *> TypedefNameDeclOrQualifier;
2800 bool hasExtInfo()
const {
return TypedefNameDeclOrQualifier.is<
ExtInfo *>(); }
2801 ExtInfo *getExtInfo() {
return TypedefNameDeclOrQualifier.get<
ExtInfo *>(); }
2802 const ExtInfo *getExtInfo()
const {
2803 return TypedefNameDeclOrQualifier.get<
ExtInfo *>();
2811 TagDeclKind(TK), IsCompleteDefinition(
false), IsBeingDefined(
false),
2812 IsEmbeddedInDeclarator(
false), IsFreeStanding(
false),
2813 IsCompleteDefinitionRequired(
false),
2815 assert((DK != Enum || TK ==
TTK_Enum) &&
2816 "EnumDecl not matched with TTK_Enum");
2834 void completeDefinition();
2866 return isCompleteDefinition();
2872 return IsCompleteDefinition;
2878 return IsCompleteDefinitionRequired;
2883 return IsBeingDefined;
2887 return IsEmbeddedInDeclarator;
2890 IsEmbeddedInDeclarator = isInDeclarator;
2895 IsFreeStanding = isFreeStanding;
2908 void startDefinition();
2923 IsCompleteDefinitionRequired = V;
2958 return (
getDeclName() || getTypedefNameForAnonDecl());
2962 return hasExtInfo() ?
nullptr
2971 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
2979 return hasExtInfo() ? getExtInfo()->QualifierLoc
2986 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
2990 return getExtInfo()->TemplParamLists[i];
3014 void anchor()
override;
3030 llvm::PointerUnion<const Type*, TypeSourceInfo*> IntegerType;
3045 bool Scoped,
bool ScopedUsingClassTag,
bool Fixed)
3047 SpecializationInfo(
nullptr) {
3048 assert(Scoped || !ScopedUsingClassTag);
3049 IntegerType = (
const Type *)
nullptr;
3050 NumNegativeBits = 0;
3051 NumPositiveBits = 0;
3053 IsScopedUsingClassTag = ScopedUsingClassTag;
3068 return cast_or_null<EnumDecl>(
3089 bool IsScoped,
bool IsScopedUsingClassTag,
3098 void completeDefinition(
QualType NewType,
3100 unsigned NumPositiveBits,
3101 unsigned NumNegativeBits);
3106 typedef llvm::iterator_range<specific_decl_iterator<EnumConstantDecl>>
3140 if (
const Type *T = IntegerType.dyn_cast<
const Type*>())
3159 SourceRange getIntegerTypeRange() const LLVM_READONLY;
3163 unsigned getNumPositiveBits()
const {
3164 return NumPositiveBits;
3167 NumPositiveBits = Num;
3168 assert(NumPositiveBits == Num &&
"can't store this bitcount");
3181 return NumNegativeBits;
3184 NumNegativeBits = Num;
3194 return IsScopedUsingClassTag;
3205 return isCompleteDefinition() || isFixed();
3210 EnumDecl *getTemplateInstantiationPattern()
const;
3215 EnumDecl *getInstantiatedFromMemberEnum()
const;
3231 return SpecializationInfo;
3238 setInstantiationOfMemberEnum(getASTContext(), ED, TSK);
3258 bool HasFlexibleArrayMember : 1;
3262 bool AnonymousStructOrUnion : 1;
3266 bool HasObjectMember : 1;
3270 bool HasVolatileMember : 1;
3276 mutable bool LoadedFieldsFromExternalStorage : 1;
3291 return cast_or_null<RecordDecl>(
3322 AnonymousStructOrUnion = Anon;
3332 return LoadedFieldsFromExternalStorage;
3335 LoadedFieldsFromExternalStorage = val;
3351 bool isInjectedClassName()
const;
3355 bool isLambda()
const;
3359 bool isCapturedRecord()
const;
3362 void setCapturedRecord();
3380 typedef llvm::iterator_range<specific_decl_iterator<FieldDecl>>
field_range;
3383 field_iterator field_begin()
const;
3392 return field_begin() == field_end();
3397 virtual void completeDefinition();
3401 return K >= firstRecord && K <= lastRecord;
3412 bool mayInsertExtraPadding(
bool EmitRemark =
false)
const;
3416 const FieldDecl *findFirstNamedDataMember()
const;
3420 void LoadFieldsFromExternalStorage()
const;
3424 virtual void anchor();
3429 :
Decl(FileScopeAsm, DC, StartL), AsmString(asmstring), RParenLoc(EndL) {}
3467 llvm::PointerIntPair<VarDecl*, 2> VariableAndFlags;
3476 : VariableAndFlags(variable,
3477 (byRef ? flag_isByRef : 0) | (nested ? flag_isNested : 0)),
3485 bool isByRef()
const {
return VariableAndFlags.getInt() & flag_isByRef; }
3489 bool isNested()
const {
return VariableAndFlags.getInt() & flag_isNested; }
3498 bool IsVariadic : 1;
3499 bool CapturesCXXThis : 1;
3500 bool BlockMissingReturnType : 1;
3501 bool IsConversionFromLambda : 1;
3511 const Capture *Captures;
3512 unsigned NumCaptures;
3514 unsigned ManglingNumber;
3515 Decl *ManglingContextDecl;
3521 BlockMissingReturnType(
true), IsConversionFromLambda(
false),
3522 ParamInfo(nullptr), NumParams(0), Body(nullptr),
3523 SignatureAsWritten(nullptr), Captures(nullptr), NumCaptures(0),
3524 ManglingNumber(0), ManglingContextDecl(nullptr) {}
3544 return {ParamInfo, getNumParams()};
3547 return {ParamInfo, getNumParams()};
3562 assert(i < getNumParams() &&
"Illegal param #");
3563 return ParamInfo[i];
3566 assert(i < getNumParams() &&
"Illegal param #");
3567 return ParamInfo[i];
3573 bool hasCaptures()
const {
return NumCaptures != 0 || CapturesCXXThis; }
3593 bool capturesVariable(
const VarDecl *var)
const;
3596 bool CapturesCXXThis);
3599 return ManglingNumber;
3602 return ManglingContextDecl;
3606 ManglingNumber = Number;
3607 ManglingContextDecl = Ctx;
3638 unsigned ContextParam;
3640 llvm::PointerIntPair<Stmt *, 1, bool> BodyAndNothrow;
3645 return getTrailingObjects<ImplicitParamDecl *>();
3648 ImplicitParamDecl **getParams() {
3649 return getTrailingObjects<ImplicitParamDecl *>();
3654 unsigned NumParams);
3656 unsigned NumParams);
3658 Stmt *getBody()
const override;
3659 void setBody(
Stmt *B);
3661 bool isNothrow()
const;
3662 void setNothrow(
bool Nothrow =
true);
3667 assert(i < NumParams);
3668 return getParams()[i];
3671 assert(i < NumParams);
3677 return {getParams(), getNumParams()};
3680 return {getParams(), getNumParams()};
3685 assert(ContextParam < NumParams);
3686 return getParam(ContextParam);
3689 assert(i < NumParams);
3736 llvm::PointerIntPair<Module *, 1, bool> ImportedAndComplete;
3753 ImportDecl(EmptyShell Empty) :
Decl(Import, Empty), NextLocalImport() { }
3769 unsigned NumLocations);
3789 virtual void anchor();
3791 :
Decl(Empty, DC, L) { }
3817 template<
typename decl_type>
3822 "setPreviousDecl on a decl already in a redeclaration chain");
3835 static_cast<decl_type*
>(
this)->IdentifierNamespace |=
3836 MostRecent->getIdentifierNamespace() &
3837 (Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Type);
3840 First =
static_cast<decl_type*
>(
this);
3846 assert(!isa<NamedDecl>(static_cast<decl_type*>(
this)) ||
3847 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
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)
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
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
void setHidden(bool Hide)
Set whether this declaration is hidden from name lookup.
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)
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 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
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)
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...
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 ...
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
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.
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
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.
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
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)
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
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.
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
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
void setNumPositiveBits(unsigned Num)
llvm::iterator_range< param_iterator > param_range
unsigned getNumCaptures() const
getNumCaptures - Returns the number of captured variables.
TypedefNameDecl * getNextRedeclarationImpl() override
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.
bool isFunctionOrMethodVarDecl() const
isFunctionOrMethodVarDecl - Similar to isLocalVarDecl, but excludes variables declared in blocks...
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
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
static BlockDecl * castFromDeclContext(const DeclContext *DC)
TagDecl * getPreviousDeclImpl() override
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
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)
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)
bool isUnnamedBitfield() const
Determines whether this is an unnamed bitfield.
VarDecl * getPreviousDeclImpl() override
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...
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
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()
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.
ArrayRef< NamedDecl * > getDeclsInPrototypeScope() const
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
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)
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.
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()
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 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)
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
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
TypedefNameDecl * getTypedefNameForAnonDecl() const
VarDecl * getCanonicalDecl() override
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
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)
SourceRange getSourceRange() const override LLVM_READONLY
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
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...
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
void printName(raw_ostream &os) const
redeclarable_base::redecl_range redecl_range
void setDefaulted(bool D=true)
void setHasFlexibleArrayMember(bool V)
EnumDecl * getCanonicalDecl() override
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
ASTContext & getASTContext() const
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
IndirectFieldDecl * getCanonicalDecl() override
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.
ThreadStorageClassSpecifier getTSCSpec() const
llvm::iterator_range< specific_decl_iterator< EnumConstantDecl > > enumerator_range
SourceRange getSourceRange() const override LLVM_READONLY
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
Stmt * getBody() const override
static DeclContext * castToDeclContext(const BlockDecl *D)
void setExplicitlyDefaulted(bool ED=true)
unsigned TypeAlias
Whether this template specialization type is a substituted type alias.
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
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
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
void setARCPseudoStrong(bool ps)
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
bool isFreeStanding() const
const llvm::APSInt & getInitVal() const
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
bool hasWrittenPrototype() const
TLSKind
Kinds of thread-local storage.
DeclarationName - The name of a declaration.
chain_iterator chain_end() const
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
isThisDeclarationADefinition - Returns whether this specific declaration of the function is also a de...
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...
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.
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 * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T)
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
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.
ImplicitParamDecl *const * param_iterator
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)
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
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)
ImplicitParamDecl(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType Type)
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)
VarDecl * getDefinition()
const FunctionDecl * getCanonicalDecl() const
SourceRange getSourceRange() const override LLVM_READONLY
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.
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)
static Decl::Kind getKind(const Decl *D)
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.
void setIntegerTypeSourceInfo(TypeSourceInfo *TInfo)
Set the underlying integer type source info.
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)
void setDeletedAsWritten(bool D=true)
void setInlineSpecified(bool I)
Set whether the "inline" keyword was specified for this function.
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 method is...
DeclContext(Decl::Kind K)
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 isHidden() const
Determine whether this declaration is hidden from name lookup.
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.