clang  14.0.0git
Classes | Public Types | Public Member Functions | List of all members
clang::InitializationSequence Class Reference

Describes the sequence of initializations required to initialize a given object or reference with a set of arguments. More...

#include "clang/Sema/Initialization.h"

Classes

class  Step
 A single step in the initialization sequence. More...
 

Public Types

enum  SequenceKind { FailedSequence = 0, DependentSequence, NormalSequence }
 Describes the kind of initialization sequence computed. More...
 
enum  StepKind {
  SK_ResolveAddressOfOverloadedFunction, SK_CastDerivedToBasePRValue, SK_CastDerivedToBaseXValue, SK_CastDerivedToBaseLValue,
  SK_BindReference, SK_BindReferenceToTemporary, SK_ExtraneousCopyToTemporary, SK_FinalCopy,
  SK_UserConversion, SK_QualificationConversionPRValue, SK_QualificationConversionXValue, SK_QualificationConversionLValue,
  SK_FunctionReferenceConversion, SK_AtomicConversion, SK_ConversionSequence, SK_ConversionSequenceNoNarrowing,
  SK_ListInitialization, SK_UnwrapInitList, SK_RewrapInitList, SK_ConstructorInitialization,
  SK_ConstructorInitializationFromList, SK_ZeroInitialization, SK_CAssignment, SK_StringInit,
  SK_ObjCObjectConversion, SK_ArrayLoopIndex, SK_ArrayLoopInit, SK_ArrayInit,
  SK_GNUArrayInit, SK_ParenthesizedArrayInit, SK_PassByIndirectCopyRestore, SK_PassByIndirectRestore,
  SK_ProduceObjCObject, SK_StdInitializerList, SK_StdInitializerListConstructorCall, SK_OCLSamplerInit,
  SK_OCLZeroOpaqueType
}
 Describes the kind of a particular step in an initialization sequence. More...
 
enum  FailureKind {
  FK_TooManyInitsForReference, FK_ParenthesizedListInitForReference, FK_ArrayNeedsInitList, FK_ArrayNeedsInitListOrStringLiteral,
  FK_ArrayNeedsInitListOrWideStringLiteral, FK_NarrowStringIntoWideCharArray, FK_WideStringIntoCharArray, FK_IncompatWideStringIntoWideChar,
  FK_PlainStringIntoUTF8Char, FK_UTF8StringIntoPlainChar, FK_ArrayTypeMismatch, FK_NonConstantArrayInit,
  FK_AddressOfOverloadFailed, FK_ReferenceInitOverloadFailed, FK_NonConstLValueReferenceBindingToTemporary, FK_NonConstLValueReferenceBindingToBitfield,
  FK_NonConstLValueReferenceBindingToVectorElement, FK_NonConstLValueReferenceBindingToMatrixElement, FK_NonConstLValueReferenceBindingToUnrelated, FK_RValueReferenceBindingToLValue,
  FK_ReferenceInitDropsQualifiers, FK_ReferenceAddrspaceMismatchTemporary, FK_ReferenceInitFailed, FK_ConversionFailed,
  FK_ConversionFromPropertyFailed, FK_TooManyInitsForScalar, FK_ParenthesizedListInitForScalar, FK_ReferenceBindingToInitList,
  FK_InitListBadDestinationType, FK_UserConversionOverloadFailed, FK_ConstructorOverloadFailed, FK_ListConstructorOverloadFailed,
  FK_DefaultInitOfConst, FK_Incomplete, FK_VariableLengthArrayHasInitializer, FK_ListInitializationFailed,
  FK_PlaceholderType, FK_AddressOfUnaddressableFunction, FK_ExplicitConstructor
}
 Describes why initialization failed. More...
 
using step_iterator = SmallVectorImpl< Step >::const_iterator
 
using step_range = llvm::iterator_range< step_iterator >
 

Public Member Functions

void SetZeroInitializationFixit (const std::string &Fixit, SourceLocation L)
 Call for initializations are invalid but that would be valid zero initialzations if Fixit was applied. More...
 
 InitializationSequence (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, bool TopLevelOfInitList=false, bool TreatUnavailableAsInvalid=true)
 Try to perform initialization of the given entity, creating a record of the steps required to perform the initialization. More...
 
