clang API Documentation
Describes an entity that is being initialized. More...
#include <Initialization.h>

Public Types | |
| enum | EntityKind { EK_Variable, EK_Parameter, EK_Result, EK_Exception, EK_Member, EK_ArrayElement, EK_New, EK_Temporary, EK_Base, EK_Delegating, EK_VectorElement, EK_BlockElement, EK_ComplexElement } |
| Specifies the kind of entity being initialized. More... | |
Public Member Functions | |
| EntityKind | getKind () const |
| Determine the kind of initialization. | |
| const InitializedEntity * | getParent () const |
| Retrieve the parent of the entity being initialized, when the initialization itself is occurring within the context of a larger initialization. | |
| QualType | getType () const |
| Retrieve type being initialized. | |
| TypeSourceInfo * | getTypeSourceInfo () const |
| Retrieve complete type-source information for the object being constructed, if known. | |
| DeclarationName | getName () const |
| Retrieve the name of the entity being initialized. | |
| DeclaratorDecl * | getDecl () const |
| Retrieve the variable, parameter, or field being initialized. | |
| bool | allowsNRVO () const |
| Determine whether this initialization allows the named return value optimization, which also applies to thrown objects. | |
| bool | isParameterConsumed () const |
| Determine whether this initialization consumes the parameter. | |
| CXXBaseSpecifier * | getBaseSpecifier () const |
| Retrieve the base specifier. | |
| bool | isInheritedVirtualBase () const |
| Return whether the base is an inherited virtual base. | |
| SourceLocation | getReturnLoc () const |
| Determine the location of the 'return' keyword when initializing the result of a function call. | |
| SourceLocation | getThrowLoc () const |
| Determine the location of the 'throw' keyword when initializing an exception object. | |
| void | setElementIndex (unsigned Index) |
| If this is already the initializer for an array or vector element, sets the element index. | |
Static Public Member Functions | |
| static InitializedEntity | InitializeVariable (VarDecl *Var) |
| Create the initialization entity for a variable. | |
| static InitializedEntity | InitializeParameter (ASTContext &Context, ParmVarDecl *Parm) |
| Create the initialization entity for a parameter. | |
| static InitializedEntity | InitializeParameter (ASTContext &Context, QualType Type, bool Consumed) |
| Create the initialization entity for a parameter that is only known by its type. | |
| static InitializedEntity | InitializeResult (SourceLocation ReturnLoc, QualType Type, bool NRVO) |
| Create the initialization entity for the result of a function. | |
| static InitializedEntity | InitializeBlock (SourceLocation BlockVarLoc, QualType Type, bool NRVO) |
| static InitializedEntity | InitializeException (SourceLocation ThrowLoc, QualType Type, bool NRVO) |
| Create the initialization entity for an exception object. | |
| static InitializedEntity | InitializeNew (SourceLocation NewLoc, QualType Type) |
| Create the initialization entity for an object allocated via new. | |
| static InitializedEntity | InitializeTemporary (QualType Type) |
| Create the initialization entity for a temporary. | |
| static InitializedEntity | InitializeTemporary (TypeSourceInfo *TypeInfo) |
| Create the initialization entity for a temporary. | |
| static InitializedEntity | InitializeBase (ASTContext &Context, CXXBaseSpecifier *Base, bool IsInheritedVirtualBase) |
| Create the initialization entity for a base class subobject. | |
| static InitializedEntity | InitializeDelegation (QualType Type) |
| Create the initialization entity for a delegated constructor. | |
| static InitializedEntity | InitializeMember (FieldDecl *Member, const InitializedEntity *Parent=0) |
| Create the initialization entity for a member subobject. | |
| static InitializedEntity | InitializeMember (IndirectFieldDecl *Member, const InitializedEntity *Parent=0) |
| Create the initialization entity for a member subobject. | |
| static InitializedEntity | InitializeElement (ASTContext &Context, unsigned Index, const InitializedEntity &Parent) |
| Create the initialization entity for an array element. | |
Describes an entity that is being initialized.
Definition at line 38 of file Initialization.h.
Specifies the kind of entity being initialized.
| EK_Variable |
The entity being initialized is a variable. |
| EK_Parameter |
The entity being initialized is a function parameter. |
| EK_Result |
The entity being initialized is the result of a function call. |
| EK_Exception |
The entity being initialized is an exception object that is being thrown. |
| EK_Member |
The entity being initialized is a non-static data member subobject. |
| EK_ArrayElement |
The entity being initialized is an element of an array. |
| EK_New |
The entity being initialized is an object (or array of objects) allocated via new. |
| EK_Temporary |
The entity being initialized is a temporary object. |
| EK_Base |
The entity being initialized is a base member subobject. |
| EK_Delegating |
The initialization is being done by a delegating constructor. |
| EK_VectorElement |
The entity being initialized is an element of a vector. or vector. |
| EK_BlockElement |
The entity being initialized is a field of block descriptor for the copied-in c++ object. |
| EK_ComplexElement |
The entity being initialized is the real or imaginary part of a complex number. |
Definition at line 41 of file Initialization.h.
| bool InitializedEntity::allowsNRVO | ( | ) | const |
Determine whether this initialization allows the named return value optimization, which also applies to thrown objects.
Definition at line 2364 of file SemaInit.cpp.
References EK_ArrayElement, EK_Base, EK_BlockElement, EK_ComplexElement, EK_Delegating, EK_Exception, EK_Member, EK_New, EK_Parameter, EK_Result, EK_Temporary, EK_Variable, EK_VectorElement, getKind(), and LocAndNRVO.
Referenced by PerformConstructorInitialization().
| CXXBaseSpecifier* clang::InitializedEntity::getBaseSpecifier | ( | ) | const [inline] |
Retrieve the base specifier.
Definition at line 288 of file Initialization.h.
References EK_Base, and getKind().
Referenced by clang::Sema::CheckConstructorAccess(), clang::InitializationSequence::Diagnose(), and PerformConstructorInitialization().
| DeclaratorDecl * InitializedEntity::getDecl | ( | ) | const |
Retrieve the variable, parameter, or field being initialized.
Definition at line 2339 of file SemaInit.cpp.
References EK_ArrayElement, EK_Base, EK_BlockElement, EK_ComplexElement, EK_Delegating, EK_Exception, EK_Member, EK_New, EK_Parameter, EK_Result, EK_Temporary, EK_Variable, EK_VectorElement, getKind(), Parameter, and VariableOrMember.
Referenced by clang::Sema::CheckConstructorAccess(), clang::InitializationSequence::Diagnose(), getAssignmentAction(), getInitializationLoc(), clang::InitializationSequence::InitializationSequence(), clang::InitializationSequence::Perform(), TryConstructorInitialization(), and tryObjCWritebackConversion().
| EntityKind clang::InitializedEntity::getKind | ( | ) | const [inline] |
Determine the kind of initialization.
Definition at line 250 of file Initialization.h.
Referenced by allowsNRVO(), clang::Sema::CheckConstructorAccess(), CheckCXX98CompatAccessibleCopy(), CopyObject(), clang::InitializationSequence::Diagnose(), getAssignmentAction(), getBaseSpecifier(), getDecl(), getInitializationLoc(), getName(), getReturnLoc(), getThrowLoc(), clang::InitializationSequence::InitializationSequence(), isInheritedVirtualBase(), isParameterConsumed(), MaybeProduceObjCObject(), clang::InitializationSequence::Perform(), PerformConstructorInitialization(), setElementIndex(), shouldBindAsTemporary(), and shouldDestroyTemporary().
| DeclarationName InitializedEntity::getName | ( | ) | const |
Retrieve the name of the entity being initialized.
Definition at line 2312 of file SemaInit.cpp.
References EK_ArrayElement, EK_Base, EK_BlockElement, EK_ComplexElement, EK_Delegating, EK_Exception, EK_Member, EK_New, EK_Parameter, EK_Result, EK_Temporary, EK_Variable, EK_VectorElement, clang::NamedDecl::getDeclName(), getKind(), Parameter, and VariableOrMember.
Referenced by clang::InitializationSequence::Diagnose().
| const InitializedEntity* clang::InitializedEntity::getParent | ( | ) | const [inline] |
Retrieve the parent of the entity being initialized, when the initialization itself is occurring within the context of a larger initialization.
Definition at line 255 of file Initialization.h.
| SourceLocation clang::InitializedEntity::getReturnLoc | ( | ) | const [inline] |
Determine the location of the 'return' keyword when initializing the result of a function call.
Definition at line 301 of file Initialization.h.
References EK_Result, clang::SourceLocation::getFromRawEncoding(), getKind(), and LocAndNRVO.
Referenced by getInitializationLoc().
| SourceLocation clang::InitializedEntity::getThrowLoc | ( | ) | const [inline] |
Determine the location of the 'throw' keyword when initializing an exception object.
Definition at line 308 of file Initialization.h.
References EK_Exception, clang::SourceLocation::getFromRawEncoding(), getKind(), and LocAndNRVO.
Referenced by getInitializationLoc().
| QualType clang::InitializedEntity::getType | ( | ) | const [inline] |
Retrieve type being initialized.
Definition at line 258 of file Initialization.h.
Referenced by clang::InitializationSequence::Diagnose(), clang::InitializationSequence::InitializationSequence(), MaybeProduceObjCObject(), clang::InitializationSequence::Perform(), PerformConstructorInitialization(), clang::Sema::PerformCopyInitialization(), TryConstructorInitialization(), TryDefaultInitialization(), TryListInitialization(), tryObjCWritebackConversion(), TryReferenceInitialization(), TryReferenceInitializationCore(), TryReferenceListInitialization(), TryRefInitWithConversionFunction(), TryStringLiteralInitialization(), TryUserDefinedConversion(), and TryValueInitialization().
| TypeSourceInfo* clang::InitializedEntity::getTypeSourceInfo | ( | ) | const [inline] |
Retrieve complete type-source information for the object being constructed, if known.
Definition at line 262 of file Initialization.h.
References EK_Temporary, and TypeInfo.
Referenced by clang::InitializationSequence::Perform(), and PerformConstructorInitialization().
| InitializedEntity InitializedEntity::InitializeBase | ( | ASTContext & | Context, |
| CXXBaseSpecifier * | Base, | ||
| bool | IsInheritedVirtualBase | ||
| ) | [static] |
Create the initialization entity for a base class subobject.
Definition at line 2298 of file SemaInit.cpp.
References Base, EK_Base, and clang::CXXBaseSpecifier::getType().
Referenced by clang::Sema::BuildBaseInitializer(), and BuildImplicitBaseInitializer().
| static InitializedEntity clang::InitializedEntity::InitializeBlock | ( | SourceLocation | BlockVarLoc, |
| QualType | Type, | ||
| bool | NRVO | ||
| ) | [inline, static] |
Definition at line 191 of file Initialization.h.
References EK_BlockElement.
Referenced by clang::Sema::CheckCompleteVariableDeclaration(), and clang::Sema::TryCaptureVar().
| static InitializedEntity clang::InitializedEntity::InitializeDelegation | ( | QualType | Type | ) | [inline, static] |
Create the initialization entity for a delegated constructor.
Definition at line 226 of file Initialization.h.
References EK_Delegating.
Referenced by clang::Sema::BuildDelegatingInitializer().
| static InitializedEntity clang::InitializedEntity::InitializeElement | ( | ASTContext & | Context, |
| unsigned | Index, | ||
| const InitializedEntity & | Parent | ||
| ) | [inline, static] |
Create the initialization entity for an array element.
Definition at line 243 of file Initialization.h.
Referenced by BuildImplicitMemberInitializer(), clang::InitializationSequence::Diagnose(), clang::InitializationSequence::Perform(), and TryListConstructionSpecialCases().
| static InitializedEntity clang::InitializedEntity::InitializeException | ( | SourceLocation | ThrowLoc, |
| QualType | Type, | ||
| bool | NRVO | ||
| ) | [inline, static] |
Create the initialization entity for an exception object.
Definition at line 197 of file Initialization.h.
References EK_Exception.
Referenced by clang::Sema::CheckCXXThrowOperand().
| static InitializedEntity clang::InitializedEntity::InitializeMember | ( | FieldDecl * | Member, |
| const InitializedEntity * | Parent = 0 |
||
| ) | [inline, static] |
Create the initialization entity for a member subobject.
Definition at line 231 of file Initialization.h.
Referenced by clang::Sema::ActOnCXXInClassMemberInitializer(), BuildImplicitMemberInitializer(), clang::Sema::BuildMemberInitializer(), clang::Sema::SetIvarInitializers(), and clang::Sema::TryCaptureVar().
| static InitializedEntity clang::InitializedEntity::InitializeMember | ( | IndirectFieldDecl * | Member, |
| const InitializedEntity * | Parent = 0 |
||
| ) | [inline, static] |
Create the initialization entity for a member subobject.
Definition at line 237 of file Initialization.h.
References clang::IndirectFieldDecl::getAnonField().
| static InitializedEntity clang::InitializedEntity::InitializeNew | ( | SourceLocation | NewLoc, |
| QualType | Type | ||
| ) | [inline, static] |
Create the initialization entity for an object allocated via new.
Definition at line 203 of file Initialization.h.
References EK_New.
Referenced by clang::Sema::BuildCXXNew().
| static InitializedEntity clang::InitializedEntity::InitializeParameter | ( | ASTContext & | Context, |
| ParmVarDecl * | Parm | ||
| ) | [inline, static] |
Create the initialization entity for a parameter.
Definition at line 157 of file Initialization.h.
References EK_Parameter, clang::ASTContext::getLangOptions(), clang::ValueDecl::getType(), clang::QualType::getUnqualifiedType(), clang::ASTContext::getVariableArrayDecayedType(), clang::Decl::hasAttr(), and Parameter.
Referenced by clang::Sema::BuildCXXDefaultArgExpr(), clang::Sema::BuildResolvedCallExpr(), checkBuiltinArgument(), clang::Sema::CheckMessageArgumentTypes(), clang::Sema::FindAllocationOverload(), clang::Sema::GatherArgumentsForCall(), clang::Sema::SetParamDefaultArgument(), and clang::TryListConversion().
| static InitializedEntity clang::InitializedEntity::InitializeParameter | ( | ASTContext & | Context, |
| QualType | Type, | ||
| bool | Consumed | ||
| ) | [inline, static] |
Create the initialization entity for a parameter that is only known by its type.
Definition at line 174 of file Initialization.h.
References EK_Parameter, clang::ASTContext::getVariableArrayDecayedType(), and Parameter.
| static InitializedEntity clang::InitializedEntity::InitializeResult | ( | SourceLocation | ReturnLoc, |
| QualType | Type, | ||
| bool | NRVO | ||
| ) | [inline, static] |
Create the initialization entity for the result of a function.
Definition at line 186 of file Initialization.h.
References EK_Result.
Referenced by clang::Sema::ActOnCapScopeReturnStmt(), clang::Sema::ActOnPropertyImplDecl(), clang::Sema::ActOnReturnStmt(), and clang::Sema::ActOnStmtExpr().
| static InitializedEntity clang::InitializedEntity::InitializeTemporary | ( | QualType | Type | ) | [inline, static] |
Create the initialization entity for a temporary.
Definition at line 208 of file Initialization.h.
References EK_Temporary.
Referenced by clang::Sema::BuildCompoundLiteralExpr(), clang::Sema::BuildCXXTypeConstructExpr(), ConvertForConditional(), clang::Sema::CXXCheckConditionalOperands(), clang::Sema::DefaultArgumentPromotion(), clang::InitializationSequence::Diagnose(), EvaluateBinaryTypeTrait(), clang::Sema::FindCompositePointerType(), clang::InitializationSequence::Perform(), TryClassUnification(), tryDiagnoseOverloadedCast(), TryListConstructionSpecialCases(), TryReferenceInitializationCore(), TryReferenceListInitialization(), and TryStaticImplicitCast().
| static InitializedEntity clang::InitializedEntity::InitializeTemporary | ( | TypeSourceInfo * | TypeInfo | ) | [inline, static] |
Create the initialization entity for a temporary.
Definition at line 213 of file Initialization.h.
References EK_Temporary, clang::TypeSourceInfo::getType(), and TypeInfo.
| static InitializedEntity clang::InitializedEntity::InitializeVariable | ( | VarDecl * | Var | ) | [inline, static] |
Create the initialization entity for a variable.
Definition at line 152 of file Initialization.h.
Referenced by clang::Sema::ActOnUninitializedDecl(), clang::Sema::AddCXXDirectInitializerToDecl(), clang::Sema::AddInitializerToDecl(), and clang::Sema::BuildExceptionDeclaration().
| bool clang::InitializedEntity::isInheritedVirtualBase | ( | ) | const [inline] |
Return whether the base is an inherited virtual base.
Definition at line 294 of file Initialization.h.
References EK_Base, and getKind().
Referenced by clang::Sema::CheckConstructorAccess().
| bool clang::InitializedEntity::isParameterConsumed | ( | ) | const [inline] |
Determine whether this initialization consumes the parameter.
Definition at line 282 of file Initialization.h.
References EK_Parameter, getKind(), and Parameter.
Referenced by MaybeProduceObjCObject().
| void clang::InitializedEntity::setElementIndex | ( | unsigned | Index | ) | [inline] |
If this is already the initializer for an array or vector element, sets the element index.
Definition at line 315 of file Initialization.h.
References EK_ArrayElement, EK_ComplexElement, EK_VectorElement, getKind(), and Index.
Referenced by clang::InitializationSequence::Diagnose(), and clang::InitializationSequence::Perform().
| uintptr_t clang::InitializedEntity::Base |
When Kind == EK_Base, the base specifier that provides the base class. The lower bit specifies whether the base is an inherited virtual base.
Definition at line 115 of file Initialization.h.
Referenced by InitializeBase().
| unsigned clang::InitializedEntity::Index |
When Kind == EK_ArrayElement, EK_VectorElement, or EK_ComplexElement, the index of the array or vector element being initialized.
Definition at line 120 of file Initialization.h.
Referenced by setElementIndex().
| struct { ... } clang::InitializedEntity::LocAndNRVO |
Referenced by allowsNRVO(), getReturnLoc(), and getThrowLoc().
| unsigned clang::InitializedEntity::Location |
When Kind == EK_Result, EK_Exception, or EK_New, the location of the 'return', 'throw', or 'new' keyword, respectively. When Kind == EK_Temporary, the location where the temporary is being created.
Definition at line 105 of file Initialization.h.
Whether the entity being initialized may end up using the named return value optimization (NRVO).
Definition at line 109 of file Initialization.h.
| uintptr_t clang::InitializedEntity::Parameter |
When Kind == EK_Parameter, the ParmVarDecl, with the low bit indicating whether the parameter is "consumed".
Definition at line 94 of file Initialization.h.
Referenced by getDecl(), getName(), InitializeParameter(), and isParameterConsumed().
When Kind == EK_Temporary, the type source information for the temporary.
Definition at line 98 of file Initialization.h.
Referenced by getTypeSourceInfo(), and InitializeTemporary().