class VarDecl
Declaration
class VarDecl : public DeclaratorDecl, public Redeclarable { /* full declaration omitted */ };
Description
Represents a variable declaration or definition.
Declared at: clang/include/clang/AST/Decl.h:874
Inherits from: DeclaratorDecl, Redeclarable
Member Variables
- protected clang::VarDecl::InitType Init
- The initializer for this variable or, for a ParmVarDecl, the C++ default argument.
- protected anonymous struct / union
Inherited from Decl:
- protected NextInContextAndBits
- protected Access
- protected FromASTFile
- protected IdentifierNamespace
- protected CacheValidAndLinkage
Method Overview
- public static clang::VarDecl * Create(clang::ASTContext & C, clang::DeclContext * DC, clang::SourceLocation StartLoc, clang::SourceLocation IdLoc, const clang::IdentifierInfo * Id, clang::QualType T, clang::TypeSourceInfo * TInfo, clang::StorageClass S)
- public static clang::VarDecl * CreateDeserialized(clang::ASTContext & C, unsigned int ID)
- protected VarDecl(clang::Decl::Kind DK, clang::ASTContext & C, clang::DeclContext * DC, clang::SourceLocation StartLoc, clang::SourceLocation IdLoc, const clang::IdentifierInfo * Id, clang::QualType T, clang::TypeSourceInfo * TInfo, clang::StorageClass SC)
- public bool checkForConstantInitialization(SmallVectorImpl<clang::PartialDiagnosticAt> & Notes) const
- public static bool classof(const clang::Decl * D)
- public static bool classofKind(clang::Decl::Kind K)
- public void demoteThisDefinitionToDeclaration()
- public clang::EvaluatedStmt * ensureEvaluatedStmt() const
- public bool evaluateDestruction(SmallVectorImpl<clang::PartialDiagnosticAt> & Notes) const
- public clang::APValue * evaluateValue() const
- private clang::APValue * evaluateValueImpl(SmallVectorImpl<clang::PartialDiagnosticAt> & Notes, bool IsConstantInitialization) const
- public const clang::VarDecl * getActingDefinition() const
- public clang::VarDecl * getActingDefinition()
- public const clang::Expr * getAnyInitializer() const
- public const clang::Expr * getAnyInitializer(const clang::VarDecl *& D) const
- public const clang::VarDecl * getCanonicalDecl() const
- public clang::VarDecl * getCanonicalDecl()
- public const clang::VarDecl * getDefinition() const
- public clang::VarDecl * getDefinition()
- public const clang::VarDecl * getDefinition(clang::ASTContext & C) const
- public clang::VarDecl * getDefinition(clang::ASTContext &)
- public clang::VarTemplateDecl * getDescribedVarTemplate() const
- public clang::EvaluatedStmt * getEvaluatedStmt() const
- public clang::APValue * getEvaluatedValue() const
- public clang::CharUnits getFlexibleArrayInitChars(const clang::ASTContext & Ctx) const
- public clang::Expr * getInit()
- public const clang::Expr * getInit() const
- public clang::Stmt ** getInitAddress()
- public clang::VarDecl::InitializationStyle getInitStyle() const
- public const clang::VarDecl * getInitializingDeclaration() const
- public clang::VarDecl * getInitializingDeclaration()
- public clang::VarDecl * getInstantiatedFromStaticDataMember() const
- public clang::LanguageLinkage getLanguageLinkage() const
- public clang::MemberSpecializationInfo * getMemberSpecializationInfo() const
- protected clang::VarDecl * getMostRecentDeclImpl()
- protected clang::VarDecl * getNextRedeclarationImpl()
- public clang::SourceLocation getPointOfInstantiation() const
- protected clang::VarDecl * getPreviousDeclImpl()
- public clang::SourceRange getSourceRange() const
- public clang::StorageClass getStorageClass() const
- public static const char * getStorageClassSpecifierString(clang::StorageClass SC)
- public clang::StorageDuration getStorageDuration() const
- public clang::VarDecl::TLSKind getTLSKind() const
- public clang::ThreadStorageClassSpecifier getTSCSpec() const
- public clang::VarDecl * getTemplateInstantiationPattern() const
- public clang::TemplateSpecializationKind getTemplateSpecializationKind() const
- public clang::TemplateSpecializationKind getTemplateSpecializationKindForInstantiation() const
- public bool hasConstantInitialization() const
- public clang::VarDecl::DefinitionKind hasDefinition(clang::ASTContext &) const
- public clang::VarDecl::DefinitionKind hasDefinition() const
- public bool hasDependentAlignment() const
- public bool hasExternalStorage() const
- public bool hasFlexibleArrayInit(const clang::ASTContext & Ctx) const
- public bool hasGlobalStorage() const
- public bool hasICEInitializer(const clang::ASTContext & Context) const
- public bool hasInit() const
- public bool hasLocalStorage() const
- public bool isARCPseudoStrong() const
- public bool isCXXForRangeDecl() const
- public bool isConstexpr() const
- public bool isDirectInit() const
- public bool isEscapingByref() const
- public bool isExceptionVariable() const
- public bool isExternC() const
- public bool isFileVarDecl() const
- public bool isFunctionOrMethodVarDecl() const
- public bool isInExternCContext() const
- public bool isInExternCXXContext() const
- public bool isInitCapture() const
- public bool isInline() const
- public bool isInlineSpecified() const
- public bool isKnownToBeDefined() const
- public bool isLocalVarDecl() const
- public bool isLocalVarDeclOrParm() const
- public bool isNRVOVariable() const
- public bool isNoDestroy(const clang::ASTContext &) const
- public bool isNonEscapingByref() const
- public bool isObjCForDecl() const
- public bool isOutOfLine() const
- public bool isParameterPack() const
- public bool isPreviousDeclInSameBlockScope() const
- public bool isStaticDataMember() const
- public bool isStaticLocal() const
- public clang::VarDecl::DefinitionKind isThisDeclarationADefinition() const
- public clang::VarDecl::DefinitionKind isThisDeclarationADefinition(clang::ASTContext &) const
- public bool isThisDeclarationADemotedDefinition() const
- public bool isUsableInConstantExpressions(const clang::ASTContext & C) const
- public bool mightBeUsableInConstantExpressions(const clang::ASTContext & C) const
- public QualType::DestructionKind needsDestruction(const clang::ASTContext & Ctx) const
- public void setARCPseudoStrong(bool PS)
- public void setCXXForRangeDecl(bool FRD)
- public void setConstexpr(bool IC)
- public void setDescribedVarTemplate(clang::VarTemplateDecl * Template)
- public void setEscapingByref()
- public void setExceptionVariable(bool EV)
- public void setImplicitlyInline()
- public void setInit(clang::Expr * I)
- public void setInitCapture(bool IC)
- public void setInitStyle(clang::VarDecl::InitializationStyle Style)
- public void setInlineSpecified()
- public void setInstantiationOfStaticDataMember(clang::VarDecl * VD, clang::TemplateSpecializationKind TSK)
- public void setNRVOVariable(bool NRVO)
- public void setObjCForDecl(bool FRD)
- public void setPreviousDeclInSameBlockScope(bool Same)
- public void setStorageClass(clang::StorageClass SC)
- public void setTSCSpec(clang::ThreadStorageClassSpecifier TSC)
- public void setTemplateSpecializationKind(clang::TemplateSpecializationKind TSK, clang::SourceLocation PointOfInstantiation = clang::SourceLocation())
Inherited from DeclaratorDecl:
- public classof
- public classofKind
- public getBeginLoc
- public getInnerLocStart
- public getNumTemplateParameterLists
- public getOuterLocStart
- public getQualifier
- public getQualifierLoc
- public getSourceRange
- public getTemplateParameterList
- public getTrailingRequiresClause
- public getTrailingRequiresClause
- public getTypeSourceInfo
- public getTypeSpecEndLoc
- public getTypeSpecStartLoc
- public setInnerLocStart
- public setQualifierInfo
- public setTemplateParameterListsInfo
- public setTrailingRequiresClause
- public setTypeSourceInfo
Inherited from ValueDecl:
Inherited from NamedDecl:
- public classof
- public classofKind
- public declarationReplaces
- public getDeclName
- public getExplicitVisibility
- public getFormalLinkage
- public getIdentifier
- public getLinkageAndVisibility
- public getLinkageInternal
- public getMostRecentDecl
- public getMostRecentDecl
- public getName
- public getNameAsString
- public getNameForDiagnostic
- public getObjCFStringFormattingFamily
- public getQualifiedNameAsString
- public getUnderlyingDecl
- public getUnderlyingDecl
- public getVisibility
- public hasExternalFormalLinkage
- public hasLinkage
- public hasLinkageBeenComputed
- public isCXXClassMember
- public isCXXInstanceMember
- public isExternallyDeclarable
- public isExternallyVisible
- public isLinkageValid
- public isReserved
- public printName
- public printNestedNameSpecifier
- public printNestedNameSpecifier
- public printQualifiedName
- public printQualifiedName
- public setDeclName
Inherited from Decl:
- public EnableStatistics
- public PrintStats
- public add
- public addAttr
- public attr_begin
- public attr_end
- public attrs
- public canBeWeakImported
- public castFromDeclContext
- public castToDeclContext
- public classofKind
- public dropAttr
- public dropAttrs
- public dump
- public dump
- public dumpColor
- public getASTContext
- protected getASTMutationListener
- public getAccess
- public getAccessUnsafe
- public getAsFunction
- public getAsFunction
- public getAttr
- public getAttrs
- public getAttrs
- public getAvailability
- public getBeginLoc
- public getBody
- public getBodyRBrace
- protected getCachedLinkage
- public getCanonicalDecl
- public getCanonicalDecl
- public getDeclContext
- public getDeclContext
- public getDeclKindName
- public getDefiningAttr
- public getDescribedTemplate
- public getDescribedTemplateParams
- public getEndLoc
- public getExternalSourceSymbolAttr
- public getFriendObjectKind
- public getFunctionType
- public getGlobalID
- public getID
- public getIdentifierNamespace
- public getIdentifierNamespaceForKind
- public getImportedOwningModule
- public getKind
- public getLangOpts
- public getLexicalDeclContext
- public getLexicalDeclContext
- public getLocalOwningModule
- public getLocation
- public getMaxAlignment
- public getModuleOwnershipKind
- public getMostRecentDecl
- public getMostRecentDecl
- protected getMostRecentDeclImpl
- public getNextDeclInContext
- public getNextDeclInContext
- protected getNextRedeclarationImpl
- public getNonClosureContext
- public getNonClosureContext
- public getOwningModule
- public getOwningModuleForLinkage
- public getOwningModuleID
- public getParentFunctionOrMethod
- public getParentFunctionOrMethod
- public getPreviousDecl
- public getPreviousDecl
- protected getPreviousDeclImpl
- public getSourceRange
- public getTemplateDepth
- public getTranslationUnitDecl
- public getTranslationUnitDecl
- public getVersionIntroduced
- public hasAttr
- public hasAttrs
- public hasBody
- protected hasCachedLinkage
- public hasDefiningAttr
- protected hasLocalOwningModuleStorage
- public hasOwningModule
- public hasTagIdentifierNamespace
- public isCanonicalDecl
- public isDefinedOutsideFunctionOrMethod
- public isDeprecated
- public isDiscardedInGlobalModuleFragment
- public isFirstDecl
- public isFromASTFile
- public isFunctionOrFunctionTemplate
- public isImplicit
- public isInAnonymousNamespace
- public isInExportDeclContext
- public isInIdentifierNamespace
- public isInLocalScopeForInstantiation
- public isInStdNamespace
- public isInvalidDecl
- public isInvisibleOutsideTheOwningModule
- public isLocalExternDecl
- public isModulePrivate
- public isOutOfLine
- public isParameterPack
- public isReachable
- public isReferenced
- public isTagIdentifierNamespace
- public isTemplateDecl
- public isTemplateParameter
- public isTemplateParameterPack
- public isTemplated
- public isThisDeclarationReferenced
- public isTopLevelDeclInObjCContainer
- public isUnavailable
- public isUnconditionallyVisible
- public isUsed
- public isWeakImported
- public markUsed
- public print
- public print
- public printGroup
- public redecls
- public redecls_begin
- public redecls_end
- public setAccess
- public setAttrs
- protected setCachedLinkage
- public setDeclContext
- public setFromASTFile
- public setImplicit
- public setInvalidDecl
- public setIsUsed
- public setLexicalDeclContext
- public setLocalExternDecl
- public setLocalOwningModule
- public setLocation
- public setModuleOwnershipKind
- protected setModulePrivate
- public setNonMemberOperator
- public setObjectOfFriendDecl
- public setOwningModuleID
- public setReferenced
- public setTopLevelDeclInObjCContainer
- public setVisibleDespiteOwningModule
- public specific_attr_begin
- public specific_attr_end
- public specific_attrs
- protected updateOutOfDate
Methods
¶static clang::VarDecl* Create(
clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
const clang::IdentifierInfo* Id,
clang::QualType T,
clang::TypeSourceInfo* TInfo,
clang::StorageClass S)
static clang::VarDecl* Create(
clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
const clang::IdentifierInfo* Id,
clang::QualType T,
clang::TypeSourceInfo* TInfo,
clang::StorageClass S)
Declared at: clang/include/clang/AST/Decl.h:1072
Parameters
- clang::ASTContext& C
- clang::DeclContext* DC
- clang::SourceLocation StartLoc
- clang::SourceLocation IdLoc
- const clang::IdentifierInfo* Id
- clang::QualType T
- clang::TypeSourceInfo* TInfo
- clang::StorageClass S
¶static clang::VarDecl* CreateDeserialized(
clang::ASTContext& C,
unsigned int ID)
static clang::VarDecl* CreateDeserialized(
clang::ASTContext& C,
unsigned int ID)
Declared at: clang/include/clang/AST/Decl.h:1077
Parameters
- clang::ASTContext& C
- unsigned int ID
¶VarDecl(clang::Decl::Kind DK,
clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
const clang::IdentifierInfo* Id,
clang::QualType T,
clang::TypeSourceInfo* TInfo,
clang::StorageClass SC)
VarDecl(clang::Decl::Kind DK,
clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
const clang::IdentifierInfo* Id,
clang::QualType T,
clang::TypeSourceInfo* TInfo,
clang::StorageClass SC)
Declared at: clang/include/clang/AST/Decl.h:1043
Parameters
- clang::Decl::Kind DK
- clang::ASTContext& C
- clang::DeclContext* DC
- clang::SourceLocation StartLoc
- clang::SourceLocation IdLoc
- const clang::IdentifierInfo* Id
- clang::QualType T
- clang::TypeSourceInfo* TInfo
- clang::StorageClass SC
¶bool checkForConstantInitialization(
SmallVectorImpl<clang::PartialDiagnosticAt>&
Notes) const
bool checkForConstantInitialization(
SmallVectorImpl<clang::PartialDiagnosticAt>&
Notes) const
Description
Evaluate the initializer of this variable to determine whether it's a constant initializer. Should only be called once, after completing the definition of the variable.
Declared at: clang/include/clang/AST/Decl.h:1357
Parameters
- SmallVectorImpl<clang::PartialDiagnosticAt>& Notes
¶static bool classof(const clang::Decl* D)
static bool classof(const clang::Decl* D)
Declared at: clang/include/clang/AST/Decl.h:1609
Parameters
- const clang::Decl* D
¶static bool classofKind(clang::Decl::Kind K)
static bool classofKind(clang::Decl::Kind K)
Declared at: clang/include/clang/AST/Decl.h:1610
Parameters
- clang::Decl::Kind K
¶void demoteThisDefinitionToDeclaration()
void demoteThisDefinitionToDeclaration()
Description
This is a definition which should be demoted to a declaration. In some cases (mostly module merging) we can end up with two visible definitions one of which needs to be demoted to a declaration to keep the AST invariants.
Declared at: clang/include/clang/AST/Decl.h:1394
¶clang::EvaluatedStmt* ensureEvaluatedStmt() const
clang::EvaluatedStmt* ensureEvaluatedStmt() const
Declared at: clang/include/clang/AST/Decl.h:1315
¶bool evaluateDestruction(
SmallVectorImpl<clang::PartialDiagnosticAt>&
Notes) const
bool evaluateDestruction(
SmallVectorImpl<clang::PartialDiagnosticAt>&
Notes) const
Description
Evaluate the destruction of this variable to determine if it constitutes constant destruction.
Declared at: clang/include/clang/AST/Decl.h:1339
Parameters
- SmallVectorImpl<clang::PartialDiagnosticAt>& Notes
Returns
\c true if this variable has constant destruction, \c false if not.
¶clang::APValue* evaluateValue() const
clang::APValue* evaluateValue() const
Description
Attempt to evaluate the value of the initializer attached to this declaration, and produce notes explaining why it cannot be evaluated. Returns a pointer to the value if evaluation succeeded, 0 otherwise.
Declared at: clang/include/clang/AST/Decl.h:1321
¶clang::APValue* evaluateValueImpl(
SmallVectorImpl<clang::PartialDiagnosticAt>&
Notes,
bool IsConstantInitialization) const
clang::APValue* evaluateValueImpl(
SmallVectorImpl<clang::PartialDiagnosticAt>&
Notes,
bool IsConstantInitialization) const
Declared at: clang/include/clang/AST/Decl.h:1324
Parameters
- SmallVectorImpl<clang::PartialDiagnosticAt>& Notes
- bool IsConstantInitialization
¶const clang::VarDecl* getActingDefinition() const
const clang::VarDecl* getActingDefinition() const
Declared at: clang/include/clang/AST/Decl.h:1236
¶clang::VarDecl* getActingDefinition()
clang::VarDecl* getActingDefinition()
Description
Get the tentative definition that acts as the real definition in a TU. Returns null if there is a proper definition available.
Declared at: clang/include/clang/AST/Decl.h:1235
¶const clang::Expr* getAnyInitializer() const
const clang::Expr* getAnyInitializer() const
Description
Get the initializer for this variable, no matter which declaration it is attached to.
Declared at: clang/include/clang/AST/Decl.h:1273
¶const clang::Expr* getAnyInitializer(
const clang::VarDecl*& D) const
const clang::Expr* getAnyInitializer(
const clang::VarDecl*& D) const
Description
Get the initializer for this variable, no matter which declaration it is attached to. Also get that declaration.
Declared at: clang/include/clang/AST/Decl.h:1280
Parameters
- const clang::VarDecl*& D
¶const clang::VarDecl* getCanonicalDecl() const
const clang::VarDecl* getCanonicalDecl() const
Declared at: clang/include/clang/AST/Decl.h:1204
¶clang::VarDecl* getCanonicalDecl()
clang::VarDecl* getCanonicalDecl()
Description
Retrieves the "canonical" declaration of the given declaration.
Declared at: clang/include/clang/AST/Decl.h:1203
¶const clang::VarDecl* getDefinition() const
const clang::VarDecl* getDefinition() const
Declared at: clang/include/clang/AST/Decl.h:1248
¶clang::VarDecl* getDefinition()
clang::VarDecl* getDefinition()
Declared at: clang/include/clang/AST/Decl.h:1245
¶const clang::VarDecl* getDefinition(
clang::ASTContext& C) const
const clang::VarDecl* getDefinition(
clang::ASTContext& C) const
Declared at: clang/include/clang/AST/Decl.h:1242
Parameters
¶clang::VarDecl* getDefinition(clang::ASTContext&)
clang::VarDecl* getDefinition(clang::ASTContext&)
Description
Get the real (not just tentative) definition for this declaration.
Declared at: clang/include/clang/AST/Decl.h:1241
Parameters
¶clang::VarTemplateDecl* getDescribedVarTemplate()
const
clang::VarTemplateDecl* getDescribedVarTemplate()
const
Description
Retrieves the variable template that is described by this variable declaration. Every variable template is represented as a VarTemplateDecl and a VarDecl. The former contains template properties (such as the template parameter lists) while the latter contains the actual description of the template's contents. VarTemplateDecl::getTemplatedDecl() retrieves the VarDecl that from a VarTemplateDecl, while getDescribedVarTemplate() retrieves the VarTemplateDecl from a VarDecl.
Declared at: clang/include/clang/AST/Decl.h:1577
¶clang::EvaluatedStmt* getEvaluatedStmt() const
clang::EvaluatedStmt* getEvaluatedStmt() const
Declared at: clang/include/clang/AST/Decl.h:1316
¶clang::APValue* getEvaluatedValue() const
clang::APValue* getEvaluatedValue() const
Description
Return the already-evaluated value of this variable's initializer, or NULL if the value is not yet known. Returns pointer to untyped APValue if the value could not be evaluated.
Declared at: clang/include/clang/AST/Decl.h:1331
¶clang::CharUnits getFlexibleArrayInitChars(
const clang::ASTContext& Ctx) const
clang::CharUnits getFlexibleArrayInitChars(
const clang::ASTContext& Ctx) const
Description
If hasFlexibleArrayInit is true, compute the number of additional bytes necessary to store those elements. Otherwise, returns zero. This can only be called for declarations where hasInit() is true.
Declared at: clang/include/clang/AST/Decl.h:1606
Parameters
- const clang::ASTContext& Ctx
¶clang::Expr* getInit()
clang::Expr* getInit()
Declared at: clang/include/clang/AST/Decl.h:1286
¶const clang::Expr* getInit() const
const clang::Expr* getInit() const
Declared at: clang/include/clang/AST/Decl.h:1283
¶clang::Stmt** getInitAddress()
clang::Stmt** getInitAddress()
Description
Retrieve the address of the initializer expression.
Declared at: clang/include/clang/AST/Decl.h:1289
¶clang::VarDecl::InitializationStyle getInitStyle()
const
clang::VarDecl::InitializationStyle getInitStyle()
const
Description
The style of initialization for this declaration. C-style initialization is "int x = 1;". Call-style initialization is a C++98 direct-initializer, e.g. "int x(1);". The Init expression will be the expression inside the parens or a "ClassType(a,b,c)" class constructor expression for class types. List-style initialization is C++11 syntax, e.g. "int x{1};". Clients can distinguish between different forms of initialization by checking this value. In particular, "int x = {1};" is C-style, "int x({1})" is call-style, and "int x{1};" is list-style; the Init expression in all three cases is an InitListExpr.
Declared at: clang/include/clang/AST/Decl.h:1374
¶const clang::VarDecl* getInitializingDeclaration()
const
const clang::VarDecl* getInitializingDeclaration()
const
Declared at: clang/include/clang/AST/Decl.h:1297
¶clang::VarDecl* getInitializingDeclaration()
clang::VarDecl* getInitializingDeclaration()
Description
Get the initializing declaration of this variable, if any. This is usually the definition, except that for a static data member it can be the in-class declaration.
Declared at: clang/include/clang/AST/Decl.h:1296
¶clang::VarDecl*
getInstantiatedFromStaticDataMember() const
clang::VarDecl*
getInstantiatedFromStaticDataMember() const
Description
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.
Declared at: clang/include/clang/AST/Decl.h:1533
¶clang::LanguageLinkage getLanguageLinkage() const
clang::LanguageLinkage getLanguageLinkage() const
Description
Compute the language linkage.
Declared at: clang/include/clang/AST/Decl.h:1150
¶clang::MemberSpecializationInfo*
getMemberSpecializationInfo() const
clang::MemberSpecializationInfo*
getMemberSpecializationInfo() const
Description
If this variable is an instantiation of a static data member of a class template specialization, retrieves the member specialization information.
Declared at: clang/include/clang/AST/Decl.h:1554
¶clang::VarDecl* getMostRecentDeclImpl()
clang::VarDecl* getMostRecentDeclImpl()
Description
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chain.
Declared at: clang/include/clang/AST/Decl.h:1057
¶clang::VarDecl* getNextRedeclarationImpl()
clang::VarDecl* getNextRedeclarationImpl()
Description
Returns the next redeclaration or itself if this is the only decl. Decl subclasses that can be redeclared should override this method so that Decl::redecl_iterator can iterate over them.
Declared at: clang/include/clang/AST/Decl.h:1049
¶clang::SourceLocation getPointOfInstantiation()
const
clang::SourceLocation getPointOfInstantiation()
const
Description
If this variable is an instantiation of a variable template or a static data member of a class template, determine its point of instantiation.
Declared at: clang/include/clang/AST/Decl.h:1549
¶clang::VarDecl* getPreviousDeclImpl()
clang::VarDecl* getPreviousDeclImpl()
Description
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain.
Declared at: clang/include/clang/AST/Decl.h:1053
¶clang::SourceRange getSourceRange() const
clang::SourceRange getSourceRange() const
Description
Source range that this declaration covers.
Declared at: clang/include/clang/AST/Decl.h:1079
¶clang::StorageClass getStorageClass() const
clang::StorageClass getStorageClass() const
Description
Returns the storage class as written in the source. For the computed linkage of symbol, see getLinkage.
Declared at: clang/include/clang/AST/Decl.h:1083
¶static const char* getStorageClassSpecifierString(
clang::StorageClass SC)
static const char* getStorageClassSpecifierString(
clang::StorageClass SC)
Description
Return the string used to specify the storage class \p SC. It is illegal to call this function with SC == None.
Declared at: clang/include/clang/AST/Decl.h:903
Parameters
- clang::StorageClass SC
¶clang::StorageDuration getStorageDuration() const
clang::StorageDuration getStorageDuration() const
Description
Get the storage duration of this variable, per C++ [basic.stc].
Declared at: clang/include/clang/AST/Decl.h:1144
¶clang::VarDecl::TLSKind getTLSKind() const
clang::VarDecl::TLSKind getTLSKind() const
Declared at: clang/include/clang/AST/Decl.h:1095
¶clang::ThreadStorageClassSpecifier getTSCSpec()
const
clang::ThreadStorageClassSpecifier getTSCSpec()
const
Declared at: clang/include/clang/AST/Decl.h:1092
¶clang::VarDecl* getTemplateInstantiationPattern()
const
clang::VarDecl* getTemplateInstantiationPattern()
const
Description
Retrieve the variable declaration from which this variable could be instantiated, if it is an instantiation (rather than a non-template).
Declared at: clang/include/clang/AST/Decl.h:1528
¶clang::TemplateSpecializationKind
getTemplateSpecializationKind() const
clang::TemplateSpecializationKind
getTemplateSpecializationKind() const
Description
If this variable is an instantiation of a variable template or a static data member of a class template, determine what kind of template specialization or instantiation this is.
Declared at: clang/include/clang/AST/Decl.h:1538
¶clang::TemplateSpecializationKind
getTemplateSpecializationKindForInstantiation()
const
clang::TemplateSpecializationKind
getTemplateSpecializationKindForInstantiation()
const
Description
Get the template specialization kind of this variable for the purposes of template instantiation. This differs from getTemplateSpecializationKind() for an instantiation of a class-scope explicit specialization.
Declared at: clang/include/clang/AST/Decl.h:1544
¶bool hasConstantInitialization() const
bool hasConstantInitialization() const
Description
Determine whether this variable has constant initialization. This is only set in two cases: when the language semantics require constant initialization (globals in C and some globals in C++), and when the variable is usable in constant expressions (constexpr, const int, and reference variables in C++).
Declared at: clang/include/clang/AST/Decl.h:1347
¶clang::VarDecl::DefinitionKind hasDefinition(
clang::ASTContext&) const
clang::VarDecl::DefinitionKind hasDefinition(
clang::ASTContext&) const
Description
Check whether this variable is defined in this translation unit.
Declared at: clang/include/clang/AST/Decl.h:1228
Parameters
¶clang::VarDecl::DefinitionKind hasDefinition()
const
clang::VarDecl::DefinitionKind hasDefinition()
const
Declared at: clang/include/clang/AST/Decl.h:1229
¶bool hasDependentAlignment() const
bool hasDependentAlignment() const
Description
Determines if this variable's alignment is dependent.
Declared at: clang/include/clang/AST/Decl.h:1524
¶bool hasExternalStorage() const
bool hasExternalStorage() const
Description
Returns true if a variable has extern or __private_extern__ storage.
Declared at: clang/include/clang/AST/Decl.h:1132
¶bool hasFlexibleArrayInit(
const clang::ASTContext& Ctx) const
bool hasFlexibleArrayInit(
const clang::ASTContext& Ctx) const
Description
Whether this variable has a flexible array member initialized with one or more elements. This can only be called for declarations where hasInit() is true. (The standard doesn't allow initializing flexible array members; this is a gcc/msvc extension.)
Declared at: clang/include/clang/AST/Decl.h:1600
Parameters
- const clang::ASTContext& Ctx
¶bool hasGlobalStorage() const
bool hasGlobalStorage() const
Description
Returns true for all variables that do not have local storage. This includes all global variables as well as static variables declared within a function.
Declared at: clang/include/clang/AST/Decl.h:1141
¶bool hasICEInitializer(
const clang::ASTContext& Context) const
bool hasICEInitializer(
const clang::ASTContext& Context) const
Description
Determine whether the initializer of this variable is an integer constant expression. For use in C++98, where this affects whether the variable is usable in constant expressions.
Declared at: clang/include/clang/AST/Decl.h:1352
Parameters
- const clang::ASTContext& Context
¶bool hasInit() const
bool hasInit() const
Declared at: clang/include/clang/AST/Decl.h:1282
¶bool hasLocalStorage() const
bool hasLocalStorage() const
Description
Returns true if a variable with function scope is a non-static local variable.
Declared at: clang/include/clang/AST/Decl.h:1099
¶bool isARCPseudoStrong() const
bool isARCPseudoStrong() const
Description
Determine whether this variable is an ARC pseudo-__strong variable. A pseudo-__strong variable has a __strong-qualified type but does not actually retain the object written into it. Generally such variables are also 'const' for safety. There are 3 cases where this will be set, 1) if the variable is annotated with the objc_externally_retained attribute, 2) if its 'self' in a non-init method, or 3) if its the variable in an for-in loop.
Declared at: clang/include/clang/AST/Decl.h:1455
¶bool isCXXForRangeDecl() const
bool isCXXForRangeDecl() const
Description
Determine whether this variable is the for-range-declaration in a C++0x for-range statement.
Declared at: clang/include/clang/AST/Decl.h:1430
¶bool isConstexpr() const
bool isConstexpr() const
Description
Whether this variable is (C++11) constexpr.
Declared at: clang/include/clang/AST/Decl.h:1477
¶bool isDirectInit() const
bool isDirectInit() const
Description
Whether the initializer is a direct-initializer (list or call).
Declared at: clang/include/clang/AST/Decl.h:1379
¶bool isEscapingByref() const
bool isEscapingByref() const
Description
Indicates the capture is a __block variable that is captured by a block that can potentially escape (a block for which BlockDecl::doesNotEscape returns false).
Declared at: clang/include/clang/AST/Decl.h:1513
¶bool isExceptionVariable() const
bool isExceptionVariable() const
Description
Determine whether this variable is the exception variable in a C++ catch statememt or an Objective-C @ catch statement.
Declared at: clang/include/clang/AST/Decl.h:1402
¶bool isExternC() const
bool isExternC() const
Description
Determines whether this variable is a variable with external, C linkage.
Declared at: clang/include/clang/AST/Decl.h:1153
¶bool isFileVarDecl() const
bool isFileVarDecl() const
Description
Returns true for file scoped variable declaration.
Declared at: clang/include/clang/AST/Decl.h:1257
¶bool isFunctionOrMethodVarDecl() const
bool isFunctionOrMethodVarDecl() const
Description
Similar to isLocalVarDecl, but excludes variables declared in blocks.
Declared at: clang/include/clang/AST/Decl.h:1182
¶bool isInExternCContext() const
bool isInExternCContext() const
Description
Determines whether this variable's context is, or is nested within, a C++ extern "C" linkage spec.
Declared at: clang/include/clang/AST/Decl.h:1157
¶bool isInExternCXXContext() const
bool isInExternCXXContext() const
Description
Determines whether this variable's context is, or is nested within, a C++ extern "C++" linkage spec.
Declared at: clang/include/clang/AST/Decl.h:1161
¶bool isInitCapture() const
bool isInitCapture() const
Description
Whether this variable is the implicit variable for a lambda init-capture.
Declared at: clang/include/clang/AST/Decl.h:1486
¶bool isInline() const
bool isInline() const
Description
Whether this variable is (C++1z) inline.
Declared at: clang/include/clang/AST/Decl.h:1459
¶bool isInlineSpecified() const
bool isInlineSpecified() const
Declared at: clang/include/clang/AST/Decl.h:1462
¶bool isKnownToBeDefined() const
bool isKnownToBeDefined() const
Declared at: clang/include/clang/AST/Decl.h:1584
¶bool isLocalVarDecl() const
bool isLocalVarDecl() const
Description
Returns true for local variable declarations other than parameters. Note that this includes static variables inside of functions. It also includes variables inside blocks. void foo() { int x; static int y; extern int z; }
Declared at: clang/include/clang/AST/Decl.h:1168
¶bool isLocalVarDeclOrParm() const
bool isLocalVarDeclOrParm() const
Description
Similar to isLocalVarDecl but also includes parameters.
Declared at: clang/include/clang/AST/Decl.h:1177
¶bool isNRVOVariable() const
bool isNRVOVariable() const
Description
Determine whether this local variable can be used with the named return value optimization (NRVO). The named return value optimization (NRVO) works by marking certain non-volatile local variables of class type as NRVO objects. These locals can be allocated within the return slot of their containing function, in which case there is no need to copy the object to the return slot when returning from the function. Within the function body, each return that returns the NRVO object will have this variable as its NRVO candidate.
Declared at: clang/include/clang/AST/Decl.h:1420
¶bool isNoDestroy(const clang::ASTContext&) const
bool isNoDestroy(const clang::ASTContext&) const
Description
Is destruction of this variable entirely suppressed? If so, the variable need not have a usable destructor at all.
Declared at: clang/include/clang/AST/Decl.h:1588
Parameters
- const clang::ASTContext&
¶bool isNonEscapingByref() const
bool isNonEscapingByref() const
Description
Indicates the capture is a __block variable that is never captured by an escaping block.
Declared at: clang/include/clang/AST/Decl.h:1517
¶bool isObjCForDecl() const
bool isObjCForDecl() const
Description
Determine whether this variable is a for-loop declaration for a for-in statement in Objective-C.
Declared at: clang/include/clang/AST/Decl.h:1440
¶bool isOutOfLine() const
bool isOutOfLine() const
Description
Determine whether this is or was instantiated from an out-of-line definition of a static data member.
Declared at: clang/include/clang/AST/Decl.h:1254
¶bool isParameterPack() const
bool isParameterPack() const
Description
Determine whether this variable is actually a function parameter pack or init-capture pack.
Declared at: clang/include/clang/AST/Decl.h:1496
¶bool isPreviousDeclInSameBlockScope() const
bool isPreviousDeclInSameBlockScope() const
Description
Whether this local extern variable declaration's previous declaration was declared in the same block scope. Only correct in C++.
Declared at: clang/include/clang/AST/Decl.h:1500
¶bool isStaticDataMember() const
bool isStaticDataMember() const
Description
Determines whether this is a static data member. This will only be true in C++, and applies to, e.g., the variable 'x' in:
Declared at: clang/include/clang/AST/Decl.h:1198
¶bool isStaticLocal() const
bool isStaticLocal() const
Description
Returns true if a variable with function scope is a static local variable.
Declared at: clang/include/clang/AST/Decl.h:1123
¶clang::VarDecl::DefinitionKind
isThisDeclarationADefinition() const
clang::VarDecl::DefinitionKind
isThisDeclarationADefinition() const
Declared at: clang/include/clang/AST/Decl.h:1223
¶clang::VarDecl::DefinitionKind
isThisDeclarationADefinition(
clang::ASTContext&) const
clang::VarDecl::DefinitionKind
isThisDeclarationADefinition(
clang::ASTContext&) const
Description
Check whether this declaration is a definition. If this could be a tentative definition (in C), don't check whether there's an overriding definition.
Declared at: clang/include/clang/AST/Decl.h:1222
Parameters
¶bool isThisDeclarationADemotedDefinition() const
bool isThisDeclarationADemotedDefinition() const
Description
If this definition should pretend to be a declaration.
Declared at: clang/include/clang/AST/Decl.h:1384
¶bool isUsableInConstantExpressions(
const clang::ASTContext& C) const
bool isUsableInConstantExpressions(
const clang::ASTContext& C) const
Description
Determine whether this variable's value can be used in a constant expression, according to the relevant language standard, including checking whether it was initialized by a constant expression.
Declared at: clang/include/clang/AST/Decl.h:1313
Parameters
- const clang::ASTContext& C
¶bool mightBeUsableInConstantExpressions(
const clang::ASTContext& C) const
bool mightBeUsableInConstantExpressions(
const clang::ASTContext& C) const
Description
Determine whether this variable's value might be usable in a constant expression, according to the relevant language standard. This only checks properties of the declaration, and does not check whether the initializer is in fact a constant expression. This corresponds to C++20 [expr.const]p3's notion of a "potentially-constant" variable.
Declared at: clang/include/clang/AST/Decl.h:1308
Parameters
- const clang::ASTContext& C
¶QualType::DestructionKind needsDestruction(
const clang::ASTContext& Ctx) const
QualType::DestructionKind needsDestruction(
const clang::ASTContext& Ctx) const
Description
Would the destruction of this variable have any effect, and if so, what kind?
Declared at: clang/include/clang/AST/Decl.h:1592
Parameters
- const clang::ASTContext& Ctx
¶void setARCPseudoStrong(bool PS)
void setARCPseudoStrong(bool PS)
Declared at: clang/include/clang/AST/Decl.h:1456
Parameters
- bool PS
¶void setCXXForRangeDecl(bool FRD)
void setCXXForRangeDecl(bool FRD)
Declared at: clang/include/clang/AST/Decl.h:1433
Parameters
- bool FRD
¶void setConstexpr(bool IC)
void setConstexpr(bool IC)
Declared at: clang/include/clang/AST/Decl.h:1480
Parameters
- bool IC
¶void setDescribedVarTemplate(
clang::VarTemplateDecl* Template)
void setDescribedVarTemplate(
clang::VarTemplateDecl* Template)
Declared at: clang/include/clang/AST/Decl.h:1579
Parameters
- clang::VarTemplateDecl* Template
¶void setEscapingByref()
void setEscapingByref()
Declared at: clang/include/clang/AST/Decl.h:1519
¶void setExceptionVariable(bool EV)
void setExceptionVariable(bool EV)
Declared at: clang/include/clang/AST/Decl.h:1405
Parameters
- bool EV
¶void setImplicitlyInline()
void setImplicitlyInline()
Declared at: clang/include/clang/AST/Decl.h:1471
¶void setInit(clang::Expr* I)
void setInit(clang::Expr* I)
Declared at: clang/include/clang/AST/Decl.h:1291
Parameters
- clang::Expr* I
¶void setInitCapture(bool IC)
void setInitCapture(bool IC)
Declared at: clang/include/clang/AST/Decl.h:1489
Parameters
- bool IC
¶void setInitStyle(
clang::VarDecl::InitializationStyle Style)
void setInitStyle(
clang::VarDecl::InitializationStyle Style)
Declared at: clang/include/clang/AST/Decl.h:1360
Parameters
- clang::VarDecl::InitializationStyle Style
¶void setInlineSpecified()
void setInlineSpecified()
Declared at: clang/include/clang/AST/Decl.h:1466
¶void setInstantiationOfStaticDataMember(
clang::VarDecl* VD,
clang::TemplateSpecializationKind TSK)
void setInstantiationOfStaticDataMember(
clang::VarDecl* VD,
clang::TemplateSpecializationKind TSK)
Description
Specify that this variable is an instantiation of the static data member VD.
Declared at: clang/include/clang/AST/Decl.h:1563
Parameters
- clang::VarDecl* VD
- clang::TemplateSpecializationKind TSK
¶void setNRVOVariable(bool NRVO)
void setNRVOVariable(bool NRVO)
Declared at: clang/include/clang/AST/Decl.h:1423
Parameters
- bool NRVO
¶void setObjCForDecl(bool FRD)
void setObjCForDecl(bool FRD)
Declared at: clang/include/clang/AST/Decl.h:1444
Parameters
- bool FRD
¶void setPreviousDeclInSameBlockScope(bool Same)
void setPreviousDeclInSameBlockScope(bool Same)
Declared at: clang/include/clang/AST/Decl.h:1505
Parameters
- bool Same
¶void setStorageClass(clang::StorageClass SC)
void setStorageClass(clang::StorageClass SC)
Declared at: clang/include/clang/AST/Decl.h:1086
Parameters
- clang::StorageClass SC
¶void setTSCSpec(
clang::ThreadStorageClassSpecifier TSC)
void setTSCSpec(
clang::ThreadStorageClassSpecifier TSC)
Declared at: clang/include/clang/AST/Decl.h:1088
Parameters
- clang::ThreadStorageClassSpecifier TSC
¶void setTemplateSpecializationKind(
clang::TemplateSpecializationKind TSK,
clang::SourceLocation PointOfInstantiation =
clang::SourceLocation())
void setTemplateSpecializationKind(
clang::TemplateSpecializationKind TSK,
clang::SourceLocation PointOfInstantiation =
clang::SourceLocation())
Description
For a static data member that was instantiated from a static data member of a class template, set the template specialiation kind.
Declared at: clang/include/clang/AST/Decl.h:1558
Parameters
- clang::TemplateSpecializationKind TSK
- clang::SourceLocation PointOfInstantiation = clang::SourceLocation()