void InitializeFrom (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, bool TopLevelOfInitList, bool TreatUnavailableAsInvalid)
 
 ~InitializationSequence ()
 
ExprResult Perform (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, QualType *ResultType=nullptr)
 Perform the actual initialization of the given entity based on the computed initialization sequence. More...
 
bool Diagnose (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, ArrayRef< Expr * > Args)
 Diagnose an potentially-invalid initialization sequence. More...
 
enum SequenceKind getKind () const
 Determine the kind of initialization sequence computed. More...
 
void setSequenceKind (enum SequenceKind SK)
 Set the kind of sequence computed. More...
 
 operator bool () const
 Determine whether the initialization sequence is valid. More...
 
bool Failed () const
 Determine whether the initialization sequence is invalid. More...
 
step_iterator step_begin () const
 
step_iterator step_end () const
 
step_range steps () const
 
bool isDirectReferenceBinding () const
 Determine whether this initialization is a direct reference binding (C++ [dcl.init.ref]). More...
 
bool isAmbiguous () const
 Determine whether this initialization failed due to an ambiguity. More...
 
bool isConstructorInitialization () const
 Determine whether this initialization is direct call to a constructor. More...
 
void AddAddressOverloadResolutionStep (FunctionDecl *Function, DeclAccessPair Found, bool HadMultipleCandidates)
 Add a new step in the initialization that resolves the address of an overloaded function to a specific function declaration. More...
 
void AddDerivedToBaseCastStep (QualType BaseType, ExprValueKind Category)
 Add a new step in the initialization that performs a derived-to- base cast. More...
 
void AddReferenceBindingStep (QualType T, bool BindingTemporary)
 Add a new step binding a reference to an object. More...
 
void AddExtraneousCopyToTemporary (QualType T)
 Add a new step that makes an extraneous copy of the input to a temporary of the same class type. More...
 
void AddFinalCopy (QualType T)
 Add a new step that makes a copy of the input to an object of the given type, as the final step in class copy-initialization. More...
 
void AddUserConversionStep (FunctionDecl *Function, DeclAccessPair FoundDecl, QualType T, bool HadMultipleCandidates)
 Add a new step invoking a conversion function, which is either a constructor or a conversion function. More...
 
void AddQualificationConversionStep (QualType Ty, ExprValueKind Category)
 Add a new step that performs a qualification conversion to the given type. More...
 
void AddFunctionReferenceConversionStep (QualType Ty)
 Add a new step that performs a function reference conversion to the given type. More...
 
void AddAtomicConversionStep (QualType Ty)
 Add a new step that performs conversion from non-atomic to atomic type. More...
 
void AddConversionSequenceStep (const ImplicitConversionSequence &ICS, QualType T, bool TopLevelOfInitList=false)
 Add a new step that applies an implicit conversion sequence. More...
 
void AddListInitializationStep (QualType T)
 Add a list-initialization step. More...
 
void AddConstructorInitializationStep (DeclAccessPair FoundDecl, CXXConstructorDecl *Constructor, QualType T, bool HadMultipleCandidates, bool FromInitList, bool AsInitList)
 Add a constructor-initialization step. More...
 
void AddZeroInitializationStep (QualType T)
 Add a zero-initialization step. More...
 
void AddCAssignmentStep (QualType T)
 Add a C assignment step. More...
 
void AddStringInitStep (QualType T)
 Add a string init step. More...
 
void AddObjCObjectConversionStep (QualType T)
 Add an Objective-C object conversion step, which is always a no-op. More...
 
void AddArrayInitLoopStep (QualType T, QualType EltTy)
 Add an array initialization loop step. More...
 
void AddArrayInitStep (QualType T, bool IsGNUExtension)
 Add an array initialization step. More...
 
void AddParenthesizedArrayInitStep (QualType T)
 Add a parenthesized array initialization step. More...
 
void AddPassByIndirectCopyRestoreStep (QualType T, bool shouldCopy)
 Add a step to pass an object by indirect copy-restore. More...
 
void AddProduceObjCObjectStep (QualType T)
 Add a step to "produce" an Objective-C object (by retaining it). More...
 
