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

Classes | |
| struct | C |
| struct | LN |
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, EK_LambdaCapture, EK_CompoundLiteralInit, EK_RelatedResult, EK_Parameter_CF_Audited } |
| 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. | |
| ObjCMethodDecl * | getMethodDecl () const |
| Retrieve the ObjectiveC method being initialized. | |
| bool | allowsNRVO () const |
| Determine whether this initialization allows the named return value optimization, which also applies to thrown objects. | |
| bool | isParameterKind () const |
| bool | isParameterConsumed () const |
| Determine whether this initialization consumes the parameter. | |
| const 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. | |
| unsigned | getElementIndex () const |
| If this is an array, vector, or complex number element, get the element's index. | |
| void | setElementIndex (unsigned Index) |
| If this is already the initializer for an array or vector element, sets the element index. | |
| StringRef | getCapturedVarName () const |
| For a lambda capture, return the capture's name. | |
| SourceLocation | getCaptureLoc () const |
| Determine the location of the capture when initializing field from a captured variable in a lambda. | |
| void | setParameterCFAudited () |
| unsigned | allocateManglingNumber () const |
| void | dump () const |
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, ParmVarDecl *Parm, QualType Type) |
| Create the initialization entity for a parameter, but use another type. | |
| 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 | InitializeRelatedResult (ObjCMethodDecl *MD, QualType Type) |
| Create the initialization entity for a related result. | |
| static InitializedEntity | InitializeBase (ASTContext &Context, const 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=nullptr) |
| Create the initialization entity for a member subobject. | |
| static InitializedEntity | InitializeMember (IndirectFieldDecl *Member, const InitializedEntity *Parent=nullptr) |
| 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. | |
| static InitializedEntity | InitializeLambdaCapture (IdentifierInfo *VarID, QualType FieldType, SourceLocation Loc) |
| Create the initialization entity for a lambda capture. | |
| static InitializedEntity | InitializeCompoundLiteralInit (TypeSourceInfo *TSI) |
| Create the entity for a compound literal initializer. | |
Describes an entity that is being initialized.
Definition at line 41 of file Initialization.h.
Specifies the kind of entity being initialized.
Definition at line 44 of file Initialization.h.
| unsigned clang::InitializedEntity::allocateManglingNumber | ( | ) | const [inline] |
Definition at line 434 of file Initialization.h.
Referenced by performReferenceExtension().
| bool InitializedEntity::allowsNRVO | ( | ) | const |
Determine whether this initialization allows the named return value optimization, which also applies to thrown objects.
Definition at line 2642 of file SemaInit.cpp.
References EK_ArrayElement, EK_Base, EK_BlockElement, EK_ComplexElement, EK_CompoundLiteralInit, EK_Delegating, EK_Exception, EK_LambdaCapture, EK_Member, EK_New, EK_Parameter, EK_Parameter_CF_Audited, EK_RelatedResult, EK_Result, EK_Temporary, EK_Variable, EK_VectorElement, getKind(), and LocAndNRVO.
Referenced by PerformConstructorInitialization().
| void InitializedEntity::dump | ( | ) | const |
Dump a representation of the initialized entity to standard error, for debugging purposes.
Definition at line 2709 of file SemaInit.cpp.
| const CXXBaseSpecifier* clang::InitializedEntity::getBaseSpecifier | ( | ) | const [inline] |
Retrieve the base specifier.
Definition at line 379 of file Initialization.h.
References EK_Base, and getKind().
Referenced by clang::Sema::CheckConstructorAccess(), clang::InitializationSequence::Diagnose(), and PerformConstructorInitialization().
| StringRef clang::InitializedEntity::getCapturedVarName | ( | ) | const [inline] |
For a lambda capture, return the capture's name.
Definition at line 419 of file Initialization.h.
References Capture, EK_LambdaCapture, and getKind().
Referenced by clang::Sema::CheckConstructorAccess().
| SourceLocation clang::InitializedEntity::getCaptureLoc | ( | ) | const [inline] |
Determine the location of the capture when initializing field from a captured variable in a lambda.
Definition at line 425 of file Initialization.h.
References Capture, EK_LambdaCapture, clang::SourceLocation::getFromRawEncoding(), and getKind().
Referenced by getInitializationLoc().
| DeclaratorDecl * InitializedEntity::getDecl | ( | ) | const |
Retrieve the variable, parameter, or field being initialized.
Definition at line 2613 of file SemaInit.cpp.
References EK_ArrayElement, EK_Base, EK_BlockElement, EK_ComplexElement, EK_CompoundLiteralInit, EK_Delegating, EK_Exception, EK_LambdaCapture, EK_Member, EK_New, EK_Parameter, EK_Parameter_CF_Audited, EK_RelatedResult, EK_Result, EK_Temporary, EK_Variable, EK_VectorElement, getKind(), Parameter, and VariableOrMember.
Referenced by clang::Sema::CheckConstructorAccess(), clang::InitializationSequence::Diagnose(), diagnoseListInit(), getAssignmentAction(), getInitializationLoc(), clang::InitializationSequence::InitializeFrom(), maybeEmitZeroInitializationFixit(), clang::InitializationSequence::Perform(), performReferenceExtension(), and tryObjCWritebackConversion().
| unsigned clang::InitializedEntity::getElementIndex | ( | ) | const [inline] |
If this is an array, vector, or complex number element, get the element's index.
Definition at line 406 of file Initialization.h.
References EK_ArrayElement, EK_ComplexElement, EK_VectorElement, getKind(), and Index.
| EntityKind clang::InitializedEntity::getKind | ( | ) | const [inline] |
Determine the kind of initialization.
Definition at line 334 of file Initialization.h.
Referenced by allowsNRVO(), clang::Sema::CheckConstructorAccess(), CheckCXX98CompatAccessibleCopy(), CopyObject(), clang::InitializationSequence::Diagnose(), emitBadConversionNotes(), getAssignmentAction(), getBaseSpecifier(), getCapturedVarName(), getCaptureLoc(), getDecl(), getElementIndex(), getEntityForTemporaryLifetimeExtension(), getInitializationLoc(), getName(), getReturnLoc(), getThrowLoc(), InitializedEntityOutlivesFullExpression(), clang::InitializationSequence::InitializeFrom(), isExplicitTemporary(), isInheritedVirtualBase(), isLibstdcxxPointerReturnFalseHack(), isParameterKind(), maybeEmitZeroInitializationFixit(), MaybeProduceObjCObject(), clang::InitializationSequence::Perform(), PerformConstructorInitialization(), setElementIndex(), shouldBindAsTemporary(), and shouldDestroyTemporary().
| ObjCMethodDecl* clang::InitializedEntity::getMethodDecl | ( | ) | const [inline] |
Retrieve the ObjectiveC method being initialized.
Definition at line 361 of file Initialization.h.
References MethodDecl.
| DeclarationName InitializedEntity::getName | ( | ) | const |
Retrieve the name of the entity being initialized.
Definition at line 2580 of file SemaInit.cpp.
References Capture, EK_ArrayElement, EK_Base, EK_BlockElement, EK_ComplexElement, EK_CompoundLiteralInit, EK_Delegating, EK_Exception, EK_LambdaCapture, EK_Member, EK_New, EK_Parameter, EK_Parameter_CF_Audited, EK_RelatedResult, 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 339 of file Initialization.h.
Referenced by getEntityForTemporaryLifetimeExtension(), InitializedEntityOutlivesFullExpression(), and warnOnLifetimeExtension().
| SourceLocation clang::InitializedEntity::getReturnLoc | ( | ) | const [inline] |
Determine the location of the 'return' keyword when initializing the result of a function call.
Definition at line 392 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 399 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 342 of file Initialization.h.
Referenced by clang::Sema::CheckConstructorAccess(), clang::InitializationSequence::Diagnose(), diagnoseListInit(), emitBadConversionNotes(), clang::InitializationSequence::InitializeFrom(), isLibstdcxxPointerReturnFalseHack(), MaybeProduceObjCObject(), clang::InitializationSequence::Perform(), PerformConstructorInitialization(), TryConstructorInitialization(), TryDefaultInitialization(), TryListInitialization(), tryObjCWritebackConversion(), TryReferenceInitialization(), TryReferenceInitializationCore(), TryReferenceListInitialization(), TryRefInitWithConversionFunction(), TryStringLiteralInitialization(), and TryValueInitialization().
| TypeSourceInfo* clang::InitializedEntity::getTypeSourceInfo | ( | ) | const [inline] |
Retrieve complete type-source information for the object being constructed, if known.
Definition at line 346 of file Initialization.h.
References EK_CompoundLiteralInit, EK_Temporary, and TypeInfo.
Referenced by clang::InitializationSequence::Perform(), and PerformConstructorInitialization().
| InitializedEntity InitializedEntity::InitializeBase | ( | ASTContext & | Context, |
| const CXXBaseSpecifier * | Base, | ||
| bool | IsInheritedVirtualBase | ||
| ) | [static] |
Create the initialization entity for a base class subobject.
Definition at line 2566 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 246 of file Initialization.h.
References EK_BlockElement.
Referenced by clang::Sema::BuildBlockForLambdaConversion(), captureInBlock(), and clang::Sema::CheckCompleteVariableDeclaration().
| static InitializedEntity clang::InitializedEntity::InitializeCompoundLiteralInit | ( | TypeSourceInfo * | TSI | ) | [inline, static] |
Create the entity for a compound literal initializer.
Definition at line 325 of file Initialization.h.
References EK_CompoundLiteralInit, clang::TypeSourceInfo::getType(), and TypeInfo.
Referenced by clang::Sema::BuildCompoundLiteralExpr().
| static InitializedEntity clang::InitializedEntity::InitializeDelegation | ( | QualType | Type | ) | [inline, static] |
Create the initialization entity for a delegated constructor.
Definition at line 292 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 311 of file Initialization.h.
Referenced by addAsFieldToClosureType(), and BuildImplicitMemberInitializer().
| static InitializedEntity clang::InitializedEntity::InitializeException | ( | SourceLocation | ThrowLoc, |
| QualType | Type, | ||
| bool | NRVO | ||
| ) | [inline, static] |
Create the initialization entity for an exception object.
Definition at line 252 of file Initialization.h.
References EK_Exception.
Referenced by clang::Sema::CheckCXXThrowOperand().
| static InitializedEntity clang::InitializedEntity::InitializeLambdaCapture | ( | IdentifierInfo * | VarID, |
| QualType | FieldType, | ||
| SourceLocation | Loc | ||
| ) | [inline, static] |
Create the initialization entity for a lambda capture.
Definition at line 318 of file Initialization.h.
Referenced by addAsFieldToClosureType(), and clang::Sema::performLambdaInitCaptureInitialization().
| static InitializedEntity clang::InitializedEntity::InitializeMember | ( | FieldDecl * | Member, |
| const InitializedEntity * | Parent = nullptr |
||
| ) | [inline, static] |
Create the initialization entity for a member subobject.
Definition at line 298 of file Initialization.h.
Referenced by clang::Sema::ActOnFinishCXXInClassMemberInitializer(), BuildImplicitMemberInitializer(), clang::Sema::BuildMemberInitializer(), and clang::Sema::SetIvarInitializers().
| static InitializedEntity clang::InitializedEntity::InitializeMember | ( | IndirectFieldDecl * | Member, |
| const InitializedEntity * | Parent = nullptr |
||
| ) | [inline, static] |
Create the initialization entity for a member subobject.
Definition at line 305 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 258 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 204 of file Initialization.h.
References clang::ValueDecl::getType().
Referenced by clang::Sema::BuildCallToObjectOfClassType(), clang::Sema::BuildCXXDefaultArgExpr(), clang::Sema::BuildLiteralOperatorCall(), clang::Sema::BuildObjCBoxedExpr(), clang::Sema::BuildObjCNumericLiteral(), clang::Sema::BuildResolvedCallExpr(), clang::Sema::BuildVAArgExpr(), checkBuiltinArgument(), clang::Sema::CheckEnableIf(), clang::Sema::CheckMessageArgumentTypes(), CheckObjCCollectionLiteralElement(), clang::Sema::checkUnknownAnyArg(), clang::Sema::CreateOverloadedArraySubscriptExpr(), clang::Sema::CreateOverloadedBinOp(), clang::Sema::CreateOverloadedUnaryOp(), clang::Sema::GatherArgumentsForCall(), clang::Sema::SetParamDefaultArgument(), and TryListConversion().
| static InitializedEntity clang::InitializedEntity::InitializeParameter | ( | ASTContext & | Context, |
| ParmVarDecl * | Parm, | ||
| QualType | Type | ||
| ) | [inline, static] |
Create the initialization entity for a parameter, but use another type.
Definition at line 211 of file Initialization.h.
References EK_Parameter, clang::ASTContext::getLangOpts(), clang::QualType::getUnqualifiedType(), clang::ASTContext::getVariableArrayDecayedType(), clang::Decl::hasAttr(), and Parameter.
| 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 229 of file Initialization.h.
References EK_Parameter, clang::ASTContext::getVariableArrayDecayedType(), and Parameter.
| static InitializedEntity clang::InitializedEntity::InitializeRelatedResult | ( | ObjCMethodDecl * | MD, |
| QualType | Type | ||
| ) | [inline, static] |
Create the initialization entity for a related result.
Definition at line 278 of file Initialization.h.
References EK_RelatedResult, and MethodDecl.
Referenced by clang::Sema::BuildReturnStmt().
| 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 241 of file Initialization.h.
References EK_Result.
Referenced by clang::Sema::ActOnCapScopeReturnStmt(), clang::Sema::ActOnPropertyImplDecl(), clang::Sema::ActOnStmtExpr(), and clang::Sema::BuildReturnStmt().
| static InitializedEntity clang::InitializedEntity::InitializeTemporary | ( | QualType | Type | ) | [inline, static] |
Create the initialization entity for a temporary.
Definition at line 263 of file Initialization.h.
References EK_Temporary, and TypeInfo.
Referenced by clang::Sema::ActOnOpenMPReductionClause(), BuildCXXCastArgument(), clang::Sema::BuildCXXTypeConstructExpr(), ConvertForConditional(), clang::Sema::CreateBuiltinBinOp(), clang::Sema::CXXCheckConditionalOperands(), clang::Sema::DefaultArgumentPromotion(), diagnoseListInit(), clang::Sema::EndOpenMPDSABlock(), EvaluateBinaryTypeTrait(), evaluateTypeTrait(), clang::Sema::FindCompositePointerType(), clang::InitializationSequence::Perform(), TryClassUnification(), tryDiagnoseOverloadedCast(), TryInitializerListConstruction(), TryReferenceInitializationCore(), TryReferenceListInitialization(), and TryStaticImplicitCast().
| static InitializedEntity clang::InitializedEntity::InitializeTemporary | ( | TypeSourceInfo * | TypeInfo | ) | [inline, static] |
Create the initialization entity for a temporary.
Definition at line 270 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 199 of file Initialization.h.
Referenced by clang::Sema::ActOnOpenMPFirstprivateClause(), clang::Sema::ActOnUninitializedDecl(), 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 385 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 373 of file Initialization.h.
References isParameterKind(), and Parameter.
Referenced by MaybeProduceObjCObject().
| bool clang::InitializedEntity::isParameterKind | ( | ) | const [inline] |
Definition at line 367 of file Initialization.h.
References EK_Parameter, EK_Parameter_CF_Audited, and getKind().
Referenced by clang::InitializationSequence::InitializeFrom(), isParameterConsumed(), MaybeProduceObjCObject(), and clang::InitializationSequence::Perform().
| 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 413 of file Initialization.h.
References EK_ArrayElement, EK_ComplexElement, EK_VectorElement, getKind(), and Index.
| void clang::InitializedEntity::setParameterCFAudited | ( | ) | [inline] |
Definition at line 430 of file Initialization.h.
References EK_Parameter_CF_Audited.
Referenced by clang::Sema::GatherArgumentsForCall().
| 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 151 of file Initialization.h.
Referenced by InitializeBase().
| struct C clang::InitializedEntity::Capture |
Definition at line 158 of file Initialization.h.
Referenced by getCapturedVarName(), getCaptureLoc(), and getName().
When Kind == EK_ArrayElement, EK_VectorElement, or EK_ComplexElement, the index of the array or vector element being initialized.
Definition at line 156 of file Initialization.h.
Referenced by getElementIndex(), and setElementIndex().
| struct LN clang::InitializedEntity::LocAndNRVO |
Definition at line 146 of file Initialization.h.
Referenced by allowsNRVO(), getReturnLoc(), and getThrowLoc().
When Kind == EK_RelatedResult, the ObjectiveC method where result type was implicitly changed to accommodate ARC semantics.
Definition at line 136 of file Initialization.h.
Referenced by getMethodDecl(), and InitializeRelatedResult().
| uintptr_t clang::InitializedEntity::Parameter |
When Kind == EK_Parameter, the ParmVarDecl, with the low bit indicating whether the parameter is "consumed".
Definition at line 140 of file Initialization.h.
Referenced by getDecl(), getName(), InitializeParameter(), and isParameterConsumed().
When Kind == EK_Temporary or EK_CompoundLiteralInit, the type source information for the temporary.
Definition at line 144 of file Initialization.h.
Referenced by getTypeSourceInfo(), InitializeCompoundLiteralInit(), and InitializeTemporary().