clang: clang::InitializedEntity Class Reference (original) (raw)

Describes an entity that is being initialized. More...

#include "[clang/Sema/Initialization.h](Initialization%5F8h%5Fsource.html)"

Public Types
enum EntityKind { EK_Variable, EK_Parameter, EK_TemplateParameter, EK_Result, EK_StmtExprResult, EK_Exception, EK_Member, EK_ArrayElement, EK_New, EK_Temporary, EK_Base, EK_Delegating, EK_VectorElement, EK_BlockElement, EK_LambdaToBlockConversionBlockElement, EK_ComplexElement, EK_LambdaCapture, EK_CompoundLiteralInit, EK_RelatedResult, EK_Parameter_CF_Audited, EK_Binding, EK_ParenAggInitMember }
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.
ValueDecl * 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 isParamOrTemplateParamKind () 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.
bool isVariableLengthArrayNew () const
Determine whether this is an array new with an unknown bound.
bool isImplicitMemberInitializer () const
Is this the implicit initialization of a member of a class from a defaulted constructor?
bool isDefaultMemberInitializer () const
Is this the default member initializer of a member (specified inside the class definition)?
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
Dump a representation of the initialized entity to standard error, for debugging purposes.
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 InitializeTemplateParameter (QualType T, NonTypeTemplateParmDecl *Param)
Create the initialization entity for a template parameter.
static InitializedEntity InitializeResult (SourceLocation ReturnLoc, QualType Type)
Create the initialization entity for the result of a function.
static InitializedEntity InitializeStmtExprResult (SourceLocation ReturnLoc, QualType Type)
static InitializedEntity InitializeBlock (SourceLocation BlockVarLoc, QualType Type)
static InitializedEntity InitializeLambdaToBlock (SourceLocation BlockVarLoc, QualType Type)
static InitializedEntity InitializeException (SourceLocation ThrowLoc, QualType Type)
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 (ASTContext &Context, TypeSourceInfo *TypeInfo)
Create the initialization entity for a temporary.
static InitializedEntity InitializeTemporary (TypeSourceInfo *TypeInfo, QualType Type)
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, const InitializedEntity *Parent=nullptr)
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, bool Implicit=false)
Create the initialization entity for a member subobject.
static InitializedEntity InitializeMember (IndirectFieldDecl *Member, const InitializedEntity *Parent=nullptr, bool Implicit=false)
Create the initialization entity for a member subobject.
static InitializedEntity InitializeMemberFromParenAggInit (FieldDecl *Member)
Create the initialization entity for a member subobject initialized via parenthesized aggregate init.
static InitializedEntity InitializeMemberFromDefaultMemberInitializer (FieldDecl *Member)
Create the initialization entity for a default member initializer.
static InitializedEntity InitializeElement (ASTContext &Context, unsigned Index, const InitializedEntity &Parent)
Create the initialization entity for an array element.
static InitializedEntity InitializeBinding (VarDecl *Binding)
Create the initialization entity for a structured binding.
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 47 of file Initialization.h.

EntityKind

Specifies the kind of entity being initialized.

Enumerator
EK_Variable The entity being initialized is a variable.
EK_Parameter The entity being initialized is a function parameter.
EK_TemplateParameter The entity being initialized is a non-type template parameter.
EK_Result The entity being initialized is the result of a function call.
EK_StmtExprResult The entity being initialized is the result of a statement expression.
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_LambdaToBlockConversionBlockElement The entity being initialized is a field of block descriptor for the copied-in lambda object that's used in the lambda to block conversion.
EK_ComplexElement The entity being initialized is the real or imaginary part of a complex number.
EK_LambdaCapture The entity being initialized is the field that captures a variable in a lambda.
EK_CompoundLiteralInit The entity being initialized is the initializer for a compound literal.
EK_RelatedResult The entity being implicitly initialized back to the formal result type.
EK_Parameter_CF_Audited The entity being initialized is a function parameter; function is member of group of audited CF APIs.
EK_Binding The entity being initialized is a structured binding of a decomposition declaration.
EK_ParenAggInitMember The entity being initialized is a non-static data member subobject of an object initialized via parenthesized aggregate initialization.