void AddStdInitializerListConstructionStep (QualType T)
 Add a step to construct a std::initializer_list object from an initializer list. More...
 
void AddOCLSamplerInitStep (QualType T)
 Add a step to initialize an OpenCL sampler from an integer constant. More...
 
void AddOCLZeroOpaqueTypeStep (QualType T)
 Add a step to initialzie an OpenCL opaque type (event_t, queue_t, etc.) from a zero constant. More...
 
void RewrapReferenceInitList (QualType T, InitListExpr *Syntactic)
 Add steps to unwrap a initializer list for a reference around a single element and rewrap it at the end. More...
 
void SetFailed (FailureKind Failure)
 Note that this initialization sequence failed. More...
 
void SetOverloadFailure (FailureKind Failure, OverloadingResult Result)
 Note that this initialization sequence failed due to failed overload resolution. More...
 
OverloadCandidateSetgetFailedCandidateSet ()
 Retrieve a reference to the candidate set when overload resolution fails. More...
 
OverloadingResult getFailedOverloadResult () const
 Get the overloading result, for when the initialization sequence failed due to a bad overload. More...
 
void setIncompleteTypeFailure (QualType IncompleteType)
 Note that this initialization sequence failed due to an incomplete type. More...
 
FailureKind getFailureKind () const
 Determine why initialization failed. More...
 
void dump (raw_ostream &OS) const
 Dump a representation of this initialization sequence to the given stream, for debugging purposes. More...
 
void dump () const
 Dump a representation of this initialization sequence to standard error, for debugging purposes. More...
 

Detailed Description

Describes the sequence of initializations required to initialize a given object or reference with a set of arguments.

Definition at line 789 of file Initialization.h.

Member Typedef Documentation

◆ step_iterator

Definition at line 1216 of file Initialization.h.

◆ step_range

Definition at line 1221 of file Initialization.h.

Member Enumeration Documentation

◆ FailureKind

Describes why initialization failed.

Enumerator
FK_TooManyInitsForReference 

Too many initializers provided for a reference.

FK_ParenthesizedListInitForReference 

Reference initialized from a parenthesized initializer list.

FK_ArrayNeedsInitList 

Array must be initialized with an initializer list.

FK_ArrayNeedsInitListOrStringLiteral 

Array must be initialized with an initializer list or a string literal.

FK_ArrayNeedsInitListOrWideStringLiteral 

Array must be initialized with an initializer list or a wide string literal.

FK_NarrowStringIntoWideCharArray 

Initializing a wide char array with narrow string literal.

FK_WideStringIntoCharArray 

Initializing char array with wide string literal.

FK_IncompatWideStringIntoWideChar 

Initializing wide char array with incompatible wide string literal.

FK_PlainStringIntoUTF8Char 

Initializing char8_t array with plain string literal.

FK_UTF8StringIntoPlainChar 

Initializing char array with UTF-8 string literal.

FK_ArrayTypeMismatch 

Array type mismatch.

FK_NonConstantArrayInit 

Non-constant array initializer.

FK_AddressOfOverloadFailed 

Cannot resolve the address of an overloaded function.

FK_ReferenceInitOverloadFailed 

Overloading due to reference initialization failed.

FK_NonConstLValueReferenceBindingToTemporary 

Non-const lvalue reference binding to a temporary.

FK_NonConstLValueReferenceBindingToBitfield 

Non-const lvalue reference binding to a bit-field.

FK_NonConstLValueReferenceBindingToVectorElement 

Non-const lvalue reference binding to a vector element.

FK_NonConstLValueReferenceBindingToMatrixElement 

Non-const lvalue reference binding to a matrix element.

FK_NonConstLValueReferenceBindingToUnrelated 

Non-const lvalue reference binding to an lvalue of unrelated type.

FK_RValueReferenceBindingToLValue 

Rvalue reference binding to an lvalue.

FK_ReferenceInitDropsQualifiers 

Reference binding drops qualifiers.

FK_ReferenceAddrspaceMismatchTemporary 

Reference with mismatching address space binding to temporary.

FK_ReferenceInitFailed 

Reference binding failed.

FK_ConversionFailed 

Implicit conversion failed.

FK_ConversionFromPropertyFailed 

