clang API Documentation
#include <Decl.h>


Classes | |
| class | ParmVarDeclBitfields |
| class | VarDeclBitfields |
Public Types | |
| enum | DefinitionKind { DeclarationOnly, TentativeDefinition, Definition } |
| typedef clang::StorageClass | StorageClass |
| typedef redeclarable_base::redecl_iterator | redecl_iterator |
Public Member Functions | |
| virtual SourceRange | getSourceRange () const |
| Source range that this declaration covers. | |
| StorageClass | getStorageClass () const |
| StorageClass | getStorageClassAsWritten () const |
| void | setStorageClass (StorageClass SC) |
| void | setStorageClassAsWritten (StorageClass SC) |
| void | setThreadSpecified (bool T) |
| bool | isThreadSpecified () const |
| bool | hasLocalStorage () const |
| bool | isStaticLocal () const |
| bool | hasExternalStorage () const |
| bool | hasGlobalStorage () const |
| bool | isExternC () const |
| Determines whether this variable is a variable with external, C linkage. | |
| bool | isLocalVarDecl () const |
| bool | isFunctionOrMethodVarDecl () const |
| bool | isStaticDataMember () const |
| Determines whether this is a static data member. | |
| virtual VarDecl * | getCanonicalDecl () |
| Retrieves the "canonical" declaration of the given declaration. | |
| const VarDecl * | getCanonicalDecl () const |
| DefinitionKind | isThisDeclarationADefinition () const |
| 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. | |
| DefinitionKind | hasDefinition () const |
| Check whether this variable is defined in this translation unit. | |
| VarDecl * | getActingDefinition () |
| Get the tentative definition that acts as the real definition in a TU. Returns null if there is a proper definition available. | |
| const VarDecl * | getActingDefinition () const |
| bool | isTentativeDefinitionNow () const |
| Determine whether this is a tentative definition of a variable in C. | |
| VarDecl * | getDefinition () |
| Get the real (not just tentative) definition for this declaration. | |
| const VarDecl * | getDefinition () const |
| virtual bool | isOutOfLine () const |
| Determine whether this is or was instantiated from an out-of-line definition of a static data member. | |
| VarDecl * | getOutOfLineDefinition () |
| If this is a static data member, find its out-of-line definition. | |
| bool | isFileVarDecl () const |
| isFileVarDecl - Returns true for file scoped variable declaration. | |
| const Expr * | getAnyInitializer () const |
| const Expr * | getAnyInitializer (const VarDecl *&D) const |
| bool | hasInit () const |
| const Expr * | getInit () const |
| Expr * | getInit () |
| Stmt ** | getInitAddress () |
| Retrieve the address of the initializer expression. | |
| void | setInit (Expr *I) |
| bool | extendsLifetimeOfTemporary () const |
| Determine whether this variable is a reference that extends the lifetime of its temporary initializer. | |
| bool | isUsableInConstantExpressions () const |
| Determine whether this variable's value can be used 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. | |
| EvaluatedStmt * | ensureEvaluatedStmt () const |
| APValue * | evaluateValue () const |
| Attempt to evaluate the value of the initializer attached to this declaration, and produce notes explaining why it cannot be evaluated or is not a constant expression. Returns a pointer to the value if evaluation succeeded, 0 otherwise. | |
| APValue * | evaluateValue (llvm::SmallVectorImpl< PartialDiagnosticAt > &Notes) const |
| APValue * | getEvaluatedValue () const |
| 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. | |
| bool | isInitKnownICE () const |
| Determines whether it is already known whether the initializer is an integral constant expression or not. | |
| bool | isInitICE () const |
| Determines whether the initializer is an integral constant expression, or in C++11, whether the initializer is a constant expression. | |
| bool | checkInitIsICE () const |
| Determine whether the value of the initializer attached to this declaration is an integral constant expression. | |
| void | setCXXDirectInitializer (bool T) |
| bool | hasCXXDirectInitializer () const |
| bool | isExceptionVariable () const |
| Determine whether this variable is the exception variable in a C++ catch statememt or an Objective-C statement. | |
| void | setExceptionVariable (bool EV) |
| bool | isNRVOVariable () const |
| Determine whether this local variable can be used with the named return value optimization (NRVO). | |
| void | setNRVOVariable (bool NRVO) |
| bool | isCXXForRangeDecl () const |
| Determine whether this variable is the for-range-declaration in a C++0x for-range statement. | |
| void | setCXXForRangeDecl (bool FRD) |
| bool | isARCPseudoStrong () const |
| 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. | |
| void | setARCPseudoStrong (bool ps) |
| bool | isConstexpr () const |
| Whether this variable is (C++0x) constexpr. | |
| void | setConstexpr (bool IC) |
| 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. | |
| TemplateSpecializationKind | getTemplateSpecializationKind () const |
| If this variable is a static data member, determine what kind of template specialization or instantiation this is. | |
| MemberSpecializationInfo * | getMemberSpecializationInfo () const |
| If this variable is an instantiation of a static data member of a class template specialization, retrieves the member specialization information. | |
| void | setTemplateSpecializationKind (TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation()) |
| For a static data member that was instantiated from a static data member of a class template, set the template specialiation kind. | |
Static Public Member Functions | |
| static const char * | getStorageClassSpecifierString (StorageClass SC) |
| static VarDecl * | Create (ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, StorageClass SCAsWritten) |
| static VarDecl * | CreateDeserialized (ASTContext &C, unsigned ID) |
| static bool | classof (const Decl *D) |
| static bool | classof (const VarDecl *D) |
| static bool | classofKind (Kind K) |
Protected Types | |
| enum | { NumParameterIndexBits = 8 } |
| typedef llvm::PointerUnion4 < Stmt *, EvaluatedStmt *, UnparsedDefaultArgument *, UninstantiatedDefaultArgument * > | InitType |
| typedef Redeclarable< VarDecl > | redeclarable_base |
Protected Member Functions | |
| VarDecl (Kind DK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass SC, StorageClass SCAsWritten) | |
| virtual VarDecl * | getNextRedeclaration () |
| Returns the next redeclaration or itself if this is the only decl. | |
| virtual VarDecl * | getPreviousDeclImpl () |
| Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain. | |
| virtual VarDecl * | getMostRecentDeclImpl () |
| Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chain. | |
Protected Attributes | |
| InitType | Init |
| The initializer for this variable or, for a ParmVarDecl, the C++ default argument. | |
| union { | |
| unsigned AllBits | |
| VarDeclBitfields VarDeclBits | |
| ParmVarDeclBitfields ParmVarDeclBits | |
| }; | |
Friends | |
| class | ASTDeclReader |
| class | StmtIteratorBase |
VarDecl - An instance of this class is created to represent a variable declaration or definition.
typedef llvm::PointerUnion4<Stmt *, EvaluatedStmt *, UnparsedDefaultArgument *, UninstantiatedDefaultArgument *> clang::VarDecl::InitType [protected] |
| typedef redeclarable_base::redecl_iterator clang::VarDecl::redecl_iterator |
typedef Redeclarable<VarDecl> clang::VarDecl::redeclarable_base [protected] |
| DeclarationOnly |
This declaration is only a declaration. |
| TentativeDefinition |
This declaration is a tentative definition. |
| Definition |
This declaration is definitely a definition. |
| clang::VarDecl::VarDecl | ( | Kind | DK, |
| DeclContext * | DC, | ||
| SourceLocation | StartLoc, | ||
| SourceLocation | IdLoc, | ||
| IdentifierInfo * | Id, | ||
| QualType | T, | ||
| TypeSourceInfo * | TInfo, | ||
| StorageClass | SC, | ||
| StorageClass | SCAsWritten | ||
| ) | [inline, protected] |
Definition at line 772 of file Decl.h.
References AllBits, and VarDeclBits.
Referenced by Create(), and CreateDeserialized().
| bool VarDecl::checkInitIsICE | ( | ) | const |
Determine whether the value of the initializer attached to this declaration is an integral constant expression.
Definition at line 1421 of file Decl.cpp.
References clang::EvaluatedStmt::CheckedICE, clang::EvaluatedStmt::CheckingICE, ensureEvaluatedStmt(), evaluateValue(), clang::Decl::getASTContext(), clang::ASTContext::getLangOptions(), Init, clang::EvaluatedStmt::IsICE, clang::Expr::isIntegerConstantExpr(), clang::Expr::isValueDependent(), clang::ValueDecl::isWeak(), and clang::EvaluatedStmt::Value.
Referenced by clang::Sema::CheckCompleteVariableDeclaration(), CheckICE(), DoMarkVarDeclReferenced(), and EvaluateVarDeclInit().
| static bool clang::VarDecl::classof | ( | const Decl * | D | ) | [inline, static] |
Reimplemented from clang::DeclaratorDecl.
Reimplemented in clang::ParmVarDecl, and clang::ImplicitParamDecl.
Definition at line 1144 of file Decl.h.
References classofKind(), and clang::Decl::getKind().
| static bool clang::VarDecl::classof | ( | const VarDecl * | D | ) | [inline, static] |
| static bool clang::VarDecl::classofKind | ( | Kind | K | ) | [inline, static] |
Reimplemented from clang::DeclaratorDecl.
Reimplemented in clang::ParmVarDecl, and clang::ImplicitParamDecl.
Definition at line 1146 of file Decl.h.
Referenced by classof().
| VarDecl * VarDecl::Create | ( | ASTContext & | C, |
| DeclContext * | DC, | ||
| SourceLocation | StartLoc, | ||
| SourceLocation | IdLoc, | ||
| IdentifierInfo * | Id, | ||
| QualType | T, | ||
| TypeSourceInfo * | TInfo, | ||
| StorageClass | S, | ||
| StorageClass | SCAsWritten | ||
| ) | [static] |
Definition at line 1144 of file Decl.cpp.
References VarDecl().
Referenced by clang::Sema::ActOnVariableDeclarator(), clang::Sema::BuildAnonymousStructOrUnion(), clang::Sema::BuildExceptionDeclaration(), BuildImplicitMemberInitializer(), clang::Sema::BuildObjCExceptionDecl(), BuildSingleCopyAssign(), clang::Sema::DeclClonePragmaWeak(), clang::ASTNodeImporter::VisitVarDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().
| VarDecl * VarDecl::CreateDeserialized | ( | ASTContext & | C, |
| unsigned | ID | ||
| ) | [static] |
Reimplemented in clang::ParmVarDecl, and clang::ImplicitParamDecl.
Definition at line 1151 of file Decl.cpp.
References clang::Decl::AllocateDeserializedDecl(), clang::SC_None, and VarDecl().
| EvaluatedStmt * VarDecl::ensureEvaluatedStmt | ( | ) | const |
Convert the initializer for this declaration to the elaborated EvaluatedStmt form, which contains extra information on the evaluated value of the initializer.
Definition at line 1363 of file Decl.cpp.
References clang::Decl::getASTContext(), Init, and S.
Referenced by checkInitIsICE(), evaluateValue(), clang::ASTNodeImporter::VisitVarDecl(), and clang::ASTDeclReader::VisitVarDecl().
| APValue * VarDecl::evaluateValue | ( | ) | const |
Attempt to evaluate the value of the initializer attached to this declaration, and produce notes explaining why it cannot be evaluated or is not a constant expression. Returns a pointer to the value if evaluation succeeded, 0 otherwise.
Definition at line 1374 of file Decl.cpp.
Referenced by clang::Sema::CheckCompleteVariableDeclaration(), checkInitIsICE(), clang::CodeGen::CodeGenModule::EmitConstantInit(), and EvaluateVarDeclInit().
| APValue * VarDecl::evaluateValue | ( | llvm::SmallVectorImpl< PartialDiagnosticAt > & | Notes | ) | const |
Definition at line 1379 of file Decl.cpp.
References clang::EvaluatedStmt::CheckedICE, clang::frontend::CPlusPlus0x, ensureEvaluatedStmt(), clang::Expr::EvaluateAsInitializer(), clang::EvaluatedStmt::Evaluated, clang::Decl::getASTContext(), Init, clang::EvaluatedStmt::IsEvaluating, clang::EvaluatedStmt::IsICE, clang::APValue::isUninit(), clang::Expr::isValueDependent(), clang::EvaluatedStmt::Value, and clang::EvaluatedStmt::WasEvaluated.
| bool VarDecl::extendsLifetimeOfTemporary | ( | ) | const |
Determine whether this variable is a reference that extends the lifetime of its temporary initializer.
A reference extends the lifetime of its temporary initializer if it's initializer is an rvalue that would normally go out of scope at the end of the initializer (a full expression). In such cases, the reference itself takes ownership of the temporary, which will be destroyed when the reference goes out of scope. For example:
const int &r = 1.0; // creates a temporary of type 'int'
Definition at line 1457 of file Decl.cpp.
References getInit(), and clang::ValueDecl::getType().
| VarDecl * VarDecl::getActingDefinition | ( | ) |
Get the tentative definition that acts as the real definition in a TU. Returns null if there is a proper definition available.
Definition at line 1239 of file Decl.cpp.
References Definition, clang::Redeclarable< VarDecl >::getFirstDeclaration(), isThisDeclarationADefinition(), clang::Redeclarable< decl_type >::redecls_begin(), clang::Redeclarable< decl_type >::redecls_end(), and TentativeDefinition.
Referenced by clang::Sema::ActOnEndOfTranslationUnit(), and getActingDefinition().
| const VarDecl* clang::VarDecl::getActingDefinition | ( | ) | const [inline] |
Definition at line 921 of file Decl.h.
References getActingDefinition().
| const Expr* clang::VarDecl::getAnyInitializer | ( | ) | const [inline] |
getAnyInitializer - Get the initializer for this variable, no matter which declaration it is attached to.
Definition at line 958 of file Decl.h.
Referenced by clang::Sema::AddCXXDirectInitializerToDecl(), clang::Sema::AddInitializerToDecl(), DoMarkVarDeclReferenced(), EvaluateVarDeclInit(), HandleLValueToRValueConversion(), clang::ASTNodeImporter::VisitVarDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().
getAnyInitializer - Get the initializer for this variable, no matter which declaration it is attached to. Also get that declaration.
Definition at line 1290 of file Decl.cpp.
References clang::Redeclarable< VarDecl >::redecls_begin(), and clang::Redeclarable< VarDecl >::redecls_end().
| VarDecl * VarDecl::getCanonicalDecl | ( | ) | [virtual] |
Retrieves the "canonical" declaration of the given declaration.
Reimplemented from clang::Decl.
Definition at line 1185 of file Decl.cpp.
References clang::Redeclarable< VarDecl >::getFirstDeclaration().
Referenced by getCanonicalDecl(), clang::TagDecl::getCanonicalDecl(), clang::EnumDecl::getCanonicalDecl(), clang::FunctionDecl::isDeleted(), isInstantiationOfStaticDataMember(), and MarkVarDeclODRUsed().
| const VarDecl* clang::VarDecl::getCanonicalDecl | ( | ) | const [inline] |
Reimplemented from clang::Decl.
Definition at line 899 of file Decl.h.
References getCanonicalDecl().
| VarDecl * VarDecl::getDefinition | ( | ) |
Get the real (not just tentative) definition for this declaration.
Definition at line 1269 of file Decl.cpp.
References Definition, clang::Redeclarable< VarDecl >::getFirstDeclaration(), clang::Redeclarable< decl_type >::redecls_begin(), and clang::Redeclarable< decl_type >::redecls_end().
Referenced by clang::Sema::ActOnEndOfTranslationUnit(), clang::Sema::ActOnVariableDeclarator(), clang::Sema::AddCXXDirectInitializerToDecl(), clang::Sema::AddInitializerToDecl(), clang::EnumDecl::enumerator_begin(), clang::EnumDecl::enumerator_end(), getDefinition(), clang::RecordDecl::getDefinition(), HandleLValueToRValueConversion(), clang::Sema::InstantiateStaticDataMemberDefinition(), clang::Sema::MergeVarDecl(), clang::Sema::RequireCompleteExprType(), ShouldRemoveFromUnused(), and clang::ASTNodeImporter::VisitVarDecl().
| const VarDecl* clang::VarDecl::getDefinition | ( | ) | const [inline] |
Definition at line 931 of file Decl.h.
References getDefinition().
| APValue* clang::VarDecl::getEvaluatedValue | ( | ) | const [inline] |
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.
Definition at line 1044 of file Decl.h.
References Init.
Referenced by EvaluateVarDeclInit().
| const Expr* clang::VarDecl::getInit | ( | ) | const [inline] |
Definition at line 970 of file Decl.h.
Referenced by clang::CodeGen::CodeGenFunction::AddInitializerToStaticVarDecl(), clang::Sema::BuildCXXDefaultArgExpr(), clang::Sema::BuildDeclaratorGroup(), clang::Sema::CheckCompleteVariableDeclaration(), clang::ASTContext::DeclMustBeEmitted(), DiagnoseUninitializedUse(), clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(), clang::CodeGen::CodeGenFunction::EmitAutoVarInit(), clang::CodeGen::CodeGenModule::EmitConstantInit(), clang::CodeGen::CodeGenFunction::EmitCXXGlobalVarDeclInit(), EmitDeclInit(), clang::CodeGen::CodeGenFunction::EmitStaticVarDecl(), clang::CodeGen::CodeGenModule::EmitTentativeDefinition(), EvalAddr(), EvalVal(), extendsLifetimeOfTemporary(), clang::ParmVarDecl::getDefaultArg(), clang::ParmVarDecl::getDefaultArgRange(), clang::CodeGen::CodeGenModule::GetLLVMLinkageVarDefinition(), clang::CXXForRangeStmt::getRangeInit(), getSourceRange(), clang::ParmVarDecl::hasDefaultArg(), InitCatchParam(), clang::Sema::MergeCXXFunctionDecl(), SuggestInitializationFixit(), tryCaptureAsConstant(), clang::CFGRecStmtVisitor< ImplClass >::VisitConditionVariableInit(), clang::ento::CallEnterExitBRVisitor::VisitNode(), clang::ento::ExprEngine::VisitObjCForCollectionStmt(), clang::ASTDeclWriter::VisitParmVarDecl(), clang::idx::ASTVisitor< ImplClass >::VisitVarDecl(), clang::ASTDeclWriter::VisitVarDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().
| Expr* clang::VarDecl::getInit | ( | ) | [inline] |
| Stmt** clang::VarDecl::getInitAddress | ( | ) | [inline] |
Retrieve the address of the initializer expression.
Definition at line 995 of file Decl.h.
References Init.
Referenced by clang::StmtIteratorBase::GetDeclExpr().
| VarDecl * 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.
Definition at line 1470 of file Decl.cpp.
References getMemberSpecializationInfo().
Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::CheckMemberSpecialization(), DoMarkVarDeclReferenced(), clang::Sema::InstantiateClassMembers(), clang::Sema::InstantiateStaticDataMemberDefinition(), isInstantiationOfStaticDataMember(), and isOutOfLine().
| MemberSpecializationInfo * VarDecl::getMemberSpecializationInfo | ( | ) | const |
If this variable is an instantiation of a static data member of a class template specialization, retrieves the member specialization information.
Definition at line 1484 of file Decl.cpp.
References clang::Decl::getASTContext(), and clang::ASTContext::getInstantiatedFromStaticDataMember().
Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::CheckMemberSpecialization(), DoMarkVarDeclReferenced(), getInstantiatedFromStaticDataMember(), getTemplateSpecializationKind(), clang::Sema::InstantiateClassMembers(), setTemplateSpecializationKind(), clang::ASTWriter::StaticDataMemberInstantiated(), and clang::ASTDeclWriter::VisitVarDecl().
| virtual VarDecl* clang::VarDecl::getMostRecentDeclImpl | ( | ) | [inline, protected, virtual] |
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chain.
Reimplemented from clang::Decl.
Definition at line 790 of file Decl.h.
References clang::Redeclarable< VarDecl >::getMostRecentDecl().
| virtual VarDecl* clang::VarDecl::getNextRedeclaration | ( | ) | [inline, protected, virtual] |
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.
Reimplemented from clang::Decl.
Definition at line 786 of file Decl.h.
References clang::Redeclarable< VarDecl >::RedeclLink.
| VarDecl * VarDecl::getOutOfLineDefinition | ( | ) |
If this is a static data member, find its out-of-line definition.
Definition at line 1318 of file Decl.cpp.
References isStaticDataMember(), clang::Redeclarable< VarDecl >::redecls_begin(), and clang::Redeclarable< VarDecl >::redecls_end().
Referenced by clang::Sema::InstantiateClassMembers(), and clang::Sema::InstantiateStaticDataMemberDefinition().
| virtual VarDecl* clang::VarDecl::getPreviousDeclImpl | ( | ) | [inline, protected, virtual] |
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain.
Reimplemented from clang::Decl.
Definition at line 787 of file Decl.h.
References clang::Redeclarable< VarDecl >::getPreviousDecl().
| SourceRange VarDecl::getSourceRange | ( | ) | const [virtual] |
Source range that this declaration covers.
Reimplemented from clang::DeclaratorDecl.
Reimplemented in clang::ParmVarDecl.
Definition at line 1165 of file Decl.cpp.
References getInit(), clang::Decl::getLocEnd(), and clang::DeclaratorDecl::getOuterLocStart().
Referenced by clang::Sema::AddCXXDirectInitializerToDecl(), clang::Sema::CheckConditionVariable(), clang::IfStmt::setConditionVariable(), clang::SwitchStmt::setConditionVariable(), clang::WhileStmt::setConditionVariable(), and clang::ForStmt::setConditionVariable().
| StorageClass clang::VarDecl::getStorageClass | ( | ) | const [inline] |
Definition at line 810 of file Decl.h.
References VarDeclBits.
Referenced by clang::Sema::AddInitializerToDecl(), clang::Sema::CheckVariableDeclaration(), clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(), clang::CodeGen::CodeGenFunction::EmitVarDecl(), getLVForNamespaceScopeDecl(), hasExternalStorage(), hasLocalStorage(), isStaticLocal(), clang::Sema::MergeVarDecl(), setStorageClass(), clang::Sema::SubstParmVarDecl(), clang::TreeTransform< Derived >::TransformFunctionTypeParam(), clang::ASTDeclWriter::VisitParmVarDecl(), clang::ASTNodeImporter::VisitParmVarDecl(), clang::idx::EntityGetter::VisitVarDecl(), clang::ASTDeclWriter::VisitVarDecl(), clang::ASTNodeImporter::VisitVarDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().
| StorageClass clang::VarDecl::getStorageClassAsWritten | ( | ) | const [inline] |
Definition at line 813 of file Decl.h.
References VarDeclBits.
Referenced by clang::Sema::ActOnCXXForRangeDecl(), clang::Sema::AddInitializerToDecl(), isThisDeclarationADefinition(), clang::Sema::SubstParmVarDecl(), clang::TreeTransform< Derived >::TransformFunctionTypeParam(), clang::ASTNodeImporter::VisitParmVarDecl(), clang::ASTDeclWriter::VisitVarDecl(), clang::ASTNodeImporter::VisitVarDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().
| const char * VarDecl::getStorageClassSpecifierString | ( | StorageClass | SC | ) | [static] |
getStorageClassSpecifierString - Return the string used to specify the storage class
It is illegal to call this function with SC == None.
Definition at line 1130 of file Decl.cpp.
References clang::SC_Auto, clang::SC_Extern, clang::SC_None, clang::SC_OpenCLWorkGroupLocal, clang::SC_PrivateExtern, clang::SC_Register, and clang::SC_Static.
| TemplateSpecializationKind VarDecl::getTemplateSpecializationKind | ( | ) | const |
If this variable is a static data member, determine what kind of template specialization or instantiation this is.
Definition at line 1477 of file Decl.cpp.
References getMemberSpecializationInfo(), and clang::TSK_Undeclared.
Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::CheckMemberSpecialization(), clang::ASTContext::GetGVALinkageForVariable(), clang::Sema::InstantiateStaticDataMemberDefinition(), isThisDeclarationADefinition(), and clang::Sema::PerformPendingInstantiations().
| bool clang::VarDecl::hasCXXDirectInitializer | ( | ) | const [inline] |
hasCXXDirectInitializer - If true, the initializer was a 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. Clients can distinguish between "int x(1);" and "int x=1;" by checking hasCXXDirectInitializer.
Definition at line 1084 of file Decl.h.
References VarDeclBits.
Referenced by clang::ASTDeclWriter::VisitParmVarDecl(), clang::ASTDeclWriter::VisitVarDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().
| VarDecl::DefinitionKind VarDecl::hasDefinition | ( | ) | const |
Check whether this variable is defined in this translation unit.
Definition at line 1279 of file Decl.cpp.
References DeclarationOnly, clang::Redeclarable< VarDecl >::getFirstDeclaration(), clang::Redeclarable< decl_type >::redecls_begin(), and clang::Redeclarable< decl_type >::redecls_end().
Referenced by MarkVarDeclODRUsed().
| bool clang::VarDecl::hasExternalStorage | ( | ) | const [inline] |
hasExternStorage - Returns true if a variable has extern or __private_extern__ storage.
Definition at line 847 of file Decl.h.
References getStorageClass(), clang::SC_Extern, and clang::SC_PrivateExtern.
Referenced by clang::Sema::AddInitializerToDecl(), clang::Sema::CheckVariableDeclaration(), EmitGlobalVarDeclLValue(), clang::CodeGen::CodeGenModule::GetLLVMLinkageVarDefinition(), isThisDeclarationADefinition(), and clang::Sema::MergeVarDecl().
| bool clang::VarDecl::hasGlobalStorage | ( | ) | const [inline] |
hasGlobalStorage - Returns true for all variables that do not have local storage. This includs all global variables as well as static variables declared within a function.
Definition at line 855 of file Decl.h.
References hasLocalStorage().
Referenced by clang::Sema::CheckCompleteVariableDeclaration(), clang::Sema::CheckShadow(), clang::Sema::CheckVariableDeclaration(), EmitDeclInit(), clang::CodeGen::CodeGenFunction::EmitReferenceBindingToExpr(), clang::Sema::FinalizeVarWithDestructor(), clang::CodeGen::CodeGenModule::GetAddrOfGlobalVar(), clang::ento::MemRegionManager::getVarRegion(), isAlwaysAlive(), and isTrackedVar().
| bool clang::VarDecl::hasInit | ( | ) | const [inline] |
Definition at line 967 of file Decl.h.
References Init.
Referenced by EvalAddr(), EvalVal(), isThisDeclarationADefinition(), and MarkVarDeclODRUsed().
| bool clang::VarDecl::hasLocalStorage | ( | ) | const [inline] |
hasLocalStorage - Returns true if a variable with function scope is a non-static local variable.
Definition at line 829 of file Decl.h.
References getStorageClass(), isFileVarDecl(), clang::SC_Auto, and clang::SC_None.
Referenced by clang::Sema::ActOnForStmt(), clang::Sema::ActOnObjCForCollectionStmt(), clang::Sema::ActOnStartOfLambdaDefinition(), clang::Sema::ActOnVariableDeclarator(), clang::Sema::AddInitializerToDecl(), clang::Sema::CheckCompleteVariableDeclaration(), clang::Sema::CheckVariableDeclaration(), EvalAddr(), clang::Expr::EvaluateAsInitializer(), EvalVal(), clang::CodeGen::CodeGenFunction::GenerateBlockFunction(), clang::Sema::getCopyElisionCandidate(), clang::ento::MemRegionManager::getVarRegion(), handleCleanupAttr(), hasGlobalStorage(), isInvalidICRSource(), clang::PseudoConstantAnalysis::isPseudoConstant(), shouldAddConstQualToVarRef(), shouldBuildBlockDeclRef(), shouldExtendReceiverForInnerPointerMessage(), clang::Sema::TryCaptureVar(), and clang::idx::EntityGetter::VisitVarDecl().
| bool clang::VarDecl::isARCPseudoStrong | ( | ) | const [inline] |
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.
Definition at line 1117 of file Decl.h.
References VarDeclBits.
Referenced by CheckForModifiableLvalue(), clang::CodeGen::CodeGenFunction::emitAutoVarTypeCleanup(), clang::CodeGen::CodeGenFunction::EmitObjCForCollectionStmt(), clang::CodeGen::CodeGenFunction::EmitParmDecl(), clang::ASTDeclWriter::VisitParmVarDecl(), and clang::ASTDeclWriter::VisitVarDecl().
| bool clang::VarDecl::isConstexpr | ( | ) | const [inline] |
Whether this variable is (C++0x) constexpr.
Definition at line 1121 of file Decl.h.
References VarDeclBits.
Referenced by clang::Sema::ActOnCXXForRangeDecl(), clang::Sema::AddInitializerToDecl(), clang::Sema::CheckCompleteVariableDeclaration(), HandleLValueToRValueConversion(), isUsableInConstantExpressions(), and clang::TemplateDeclInstantiator::VisitVarDecl().
| bool clang::VarDecl::isCXXForRangeDecl | ( | ) | const [inline] |
Determine whether this variable is the for-range-declaration in a C++0x for-range statement.
Definition at line 1110 of file Decl.h.
References VarDeclBits.
Referenced by clang::ASTDeclWriter::VisitVarDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().
| bool clang::VarDecl::isExceptionVariable | ( | ) | const [inline] |
Determine whether this variable is the exception variable in a C++ catch statememt or an Objective-C statement.
Definition at line 1090 of file Decl.h.
References VarDeclBits.
Referenced by clang::Sema::getCopyElisionCandidate(), isTrackedVar(), clang::ASTDeclWriter::VisitParmVarDecl(), and clang::ASTDeclWriter::VisitVarDecl().
| bool VarDecl::isExternC | ( | ) | const |
Determines whether this variable is a variable with external, C linkage.
Definition at line 1171 of file Decl.cpp.
References clang::ExternalLinkage, clang::Decl::getASTContext(), clang::Decl::getDeclContext(), clang::ASTContext::getLangOptions(), clang::NamedDecl::getLinkage(), clang::DeclContext::isExternCContext(), and clang::DeclContext::isRecord().
Referenced by clang::Sema::ActOnVariableDeclarator(), and clang::Sema::CheckVariableDeclaration().
| bool clang::VarDecl::isFileVarDecl | ( | ) | const [inline] |
isFileVarDecl - Returns true for file scoped variable declaration.
Definition at line 943 of file Decl.h.
References clang::Decl::getDeclContext(), clang::Decl::getKind(), and isStaticDataMember().
Referenced by clang::Sema::AddInitializerToDecl(), clang::Sema::CheckVariableDeclaration(), clang::ASTContext::DeclMustBeEmitted(), EmitGlobalVarDeclLValue(), hasLocalStorage(), isStaticLocal(), isThisDeclarationADefinition(), clang::Sema::MergeVarDecl(), and clang::ASTNodeImporter::VisitVarDecl().
| bool clang::VarDecl::isFunctionOrMethodVarDecl | ( | ) | const [inline] |
isFunctionOrMethodVarDecl - Similar to isLocalVarDecl, but excludes variables declared in blocks.
Definition at line 877 of file Decl.h.
References clang::Decl::getDeclContext(), clang::DeclContext::getDeclKind(), clang::Decl::getKind(), clang::DeclContext::getRedeclContext(), and clang::DeclContext::isFunctionOrMethod().
| bool clang::VarDecl::isInitICE | ( | ) | const [inline] |
Determines whether the initializer is an integral constant expression, or in C++11, whether the initializer is a constant expression.
Definition at line 1066 of file Decl.h.
References Init, and isInitKnownICE().
Referenced by clang::Sema::CheckCompleteVariableDeclaration(), and clang::ASTDeclWriter::VisitVarDecl().
| bool clang::VarDecl::isInitKnownICE | ( | ) | const [inline] |
Determines whether it is already known whether the initializer is an integral constant expression or not.
Definition at line 1054 of file Decl.h.
References Init.
Referenced by isInitICE(), and clang::ASTDeclWriter::VisitVarDecl().
| bool clang::VarDecl::isLocalVarDecl | ( | ) | const [inline] |
isLocalVarDecl - 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; }
Definition at line 867 of file Decl.h.
References clang::Decl::getDeclContext(), and clang::Decl::getKind().
Referenced by clang::Sema::ActOnForStmt(), clang::Sema::AddInitializerToDecl(), clang::CodeGen::CodeGenFunction::EmitDecl(), isTrackedVar(), and clang::Sema::MergeVarDecl().
| bool clang::VarDecl::isNRVOVariable | ( | ) | const [inline] |
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.
Definition at line 1105 of file Decl.h.
References VarDeclBits.
Referenced by clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(), clang::CodeGen::CodeGenFunction::EmitReturnStmt(), and clang::ASTDeclWriter::VisitVarDecl().
| bool VarDecl::isOutOfLine | ( | ) | const [virtual] |
Determine whether this is or was instantiated from an out-of-line definition of a static data member.
Reimplemented from clang::Decl.
Definition at line 1302 of file Decl.cpp.
References getInstantiatedFromStaticDataMember(), clang::Decl::isOutOfLine(), and isStaticDataMember().
Referenced by isThisDeclarationADefinition(), clang::Sema::MergeVarDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().
| bool clang::VarDecl::isStaticDataMember | ( | ) | const [inline] |
Determines whether this is a static data member.
This will only be true in C++, and applies to, e.g., the variable 'x' in:
struct S { static int x; };
Definition at line 893 of file Decl.h.
References clang::Decl::getDeclContext(), clang::Decl::getKind(), and clang::DeclContext::isRecord().
Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::AddCXXDirectInitializerToDecl(), clang::Sema::AddInitializerToDecl(), clang::Sema::CheckMemberSpecialization(), DoMarkVarDeclReferenced(), clang::ASTContext::GetGVALinkageForVariable(), clang::ASTContext::getInstantiatedFromStaticDataMember(), getOutOfLineDefinition(), clang::Sema::InstantiateClassMembers(), clang::Sema::InstantiateStaticDataMemberDefinition(), isFileVarDecl(), isInstantiationOfStaticDataMember(), isOutOfLine(), isThisDeclarationADefinition(), MarkVarDeclODRUsed(), clang::Sema::MergeVarDecl(), clang::Sema::PerformPendingInstantiations(), clang::ASTContext::setInstantiatedFromStaticDataMember(), clang::ASTDeclWriter::VisitParmVarDecl(), clang::ASTDeclWriter::VisitVarDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().
| bool clang::VarDecl::isStaticLocal | ( | ) | const [inline] |
isStaticLocal - Returns true if a variable with function scope is a static local variable.
Definition at line 841 of file Decl.h.
References getStorageClass(), isFileVarDecl(), and clang::SC_Static.
Referenced by clang::Sema::CheckCompleteVariableDeclaration(), clang::Sema::FinalizeVarWithDestructor(), clang::ento::MemRegionManager::getVarRegion(), and clang::PseudoConstantAnalysis::isPseudoConstant().
| bool VarDecl::isTentativeDefinitionNow | ( | ) | const |
Determine whether this is a tentative definition of a variable in C.
Definition at line 1257 of file Decl.cpp.
References Definition, isThisDeclarationADefinition(), clang::Redeclarable< VarDecl >::redecls_begin(), clang::Redeclarable< VarDecl >::redecls_end(), and TentativeDefinition.
| VarDecl::DefinitionKind VarDecl::isThisDeclarationADefinition | ( | ) | const |
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.
Definition at line 1189 of file Decl.cpp.
References DeclarationOnly, Definition, clang::Decl::getASTContext(), clang::ASTContext::getLangOptions(), clang::Redeclarable< VarDecl >::getPreviousDecl(), clang::Redeclarable< decl_type >::getPreviousDecl(), getStorageClassAsWritten(), getTemplateSpecializationKind(), hasExternalStorage(), hasInit(), clang::InternalLinkage, isFileVarDecl(), isOutOfLine(), isStaticDataMember(), clang::SC_Extern, clang::SC_PrivateExtern, TentativeDefinition, and clang::TSK_ExplicitSpecialization.
Referenced by clang::ASTContext::DeclMustBeEmitted(), getActingDefinition(), isTentativeDefinitionNow(), and clang::Sema::MergeVarDecl().
| bool clang::VarDecl::isThreadSpecified | ( | ) | const [inline] |
Definition at line 823 of file Decl.h.
References VarDeclBits.
Referenced by clang::CodeGen::CodeGenFunction::AddInitializerToStaticVarDecl(), clang::CodeGen::CodeGenFunction::CreateStaticVarDecl(), EmitDeclInit(), clang::CodeGen::CodeGenModule::GetLLVMLinkageVarDefinition(), clang::Sema::MergeVarDecl(), clang::ASTDeclWriter::VisitParmVarDecl(), clang::ASTDeclWriter::VisitVarDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().
| bool VarDecl::isUsableInConstantExpressions | ( | ) | const |
Determine whether this variable's value can be used 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.
Definition at line 1340 of file Decl.cpp.
References clang::Decl::getASTContext(), clang::ASTContext::getLangOptions(), clang::ValueDecl::getType(), isConstexpr(), and clang::isIntegralOrEnumerationType().
Referenced by clang::Sema::CheckCompleteVariableDeclaration(), and DoMarkVarDeclReferenced().
| void clang::VarDecl::setARCPseudoStrong | ( | bool | ps | ) | [inline] |
Definition at line 1118 of file Decl.h.
References VarDeclBits.
Referenced by clang::Sema::ActOnForEachDeclStmt().
| void clang::VarDecl::setConstexpr | ( | bool | IC | ) | [inline] |
Definition at line 1122 of file Decl.h.
References VarDeclBits.
Referenced by clang::Sema::ActOnVariableDeclarator(), clang::Sema::AddInitializerToDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().
| void clang::VarDecl::setCXXDirectInitializer | ( | bool | T | ) | [inline] |
Definition at line 1076 of file Decl.h.
References VarDeclBits.
Referenced by clang::Sema::AddCXXDirectInitializerToDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().
| void clang::VarDecl::setCXXForRangeDecl | ( | bool | FRD | ) | [inline] |
Definition at line 1111 of file Decl.h.
References VarDeclBits.
Referenced by clang::Sema::ActOnCXXForRangeDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().
| void clang::VarDecl::setExceptionVariable | ( | bool | EV | ) | [inline] |
Definition at line 1093 of file Decl.h.
References VarDeclBits.
Referenced by clang::Sema::BuildExceptionDeclaration(), and clang::Sema::BuildObjCExceptionDecl().
| void VarDecl::setInit | ( | Expr * | I | ) |
Definition at line 1331 of file Decl.cpp.
References clang::ASTContext::Deallocate(), clang::Decl::getASTContext(), and Init.
Referenced by clang::Sema::ActOnForEachDeclStmt(), clang::Sema::AddCXXDirectInitializerToDecl(), clang::Sema::AddInitializerToDecl(), clang::Sema::BuildExceptionDeclaration(), BuildSingleCopyAssign(), clang::Sema::InitializeVarWithConstructor(), clang::ASTNodeImporter::VisitVarDecl(), and clang::ASTDeclReader::VisitVarDecl().
| void clang::VarDecl::setNRVOVariable | ( | bool | NRVO | ) | [inline] |
Definition at line 1106 of file Decl.h.
References VarDeclBits.
| void VarDecl::setStorageClass | ( | StorageClass | SC | ) |
Definition at line 1157 of file Decl.cpp.
References clang::NamedDecl::ClearLinkageCache(), getStorageClass(), clang::isLegalForVariable(), and VarDeclBits.
Referenced by clang::Sema::MergeVarDecl().
| void clang::VarDecl::setStorageClassAsWritten | ( | StorageClass | SC | ) | [inline] |
Definition at line 817 of file Decl.h.
References clang::isLegalForVariable(), and VarDeclBits.
| void VarDecl::setTemplateSpecializationKind | ( | TemplateSpecializationKind | TSK, |
| SourceLocation | PointOfInstantiation = SourceLocation() |
||
| ) |
For a static data member that was instantiated from a static data member of a class template, set the template specialiation kind.
Definition at line 1488 of file Decl.cpp.
References getMemberSpecializationInfo(), clang::MemberSpecializationInfo::getPointOfInstantiation(), clang::SourceLocation::isInvalid(), clang::SourceLocation::isValid(), clang::MemberSpecializationInfo::setPointOfInstantiation(), clang::MemberSpecializationInfo::setTemplateSpecializationKind(), and clang::TSK_ExplicitSpecialization.
Referenced by clang::Sema::CheckMemberSpecialization(), clang::Sema::InstantiateClassMembers(), and clang::Sema::InstantiateStaticDataMemberDefinition().
| void clang::VarDecl::setThreadSpecified | ( | bool | T | ) | [inline] |
Definition at line 822 of file Decl.h.
References VarDeclBits.
Referenced by clang::Sema::ActOnVariableDeclarator(), and clang::TemplateDeclInstantiator::VisitVarDecl().
friend class ASTDeclReader [friend] |
Reimplemented from clang::DeclaratorDecl.
friend class StmtIteratorBase [friend] |
union { ... } [protected] |
| unsigned clang::VarDecl::AllBits |
InitType clang::VarDecl::Init [mutable, protected] |
The initializer for this variable or, for a ParmVarDecl, the C++ default argument.
Definition at line 699 of file Decl.h.
Referenced by checkInitIsICE(), ensureEvaluatedStmt(), evaluateValue(), getEvaluatedValue(), getInit(), getInitAddress(), clang::EnumConstantDecl::getInitExpr(), clang::ParmVarDecl::getUninstantiatedDefaultArg(), hasInit(), clang::ParmVarDecl::hasUninstantiatedDefaultArg(), clang::ParmVarDecl::hasUnparsedDefaultArg(), isInitICE(), isInitKnownICE(), clang::ParmVarDecl::setDefaultArg(), setInit(), clang::EnumConstantDecl::setInitExpr(), clang::ParmVarDecl::setUninstantiatedDefaultArg(), and clang::ParmVarDecl::setUnparsedDefaultArg().
Definition at line 769 of file Decl.h.
Referenced by clang::ParmVarDecl::getFunctionScopeDepth(), clang::ParmVarDecl::getObjCDeclQualifier(), clang::ParmVarDecl::hasInheritedDefaultArg(), clang::ParmVarDecl::isKNRPromoted(), clang::ParmVarDecl::isObjCMethodParameter(), clang::ParmVarDecl::ParmVarDecl(), clang::ParmVarDecl::setHasInheritedDefaultArg(), clang::ParmVarDecl::setKNRPromoted(), clang::ParmVarDecl::setObjCDeclQualifier(), clang::ParmVarDecl::setObjCMethodScopeInfo(), clang::ParmVarDecl::setScopeInfo(), and clang::ASTDeclReader::VisitParmVarDecl().
| VarDeclBitfields clang::VarDecl::VarDeclBits |
Definition at line 768 of file Decl.h.
Referenced by getStorageClass(), getStorageClassAsWritten(), hasCXXDirectInitializer(), isARCPseudoStrong(), isConstexpr(), isCXXForRangeDecl(), isExceptionVariable(), isNRVOVariable(), isThreadSpecified(), setARCPseudoStrong(), setConstexpr(), setCXXDirectInitializer(), setCXXForRangeDecl(), setExceptionVariable(), setNRVOVariable(), setStorageClass(), setStorageClassAsWritten(), setThreadSpecified(), VarDecl(), and clang::ASTDeclReader::VisitVarDecl().