Definition at line 50 of file Initialization.h.

allocateManglingNumber()

unsigned clang::InitializedEntity::allocateManglingNumber ( ) const inline

allowsNRVO()

bool InitializedEntity::allowsNRVO ( ) const

Determine whether this initialization allows the named return value optimization, which also applies to thrown objects.

Definition at line 3689 of file SemaInit.cpp.

References EK_ArrayElement, EK_Base, EK_Binding, EK_BlockElement, EK_ComplexElement, EK_CompoundLiteralInit, EK_Delegating, EK_Exception, EK_LambdaCapture, EK_LambdaToBlockConversionBlockElement, EK_Member, EK_New, EK_Parameter, EK_Parameter_CF_Audited, EK_ParenAggInitMember, EK_RelatedResult, EK_Result, EK_StmtExprResult, EK_TemplateParameter, EK_Temporary, EK_Variable, EK_VectorElement, getKind(), and LocAndNRVO.

Referenced by PerformConstructorInitialization().

dump()

LLVM_DUMP_METHOD void InitializedEntity::dump ( ) const

Dump a representation of the initialized entity to standard error, for debugging purposes.

Definition at line 3770 of file SemaInit.cpp.

getBaseSpecifier()

const CXXBaseSpecifier * clang::InitializedEntity::getBaseSpecifier ( ) const inline

getCapturedVarName()

StringRef clang::InitializedEntity::getCapturedVarName ( ) const inline

getCaptureLoc()

SourceLocation clang::InitializedEntity::getCaptureLoc ( ) const inline

getDecl()

ValueDecl * InitializedEntity::getDecl ( ) const

Retrieve the variable, parameter, or field being initialized.

Definition at line 3655 of file SemaInit.cpp.

References EK_ArrayElement, EK_Base, EK_Binding, EK_BlockElement, EK_ComplexElement, EK_CompoundLiteralInit, EK_Delegating, EK_Exception, EK_LambdaCapture, EK_LambdaToBlockConversionBlockElement, EK_Member, EK_New, EK_Parameter, EK_Parameter_CF_Audited, EK_ParenAggInitMember, EK_RelatedResult, EK_Result, EK_StmtExprResult, EK_TemplateParameter, EK_Temporary, EK_Variable, EK_VectorElement, getKind(), Parameter, and Variable.

Referenced by canPerformArrayCopy(), clang::Sema::CheckConstructorAccess(), clang::sema::checkExprLifetimeImpl(), clang::InitializationSequence::Diagnose(), diagnoseListInit(), getAssignmentAction(), getInitializationLoc(), clang::InitializationSequence::InitializeFrom(), initializingConstexprVariable(), maybeRecoverWithZeroInitialization(), clang::InitializationSequence::Perform(), TryListInitialization(), and tryObjCWritebackConversion().

getElementIndex()

unsigned clang::InitializedEntity::getElementIndex ( ) const inline

getKind()

EntityKind clang::InitializedEntity::getKind ( ) const inline

Determine the kind of initialization.

Definition at line 441 of file Initialization.h.

References Kind.

Referenced by allowsNRVO(), canPerformArrayCopy(), clang::Sema::CheckConstructorAccess(), CheckCXX98CompatAccessibleCopy(), CopyObject(), clang::InitializationSequence::Diagnose(), emitBadConversionNotes(), getAssignmentAction(), getBaseSpecifier(), getCapturedVarName(), getCaptureLoc(), getDecl(), getElementIndex(), clang::sema::getEntityLifetime(), getInitializationLoc(), getName(), getReturnLoc(), getThrowLoc(), clang::InitializationSequence::InitializeFrom(), isDefaultMemberInitializer(), isExplicitTemporary(), isIdiomaticBraceElisionEntity(), isImplicitMemberInitializer(), isInheritedVirtualBase(), isLibstdcxxPointerReturnFalseHack(), isParameterKind(), isParamOrTemplateParamKind(), isVariableLengthArrayNew(), MaybeProduceObjCObject(), maybeRecoverWithZeroInitialization(), clang::InitializationSequence::Perform(), PerformConstructorInitialization(), setElementIndex(), shouldBindAsTemporary(), shouldDestroyEntity(), TryConstructorInitialization(), TryListInitialization(), TryReferenceListInitialization(), and warnBracedScalarInit().