Implicit conversion failed.

FK_TooManyInitsForScalar 

Too many initializers for scalar.

FK_ParenthesizedListInitForScalar 

Scalar initialized from a parenthesized initializer list.

FK_ReferenceBindingToInitList 

Reference initialization from an initializer list.

FK_InitListBadDestinationType 

Initialization of some unused destination type with an initializer list.

FK_UserConversionOverloadFailed 

Overloading for a user-defined conversion failed.

FK_ConstructorOverloadFailed 

Overloading for initialization by constructor failed.

FK_ListConstructorOverloadFailed 

Overloading for list-initialization by constructor failed.

FK_DefaultInitOfConst 

Default-initialization of a 'const' object.

FK_Incomplete 

Initialization of an incomplete type.

FK_VariableLengthArrayHasInitializer 

Variable-length array must not have an initializer.

FK_ListInitializationFailed 

List initialization failed at some point.

FK_PlaceholderType 

Initializer has a placeholder type which cannot be resolved by initialization.

FK_AddressOfUnaddressableFunction 

Trying to take the address of a function that doesn't support having its address taken.

FK_ExplicitConstructor 

List-copy-initialization chose an explicit constructor.

Definition at line 979 of file Initialization.h.

◆ SequenceKind

Describes the kind of initialization sequence computed.

Enumerator
FailedSequence 

A failed initialization sequence.

The failure kind tells what happened.

DependentSequence 

A dependent initialization, which could not be type-checked due to the presence of dependent types or dependently-typed expressions.

NormalSequence 

A normal sequence.

Definition at line 792 of file Initialization.h.

◆ StepKind

Describes the kind of a particular step in an initialization sequence.

Enumerator
SK_ResolveAddressOfOverloadedFunction 

Resolve the address of an overloaded function to a specific function declaration.

SK_CastDerivedToBasePRValue 

Perform a derived-to-base cast, producing an rvalue.

SK_CastDerivedToBaseXValue 

Perform a derived-to-base cast, producing an xvalue.

SK_CastDerivedToBaseLValue 

Perform a derived-to-base cast, producing an lvalue.

SK_BindReference 

Reference binding to an lvalue.

SK_BindReferenceToTemporary 

Reference binding to a temporary.

SK_ExtraneousCopyToTemporary 

An optional copy of a temporary object to another temporary object, which is permitted (but not required) by C++98/03 but not C++0x.

SK_FinalCopy 

Direct-initialization from a reference-related object in the final stage of class copy-initialization.

SK_UserConversion 

Perform a user-defined conversion, either via a conversion function or via a constructor.

SK_QualificationConversionPRValue 

Perform a qualification conversion, producing a prvalue.

SK_QualificationConversionXValue 

Perform a qualification conversion, producing an xvalue.

SK_QualificationConversionLValue 

Perform a qualification conversion, producing an lvalue.

SK_FunctionReferenceConversion 

Perform a function reference conversion, see [dcl.init.ref]p4.

SK_AtomicConversion 

Perform a conversion adding _Atomic to a type.

SK_ConversionSequence 

Perform an implicit conversion sequence.

SK_ConversionSequenceNoNarrowing 

Perform an implicit conversion sequence without narrowing.

SK_ListInitialization 

Perform list-initialization without a constructor.

SK_UnwrapInitList 

Unwrap the single-element initializer list for a reference.

SK_RewrapInitList 

Rewrap the single-element initializer list for a reference.

SK_ConstructorInitialization 

Perform initialization via a constructor.

SK_ConstructorInitializationFromList 

Perform initialization via a constructor, taking arguments from a single InitListExpr.

SK_ZeroInitialization 

Zero-initialize the object.

SK_CAssignment 

C assignment.

SK_StringInit 

Initialization by string.

SK_ObjCObjectConversion 

An initialization that "converts" an Objective-C object (not a point to an object) to another Objective-C object type.

SK_ArrayLoopIndex 

Array indexing for initialization by elementwise copy.

SK_ArrayLoopInit 

Array initialization by elementwise copy.

SK_ArrayInit 

Array initialization (from an array rvalue).

SK_GNUArrayInit 

Array initialization (from an array rvalue) as a GNU extension.

SK_ParenthesizedArrayInit 

Array initialization from a parenthesized initializer list.

This is a GNU C++ extension.

SK_PassByIndirectCopyRestore 

Pass an object by indirect copy-and-restore.

SK_PassByIndirectRestore 

Pass an object by indirect restore.

SK_ProduceObjCObject 

Produce an Objective-C object pointer.

SK_StdInitializerList 

Construct a std::initializer_list from an initializer list.

SK_StdInitializerListConstructorCall 

Perform initialization via a constructor taking a single std::initializer_list argument.

SK_OCLSamplerInit 

Initialize an OpenCL sampler from an integer.

SK_OCLZeroOpaqueType 

Initialize an opaque OpenCL type (event_t, queue_t, etc.) with zero.

Definition at line 808 of file Initialization.h.

Constructor & Destructor Documentation

◆ InitializationSequence()

InitializationSequence::InitializationSequence ( Sema S,
const InitializedEntity Entity,
const InitializationKind Kind,
MultiExprArg  Args,
bool  TopLevelOfInitList = false,
bool  TreatUnavailableAsInvalid = true 
)

Try to perform initialization of the given entity, creating a record of the steps required to perform the initialization.

The generated initialization sequence will either contain enough information to diagnose

Parameters
Sthe semantic analysis object.
Entitythe entity being initialized.
Kindthe kind of initialization being performed.
Argsthe argument(s) provided for initialization.
TopLevelOfInitListtrue if we are initializing from an expression at the top level inside an initializer list. This disallows narrowing conversions in C++11 onwards.
TreatUnavailableAsInvalidtrue if we want to treat unavailable as invalid.

Definition at line 5638 of file SemaInit.cpp.

◆ ~InitializationSequence()

InitializationSequence::~InitializationSequence ( )

Definition at line 6045 of file SemaInit.cpp.

Member Function Documentation

◆ AddAddressOverloadResolutionStep()

void InitializationSequence::AddAddressOverloadResolutionStep ( FunctionDecl Function,
DeclAccessPair  Found,
bool  HadMultipleCandidates 
)

Add a new step in the initialization that resolves the address of an overloaded function to a specific function declaration.

Parameters
Functionthe function to which the overloaded function reference resolves.

Definition at line 3571 of file SemaInit.cpp.

◆ AddArrayInitLoopStep()

void InitializationSequence::AddArrayInitLoopStep ( QualType  T,
QualType  EltTy 
)

Add an array initialization loop step.

Definition at line 3733 of file SemaInit.cpp.

◆ AddArrayInitStep()

void InitializationSequence::AddArrayInitStep ( QualType  T,
bool  IsGNUExtension 
)

Add an array initialization step.

Definition at line 3726 of file SemaInit.cpp.

◆ AddAtomicConversionStep()

void InitializationSequence::AddAtomicConversionStep ( QualType  Ty)

Add a new step that performs conversion from non-atomic to atomic type.

Definition at line 3659 of file SemaInit.cpp.

◆ AddCAssignmentStep()

void InitializationSequence::AddCAssignmentStep ( QualType  T)

Add a C assignment step.

Definition at line 3705 of file SemaInit.cpp.

◆ AddConstructorInitializationStep()

void InitializationSequence::AddConstructorInitializationStep ( DeclAccessPair  FoundDecl,
CXXConstructorDecl Constructor,
QualType  T,
bool  HadMultipleCandidates,
bool  FromInitList,
bool  AsInitList 
)

Add a constructor-initialization step.

Parameters
FromInitListThe constructor call is syntactically an initializer list.
AsInitListThe constructor is called as an init list constructor.

Definition at line 3684 of file SemaInit.cpp.

◆ AddConversionSequenceStep()

void InitializationSequence::AddConversionSequenceStep ( const ImplicitConversionSequence ICS,
QualType  T,
bool  TopLevelOfInitList = false 
)

Add a new step that applies an implicit conversion sequence.

Definition at line 3666 of file SemaInit.cpp.

◆ AddDerivedToBaseCastStep()

void InitializationSequence::AddDerivedToBaseCastStep ( QualType  BaseType,
ExprValueKind  Category 
)

Add a new step in the initialization that performs a derived-to- base cast.

Parameters
BaseTypethe base type to which we will be casting.
CategoryIndicates whether the result will be treated as an rvalue, an xvalue, or an lvalue.

Definition at line 3583 of file SemaInit.cpp.

◆ AddExtraneousCopyToTemporary()

void InitializationSequence::AddExtraneousCopyToTemporary ( QualType  T)

Add a new step that makes an extraneous copy of the input to a temporary of the same class type.

This extraneous copy only occurs during reference binding in C++98/03, where we are permitted (but not required) to introduce an extra copy. At a bare minimum, we must check that we could call the copy constructor, and produce a diagnostic if the copy constructor is inaccessible or no copy constructor matches.

Parameters
TThe type of the temporary being created.

Definition at line 3612 of file SemaInit.cpp.

◆ AddFinalCopy()

void InitializationSequence::AddFinalCopy ( QualType  T)

Add a new step that makes a copy of the input to an object of the given type, as the final step in class copy-initialization.

Definition at line 3605 of file SemaInit.cpp.

◆ AddFunctionReferenceConversionStep()

void InitializationSequence::AddFunctionReferenceConversionStep ( QualType  Ty)

Add a new step that performs a function reference conversion to the given type.

Definition at line 3652 of file SemaInit.cpp.

◆ AddListInitializationStep()

void InitializationSequence::AddListInitializationStep ( QualType  T)

Add a list-initialization step.

Definition at line 3677 of file SemaInit.cpp.

◆ AddObjCObjectConversionStep()

void InitializationSequence::AddObjCObjectConversionStep ( QualType  T)

Add an Objective-C object conversion step, which is always a no-op.

Definition at line 3719 of file SemaInit.cpp.

◆ AddOCLSamplerInitStep()

void InitializationSequence::AddOCLSamplerInitStep ( QualType  T)

Add a step to initialize an OpenCL sampler from an integer constant.

Definition at line 3774 of file SemaInit.cpp.

◆ AddOCLZeroOpaqueTypeStep()

void InitializationSequence::AddOCLZeroOpaqueTypeStep ( QualType  T)

Add a step to initialzie an OpenCL opaque type (event_t, queue_t, etc.) from a zero constant.

Definition at line 3781 of file SemaInit.cpp.

◆ AddParenthesizedArrayInitStep()

void InitializationSequence::AddParenthesizedArrayInitStep ( QualType  T)

Add a parenthesized array initialization step.

Definition at line 3744 of file SemaInit.cpp.

◆ AddPassByIndirectCopyRestoreStep()

void InitializationSequence::AddPassByIndirectCopyRestoreStep ( QualType  T,
bool  shouldCopy 
)

Add a step to pass an object by indirect copy-restore.

Definition at line 3751 of file SemaInit.cpp.

References s, SK_PassByIndirectCopyRestore, SK_PassByIndirectRestore, and clang::ast_matchers::type.

◆ AddProduceObjCObjectStep()

void InitializationSequence::AddProduceObjCObjectStep ( QualType  T)

Add a step to "produce" an Objective-C object (by retaining it).

Definition at line 3760 of file SemaInit.cpp.

◆ AddQualificationConversionStep()

void InitializationSequence::AddQualificationConversionStep ( QualType  Ty,
ExprValueKind  Category 
)

Add a new step that performs a qualification conversion to the given type.

Definition at line 3633 of file SemaInit.cpp.

◆ AddReferenceBindingStep()

void InitializationSequence::AddReferenceBindingStep ( QualType  T,
bool  BindingTemporary 
)

Add a new step binding a reference to an object.

Parameters
BindingTemporaryTrue if we are binding a reference to a temporary object (thereby extending its lifetime); false if we are binding to an lvalue or an lvalue treated as an rvalue.

Definition at line 3597 of file SemaInit.cpp.

◆ AddStdInitializerListConstructionStep()

void InitializationSequence::AddStdInitializerListConstructionStep ( QualType  T)

Add a step to construct a std::initializer_list object from an initializer list.

Definition at line 3767 of file SemaInit.cpp.

◆ AddStringInitStep()

void InitializationSequence::AddStringInitStep ( QualType  T)

Add a string init step.

Definition at line 3712 of file SemaInit.cpp.

◆ AddUserConversionStep()

void InitializationSequence::AddUserConversionStep ( FunctionDecl Function,
DeclAccessPair  FoundDecl,
QualType  T,
bool  HadMultipleCandidates 
)

Add a new step invoking a conversion function, which is either a constructor or a conversion function.

Definition at line 3620 of file SemaInit.cpp.

◆ AddZeroInitializationStep()

void InitializationSequence::AddZeroInitializationStep ( QualType  T)

Add a zero-initialization step.

Definition at line 3698 of file SemaInit.cpp.

◆ Diagnose()

bool InitializationSequence::Diagnose ( Sema S,
const InitializedEntity Entity,
const InitializationKind Kind,
ArrayRef< Expr * >  Args 
)

Diagnose an potentially-invalid initialization sequence.

Returns
true if the initialization sequence was ill-formed, false otherwise.

Definition at line 8968 of file SemaInit.cpp.

Referenced by TryClassUnification().

◆ dump() [1/2]

void InitializationSequence::dump ( ) const

Dump a representation of this initialization sequence to standard error, for debugging purposes.

Definition at line 9779 of file SemaInit.cpp.

◆ dump() [2/2]

void InitializationSequence::dump ( raw_ostream &  OS) const

◆ Failed()

bool clang::InitializationSequence::Failed ( ) const
inline

Determine whether the initialization sequence is invalid.

Definition at line 1214 of file Initialization.h.

References FailedSequence.

Referenced by clang::Sema::CanPerformCopyInitialization(), getFailureKind(), isAmbiguous(), operator bool(), TryClassUnification(), and TryStaticImplicitCast().

◆ getFailedCandidateSet()

OverloadCandidateSet& clang::InitializationSequence::getFailedCandidateSet ( )
inline

Retrieve a reference to the candidate set when overload resolution fails.

Definition at line 1379 of file Initialization.h.

Referenced by clang::Sema::PerformCopyInitialization().

◆ getFailedOverloadResult()

OverloadingResult clang::InitializationSequence::getFailedOverloadResult ( ) const
inline

Get the overloading result, for when the initialization sequence failed due to a bad overload.

Definition at line 1385 of file Initialization.h.

Referenced by clang::Sema::PerformMoveOrCopyInitialization().

◆ getFailureKind()

FailureKind clang::InitializationSequence::getFailureKind ( ) const
inline

Determine why initialization failed.

Definition at line 1397 of file Initialization.h.

References Failed().

Referenced by isAmbiguous().

◆ getKind()

enum SequenceKind clang::InitializationSequence::getKind ( ) const
inline

Determine the kind of initialization sequence computed.

Definition at line 1205 of file Initialization.h.

◆ InitializeFrom()

void InitializationSequence::InitializeFrom ( Sema S,
const InitializedEntity Entity,
const InitializationKind Kind,
MultiExprArg  Args,
bool  TopLevelOfInitList,
bool  TreatUnavailableAsInvalid 
)

Definition at line 5694 of file SemaInit.cpp.

◆ isAmbiguous()

bool InitializationSequence::isAmbiguous ( ) const

◆ isConstructorInitialization()

bool InitializationSequence::isConstructorInitialization ( ) const

Determine whether this initialization is direct call to a constructor.

Definition at line 3565 of file SemaInit.cpp.

References SK_ConstructorInitialization.

Referenced by clang::Sema::PerformCopyInitialization(), and TryStaticImplicitCast().

◆ isDirectReferenceBinding()

bool InitializationSequence::isDirectReferenceBinding ( ) const

Determine whether this initialization is a direct reference binding (C++ [dcl.init.ref]).

Definition at line 3502 of file SemaInit.cpp.

References SK_BindReference, and SK_BindReferenceToTemporary.

Referenced by TryClassUnification().

◆ operator bool()

clang::InitializationSequence::operator bool ( ) const
inlineexplicit

Determine whether the initialization sequence is valid.

Definition at line 1211 of file Initialization.h.

References Failed().

◆ Perform()

ExprResult InitializationSequence::Perform ( Sema S,
const InitializedEntity Entity,
const InitializationKind Kind,
MultiExprArg  Args,
QualType ResultType = nullptr 
)

Perform the actual initialization of the given entity based on the computed initialization sequence.

Parameters
Sthe semantic analysis object.
Entitythe entity being initialized.
Kindthe kind of initialization being performed.
Argsthe argument(s) provided for initialization, ownership of which is transferred into the routine.
ResultTypeif non-NULL, will be set to the type of the initialized object, which is the type of the declaration in most cases. However, when the initialized object is a variable of incomplete array type and the initializer is an initializer list, this type will be set to the completed array type.
Returns
an expression that performs the actual object initialization, if the initialization is well-formed. Otherwise, emits diagnostics and returns an invalid expression.

Definition at line 7987 of file SemaInit.cpp.

Referenced by clang::Sema::ActOnFinishCXXInClassMemberInitializer(), clang::Sema::ActOnOpenMPFirstprivateClause(), clang::Sema::ActOnUninitializedDecl(), clang::Sema::AddInitializerToDecl(), clang::Sema::BuildBaseInitializer(), clang::Sema::BuildCompoundLiteralExpr(), clang::Sema::buildCoroutinePromise(), clang::Sema::BuildCXXTypeConstructExpr(), clang::Sema::BuildDelegatingInitializer(), BuildImplicitBaseInitializer(), BuildImplicitMemberInitializer(), clang::Sema::buildLambdaInitCaptureInitialization(), clang::Sema::BuildMemberInitializer(), ConvertForConditional(), clang::Sema::ConvertParamDefaultArgument(), clang::Sema::CreateBuiltinBinOp(), clang::Sema::PerformCopyInitialization(), clang::Sema::PerformMoveOrCopyInitialization(), clang::Sema::SetIvarInitializers(), clang::Sema::tryConvertExprToType(), and TryStaticImplicitCast().

◆ RewrapReferenceInitList()

void InitializationSequence::RewrapReferenceInitList ( QualType  T,
InitListExpr Syntactic 
)

Add steps to unwrap a initializer list for a reference around a single element and rewrap it at the end.

Definition at line 3788 of file SemaInit.cpp.

References clang::InitListExpr::getNumInits().

◆ SetFailed()

void clang::InitializationSequence::SetFailed ( FailureKind  Failure)
inline

Note that this initialization sequence failed.

Definition at line 1366 of file Initialization.h.

References FailedSequence, FK_Incomplete, and clang::QualType::isNull().

Referenced by setIncompleteTypeFailure().

◆ setIncompleteTypeFailure()

void clang::InitializationSequence::setIncompleteTypeFailure ( QualType  IncompleteType)
inline

Note that this initialization sequence failed due to an incomplete type.

Definition at line 1391 of file Initialization.h.

References FK_Incomplete, and SetFailed().

◆ SetOverloadFailure()

void InitializationSequence::SetOverloadFailure ( FailureKind  Failure,
OverloadingResult  Result 
)

Note that this initialization sequence failed due to failed overload resolution.

Definition at line 3803 of file SemaInit.cpp.

References FailedSequence, and setSequenceKind().

Referenced by clang::Sema::PerformCopyInitialization().

◆ setSequenceKind()

void clang::InitializationSequence::setSequenceKind ( enum SequenceKind  SK)
inline

Set the kind of sequence computed.

Definition at line 1208 of file Initialization.h.

Referenced by SetOverloadFailure().

◆ SetZeroInitializationFixit()

void clang::InitializationSequence::SetZeroInitializationFixit ( const std::string Fixit,
SourceLocation  L 
)
inline

Call for initializations are invalid but that would be valid zero initialzations if Fixit was applied.

Definition at line 1126 of file Initialization.h.

◆ step_begin()

step_iterator clang::InitializationSequence::step_begin ( ) const
inline

Definition at line 1218 of file Initialization.h.

Referenced by steps().

◆ step_end()

step_iterator clang::InitializationSequence::step_end ( ) const
inline

Definition at line 1219 of file Initialization.h.

Referenced by clang::Sema::PerformCopyInitialization(), and steps().

◆ steps()

step_range clang::InitializationSequence::steps ( ) const
inline

Definition at line 1223 of file Initialization.h.

References step_begin(), and step_end().


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