getMethodDecl()

ObjCMethodDecl * clang::InitializedEntity::getMethodDecl ( ) const inline

getName()

Retrieve the name of the entity being initialized.

Definition at line 3617 of file SemaInit.cpp.

References D, EK_ArrayElement, EK_Base, EK_Binding, EK_BlockElement, EK_ComplexElement, EK_CompoundLiteralInit, EK_Delegating, EK_Exception, EK_LambdaCapture, EK_LambdaToBlockConversionBlockElement, EK_Member, EK_New, EK_Parameter, EK_Parameter_CF_Audited, EK_ParenAggInitMember, EK_RelatedResult, EK_Result, EK_StmtExprResult, EK_TemplateParameter, EK_Temporary, EK_Variable, EK_VectorElement, getKind(), Parameter, and Variable.

Referenced by clang::InitializationSequence::Diagnose().

getParent()

getReturnLoc()

SourceLocation clang::InitializedEntity::getReturnLoc ( ) const inline

getThrowLoc()

getType()

QualType clang::InitializedEntity::getType ( ) const inline

Retrieve type being initialized.

Definition at line 449 of file Initialization.h.

References Type.

Referenced by canInitializeArrayWithEmbedDataString(), clang::Sema::CanPerformAggregateInitializationForOverloadResolution(), clang::Sema::CheckConstructorAccess(), clang::sema::checkExprLifetimeImpl(), clang::InitializationSequence::Diagnose(), diagnoseListInit(), emitBadConversionNotes(), clang::InitializationSequence::InitializeFrom(), isIdiomaticBraceElisionEntity(), isLibstdcxxPointerReturnFalseHack(), isVariableLengthArrayNew(), MaybeProduceObjCObject(), maybeRecoverWithZeroInitialization(), clang::InitializationSequence::Perform(), PerformConstructorInitialization(), clang::Sema::PerformCopyInitialization(), TryArrayCopy(), TryConstructorInitialization(), TryDefaultInitialization(), TryListInitialization(), tryObjCWritebackConversion(), TryOrBuildParenListInitialization(), TryReferenceInitialization(), TryReferenceInitializationCore(), TryReferenceListInitialization(), TryRefInitWithConversionFunction(), TryStringLiteralInitialization(), TryValueInitialization(), and warnBracedScalarInit().

getTypeSourceInfo()

TypeSourceInfo * clang::InitializedEntity::getTypeSourceInfo ( ) const inline

InitializeBase()

InitializeBinding()

InitializeBlock()

InitializeCompoundLiteralInit()

InitializeDelegation()

InitializeElement()

InitializeException()

InitializeLambdaCapture()

InitializeLambdaToBlock()

InitializeMember() [1/2]

InitializeMember() [2/2]

InitializeMemberFromDefaultMemberInitializer()

static InitializedEntity clang::InitializedEntity::InitializeMemberFromDefaultMemberInitializer ( FieldDecl * Member) inlinestatic

InitializeMemberFromParenAggInit()

InitializeNew()

InitializeParameter() [1/3]

Create the initialization entity for a parameter.

Definition at line 259 of file Initialization.h.

References clang::ValueDecl::getType(), and InitializeParameter().

Referenced by clang::SemaHLSL::ActOnOutParamExpr(), clang::Sema::BuildAtomicExpr(), clang::Sema::BuildLiteralOperatorCall(), clang::SemaObjC::BuildObjCBoxedExpr(), clang::SemaObjC::BuildObjCNumericLiteral(), clang::Sema::BuildResolvedCallExpr(), clang::Sema::BuildVAArgExpr(), BuiltinAlignment(), BuiltinLaunder(), clang::SemaARM::CheckARMBuiltinExclusiveCall(), checkBuiltinArgument(), clang::SemaRISCV::CheckBuiltinFunctionCall(), clang::SemaObjC::CheckMessageArgumentTypes(), CheckObjCCollectionLiteralElement(), clang::Sema::checkUnknownAnyArg(), convertArgsForAvailabilityChecks(), convertArgumentToType(), clang::Sema::ConvertParamDefaultArgument(), clang::Sema::CreateOverloadedBinOp(), clang::Sema::CreateOverloadedUnaryOp(), clang::Sema::GatherArgumentsForCall(), clang::Sema::InitializeExplicitObjectArgument(), InitializeParameter(), makeLaunchBoundsArgExpr(), PrepareArgumentsForCallToObjectOfClassType(), clang::Sema::SubstDefaultArgument(), and TryListConversion().

InitializeParameter() [2/3]

InitializeParameter() [3/3]

InitializeRelatedResult()

InitializeResult()

InitializeStmtExprResult()

InitializeTemplateParameter()

InitializeTemporary() [1/3]

InitializeTemporary() [2/3]

Create the initialization entity for a temporary.

Definition at line 338 of file Initialization.h.

References InitializeTemporary().

Referenced by BuildCXXCastArgument(), clang::Sema::BuildCXXTypeConstructExpr(), clang::SemaObjC::BuildObjCBoxedExpr(), CheckConvertibilityForTypeTraits(), ConvertForConditional(), clang::Sema::CreateBuiltinBinOp(), clang::Sema::CXXCheckConditionalOperands(), clang::Sema::DefaultArgumentPromotion(), diagnoseListInit(), EvaluateBooleanTypeTrait(), clang::Sema::FindCompositePointerType(), InitializeTemporary(), clang::InitializationSequence::Perform(), TryClassUnification(), clang::Sema::tryConvertExprToType(), tryDiagnoseOverloadedCast(), TryInitializerListConstruction(), TryReferenceInitializationCore(), TryReferenceListInitialization(), and TryStaticImplicitCast().

InitializeTemporary() [3/3]

InitializeVariable()

isDefaultMemberInitializer()

bool clang::InitializedEntity::isDefaultMemberInitializer ( ) const inline

isImplicitMemberInitializer()

bool clang::InitializedEntity::isImplicitMemberInitializer ( ) const inline

isInheritedVirtualBase()

bool clang::InitializedEntity::isInheritedVirtualBase ( ) const inline

isParameterConsumed()

bool clang::InitializedEntity::isParameterConsumed ( ) const inline

isParameterKind()

bool clang::InitializedEntity::isParameterKind ( ) const inline

isParamOrTemplateParamKind()

bool clang::InitializedEntity::isParamOrTemplateParamKind ( ) const inline

isVariableLengthArrayNew()

bool clang::InitializedEntity::isVariableLengthArrayNew ( ) const inline

setElementIndex()

void clang::InitializedEntity::setElementIndex ( unsigned Index) inline

setParameterCFAudited()

void clang::InitializedEntity::setParameterCFAudited ( ) inline

Base

llvm::PointerIntPair<const CXXBaseSpecifier *, 1> clang::InitializedEntity::Base

When Kind == EK_Base, the base specifier that provides the base class.

The integer specifies whether the base is an inherited virtual base.

Definition at line 205 of file Initialization.h.

Referenced by InitializeBase().

Capture

struct C clang::InitializedEntity::Capture

Index

unsigned clang::InitializedEntity::Index

LocAndNRVO

struct LN clang::InitializedEntity::LocAndNRVO

MethodDecl

When Kind == EK_RelatedResult, the ObjectiveC method where result type was implicitly changed to accommodate ARC semantics.

Definition at line 190 of file Initialization.h.

Referenced by getMethodDecl().

Parameter

llvm::PointerIntPair<ParmVarDecl *, 1> clang::InitializedEntity::Parameter

TypeInfo

Variable

VD clang::InitializedEntity::Variable

When Kind == EK_Variable, EK_Member, EK_Binding, or EK_TemplateParameter, the variable, binding, or template parameter.

Definition at line 186 of file Initialization.h.

Referenced by getDecl(), getName(), InitializeTemplateParameter(), isDefaultMemberInitializer(), and isImplicitMemberInitializer().


The documentation for this class was generated from the following files: