clang 20.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 , SK_ParenthesizedListInit
}
 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 , FK_ParenthesizedListInitFailed ,
  FK_DesignatedInitForNonAggregate
}
 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.
 
 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.
 
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.
 
bool Diagnose (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, ArrayRef< Expr * > Args)
 Diagnose an potentially-invalid initialization sequence.
 
enum SequenceKind getKind () const
 Determine the kind of initialization sequence computed.
 
void setSequenceKind (enum SequenceKind SK)
 Set the kind of sequence computed.
 
 operator bool () const
 Determine whether the initialization sequence is valid.
 
bool Failed () const
 Determine whether the initialization sequence is invalid.
 
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]).
 
bool isAmbiguous () const
 Determine whether this initialization failed due to an ambiguity.
 
bool isConstructorInitialization () const
 Determine whether this initialization is direct call to a constructor.
 
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.
 
void AddDerivedToBaseCastStep (QualType BaseType, ExprValueKind Category)
 Add a new step in the initialization that performs a derived-to- base cast.
 
void AddReferenceBindingStep (QualType T, bool BindingTemporary)
 Add a new step binding a reference to an object.
 
void AddExtraneousCopyToTemporary (QualType T)
 Add a new step that makes an extraneous copy of the input to a temporary of the same class type.
 
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.
 
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.
 
void AddQualificationConversionStep (QualType Ty, ExprValueKind Category)
 Add a new step that performs a qualification conversion to the given type.
 
void AddFunctionReferenceConversionStep (QualType Ty)
 Add a new step that performs a function reference conversion to the given type.
 
void AddAtomicConversionStep (QualType Ty)
 Add a new step that performs conversion from non-atomic to atomic type.
 
void AddConversionSequenceStep (const ImplicitConversionSequence &ICS, QualType T, bool TopLevelOfInitList=false)
 Add a new step that applies an implicit conversion sequence.
 
void AddListInitializationStep (QualType T)
 Add a list-initialization step.
 
void AddConstructorInitializationStep (DeclAccessPair FoundDecl, CXXConstructorDecl *Constructor, QualType T, bool HadMultipleCandidates, bool FromInitList, bool AsInitList)
 Add a constructor-initialization step.
 
void AddZeroInitializationStep (QualType T)
 Add a zero-initialization step.
 
void AddCAssignmentStep (QualType T)
 Add a C assignment step.
 
void AddStringInitStep (QualType T)
 Add a string init step.
 
void AddObjCObjectConversionStep (QualType T)
 Add an Objective-C object conversion step, which is always a no-op.
 
void AddArrayInitLoopStep (QualType T, QualType EltTy)
 Add an array initialization loop step.
 
void AddArrayInitStep (QualType T, bool IsGNUExtension)
 Add an array initialization step.
 
void AddParenthesizedArrayInitStep (QualType T)
 Add a parenthesized array initialization step.
 
void AddPassByIndirectCopyRestoreStep (QualType T, bool shouldCopy)
 Add a step to pass an object by indirect copy-restore.
 
void AddProduceObjCObjectStep (QualType T)
 Add a step to "produce" an Objective-C object (by retaining it).
 
void AddStdInitializerListConstructionStep (QualType T)
 Add a step to construct a std::initializer_list object from an initializer list.
 
void AddOCLSamplerInitStep (QualType T)
 Add a step to initialize an OpenCL sampler from an integer constant.
 
void AddOCLZeroOpaqueTypeStep (QualType T)
 Add a step to initialzie an OpenCL opaque type (event_t, queue_t, etc.) from a zero constant.
 
void AddParenthesizedListInitStep (QualType T)
 
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.
 
void SetFailed (FailureKind Failure)
 Note that this initialization sequence failed.
 
void SetOverloadFailure (FailureKind Failure, OverloadingResult Result)
 Note that this initialization sequence failed due to failed overload resolution.
 
OverloadCandidateSetgetFailedCandidateSet ()
 Retrieve a reference to the candidate set when overload resolution fails.
 
OverloadingResult getFailedOverloadResult () const
 Get the overloading result, for when the initialization sequence failed due to a bad overload.
 
void setIncompleteTypeFailure (QualType IncompleteType)
 Note that this initialization sequence failed due to an incomplete type.
 
FailureKind getFailureKind () const
 Determine why initialization failed.
 
void dump (raw_ostream &OS) const
 Dump a representation of this initialization sequence to the given stream, for debugging purposes.
 
void dump () const
 Dump a representation of this initialization sequence to standard error, for debugging purposes.
 

Detailed Description

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

Definition at line 802 of file Initialization.h.

Member Typedef Documentation

◆ step_iterator

Definition at line 1240 of file Initialization.h.

◆ step_range

Definition at line 1245 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.

FK_ParenthesizedListInitFailed 

Parenthesized list initialization failed at some point.

This is a C++20 feature.

FK_DesignatedInitForNonAggregate 

Definition at line 996 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 805 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.

SK_ParenthesizedListInit 

Initialize an aggreagate with parenthesized list of values.

This is a C++20 feature.

Definition at line 821 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 6263 of file SemaInit.cpp.

References InitializeFrom().

◆ ~InitializationSequence()

InitializationSequence::~InitializationSequence ( )

Definition at line 6748 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 3869 of file SemaInit.cpp.

References clang::Found, clang::Function, and SK_ResolveAddressOfOverloadedFunction.

Referenced by ResolveOverloadedFunctionForReferenceBinding().

◆ AddArrayInitLoopStep()

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

Add an array initialization loop step.

Definition at line 4032 of file SemaInit.cpp.

References SK_ArrayLoopIndex, SK_ArrayLoopInit, and clang::T.

Referenced by InitializeFrom().

◆ AddArrayInitStep()

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

Add an array initialization step.

Definition at line 4025 of file SemaInit.cpp.

References SK_ArrayInit, SK_GNUArrayInit, and clang::T.

Referenced by InitializeFrom().

◆ AddAtomicConversionStep()

void InitializationSequence::AddAtomicConversionStep ( QualType  Ty)

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

Definition at line 3958 of file SemaInit.cpp.

References SK_AtomicConversion.

Referenced by InitializeFrom().

◆ AddCAssignmentStep()

void InitializationSequence::AddCAssignmentStep ( QualType  T)

Add a C assignment step.

Definition at line 4004 of file SemaInit.cpp.

References SK_CAssignment, and clang::T.

Referenced by InitializeFrom().

◆ 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 3983 of file SemaInit.cpp.

References SK_ConstructorInitialization, SK_ConstructorInitializationFromList, SK_StdInitializerListConstructorCall, and clang::T.

Referenced by TryConstructorInitialization().

◆ AddConversionSequenceStep()

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

◆ 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 3882 of file SemaInit.cpp.

References SK_CastDerivedToBaseLValue, SK_CastDerivedToBasePRValue, SK_CastDerivedToBaseXValue, clang::VK_LValue, clang::VK_PRValue, and clang::VK_XValue.

Referenced by TryReferenceInitializationCore(), and TryRefInitWithConversionFunction().

◆ 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 3911 of file SemaInit.cpp.

References SK_ExtraneousCopyToTemporary, and clang::T.

Referenced by TryReferenceInitializationCore().

◆ 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 3904 of file SemaInit.cpp.

References SK_FinalCopy, and clang::T.

Referenced by TryUserDefinedConversion().

◆ AddFunctionReferenceConversionStep()

void InitializationSequence::AddFunctionReferenceConversionStep ( QualType  Ty)

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

Definition at line 3951 of file SemaInit.cpp.

References SK_FunctionReferenceConversion.

Referenced by TryReferenceInitializationCore(), and TryRefInitWithConversionFunction().

◆ AddListInitializationStep()

void InitializationSequence::AddListInitializationStep ( QualType  T)

Add a list-initialization step.

Definition at line 3976 of file SemaInit.cpp.

References SK_ListInitialization, and clang::T.

Referenced by InitializeFrom(), and TryListInitialization().

◆ AddObjCObjectConversionStep()

void InitializationSequence::AddObjCObjectConversionStep ( QualType  T)

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

Definition at line 4018 of file SemaInit.cpp.

References SK_ObjCObjectConversion, and clang::T.

Referenced by TryReferenceInitializationCore(), and TryRefInitWithConversionFunction().

◆ AddOCLSamplerInitStep()

void InitializationSequence::AddOCLSamplerInitStep ( QualType  T)

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

Definition at line 4073 of file SemaInit.cpp.

References SK_OCLSamplerInit, and clang::T.

Referenced by TryOCLSamplerInitialization().

◆ 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 4080 of file SemaInit.cpp.

References SK_OCLZeroOpaqueType, and clang::T.

Referenced by TryOCLZeroOpaqueTypeInitialization().

◆ AddParenthesizedArrayInitStep()

void InitializationSequence::AddParenthesizedArrayInitStep ( QualType  T)

Add a parenthesized array initialization step.

Definition at line 4043 of file SemaInit.cpp.

References SK_ParenthesizedArrayInit, and clang::T.

Referenced by InitializeFrom().

◆ AddParenthesizedListInitStep()

void InitializationSequence::AddParenthesizedListInitStep ( QualType  T)

Definition at line 4087 of file SemaInit.cpp.

References SK_ParenthesizedListInit, and clang::T.

Referenced by TryOrBuildParenListInitialization().

◆ AddPassByIndirectCopyRestoreStep()

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

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

Definition at line 4050 of file SemaInit.cpp.

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

Referenced by InitializeFrom(), and tryObjCWritebackConversion().

◆ AddProduceObjCObjectStep()

void InitializationSequence::AddProduceObjCObjectStep ( QualType  T)

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

Definition at line 4059 of file SemaInit.cpp.

References SK_ProduceObjCObject, and clang::T.

Referenced by MaybeProduceObjCObject().

◆ AddQualificationConversionStep()

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

◆ 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 3896 of file SemaInit.cpp.

References SK_BindReference, SK_BindReferenceToTemporary, and clang::T.

Referenced by TryReferenceInitializationCore(), TryReferenceListInitialization(), and TryRefInitWithConversionFunction().

◆ AddStdInitializerListConstructionStep()

void InitializationSequence::AddStdInitializerListConstructionStep ( QualType  T)

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

Definition at line 4066 of file SemaInit.cpp.

References SK_StdInitializerList, and clang::T.

Referenced by TryInitializerListConstruction().

◆ AddStringInitStep()

void InitializationSequence::AddStringInitStep ( QualType  T)

Add a string init step.

Definition at line 4011 of file SemaInit.cpp.

References SK_StringInit, and clang::T.

Referenced by TryStringLiteralInitialization().

◆ 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 3919 of file SemaInit.cpp.

References clang::Function, SK_UserConversion, and clang::T.

Referenced by TryConstructorInitialization(), TryRefInitWithConversionFunction(), and TryUserDefinedConversion().

◆ AddZeroInitializationStep()

void InitializationSequence::AddZeroInitializationStep ( QualType  T)

Add a zero-initialization step.

Definition at line 3997 of file SemaInit.cpp.

References SK_ZeroInitialization, and clang::T.

Referenced by InitializeFrom(), maybeRecoverWithZeroInitialization(), TryDefaultInitialization(), and TryValueInitialization().

◆ 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 8609 of file SemaInit.cpp.

References clang::OverloadCandidateSet::BestViableFunction(), clang::Type::castAs(), clang::Sema::checkAddressOfFunctionIsAvailable(), clang::OverloadCandidateSet::CompleteCandidates(), clang::Sema::Context, clang::FixItHint::CreateInsertion(), clang::Sema::CurContext, clang::SemaBase::Diag(), diagnoseListInit(), DiagnoseUninitializedReference(), clang::InitializedEntity::EK_Base, clang::InitializedEntity::EK_Member, clang::InitializedEntity::EK_ParenAggInitMember, clang::InitializedEntity::EK_Result, emitBadConversionNotes(), Failed(), clang::Sema::FixOverloadedFunctionReference(), FK_AddressOfOverloadFailed, FK_AddressOfUnaddressableFunction, FK_ArrayNeedsInitList, FK_ArrayNeedsInitListOrStringLiteral, FK_ArrayNeedsInitListOrWideStringLiteral, FK_ArrayTypeMismatch, FK_ConstructorOverloadFailed, FK_ConversionFailed, FK_ConversionFromPropertyFailed, FK_DefaultInitOfConst, FK_DesignatedInitForNonAggregate, FK_ExplicitConstructor, FK_IncompatWideStringIntoWideChar, FK_Incomplete, FK_InitListBadDestinationType, FK_ListConstructorOverloadFailed, FK_ListInitializationFailed, FK_NarrowStringIntoWideCharArray, FK_NonConstantArrayInit, FK_NonConstLValueReferenceBindingToBitfield, FK_NonConstLValueReferenceBindingToMatrixElement, FK_NonConstLValueReferenceBindingToTemporary, FK_NonConstLValueReferenceBindingToUnrelated, FK_NonConstLValueReferenceBindingToVectorElement, FK_ParenthesizedListInitFailed, FK_ParenthesizedListInitForReference, FK_ParenthesizedListInitForScalar, FK_PlaceholderType, FK_PlainStringIntoUTF8Char, FK_ReferenceAddrspaceMismatchTemporary, FK_ReferenceBindingToInitList, FK_ReferenceInitDropsQualifiers, FK_ReferenceInitFailed, FK_ReferenceInitOverloadFailed, FK_RValueReferenceBindingToLValue, FK_TooManyInitsForReference, FK_TooManyInitsForScalar, FK_UserConversionOverloadFailed, FK_UTF8StringIntoPlainChar, FK_VariableLengthArrayHasInitializer, FK_WideStringIntoCharArray, clang::Found, clang::Qualifiers::fromCVRMask(), clang::ActionResult< PtrTy, Compress >::get(), clang::Type::getAs(), clang::InitializedEntity::getBaseSpecifier(), clang::SourceRange::getBegin(), clang::Stmt::getBeginLoc(), clang::Qualifiers::getCVRQualifiers(), clang::InitializedEntity::getDecl(), clang::NamedDecl::getDeclName(), clang::InitListExpr::getInits(), clang::InitializedEntity::getKind(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::Sema::getLocForEndOfToken(), clang::InitializedEntity::getName(), clang::QualType::getNonReferenceType(), clang::InitListExpr::getNumInits(), clang::QualType::getQualifiers(), clang::Stmt::getSourceRange(), clang::Sema::getSpecialMember(), clang::StringLiteral::getString(), clang::ASTContext::getTagDeclType(), clang::CXXBaseSpecifier::getType(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::ASTContext::getTypeDeclType(), clang::Sema::HandleFunctionTypeMismatch(), clang::Qualifiers::hasQualifiers(), clang::InitializationKind::IK_Default, clang::InitializationKind::IK_Value, int, clang::Qualifiers::isAddressSpaceSupersetOf(), clang::Sema::isImplicitlyDeleted(), clang::Type::isIncompleteType(), clang::Expr::isLValue(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::Type::isSignedIntegerType(), clang::QualType::isVolatileQualified(), clang::OverloadCandidateSet::NoteCandidates(), clang::Sema::NoteDeletedFunction(), clang::OCD_AllCandidates, clang::OCD_AmbiguousCandidates, clang::OR_Ambiguous, clang::OR_Deleted, clang::OR_No_Viable_Function, clang::OR_Success, clang::ASTContext::OverloadTy, clang::SemaBase::PDiag(), clang::Sema::RequireCompleteType(), clang::Sema::ResolveAddressOfOverloadedFunction(), clang::SourceRange::setBegin(), and TryOrBuildParenListInitialization().

Referenced by Perform(), TryClassUnification(), and TryOrBuildParenListInitialization().

◆ dump() [1/2]

void InitializationSequence::dump ( ) const

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

Definition at line 9465 of file SemaInit.cpp.

References dump().

Referenced by dump().

◆ dump() [2/2]

void InitializationSequence::dump ( raw_ostream &  OS) const

Dump a representation of this initialization sequence to the given stream, for debugging purposes.

Definition at line 9115 of file SemaInit.cpp.

References DependentSequence, FailedSequence, FK_AddressOfOverloadFailed, FK_AddressOfUnaddressableFunction, FK_ArrayNeedsInitList, FK_ArrayNeedsInitListOrStringLiteral, FK_ArrayNeedsInitListOrWideStringLiteral, FK_ArrayTypeMismatch, FK_ConstructorOverloadFailed, FK_ConversionFailed, FK_ConversionFromPropertyFailed, FK_DefaultInitOfConst, FK_DesignatedInitForNonAggregate, FK_ExplicitConstructor, FK_IncompatWideStringIntoWideChar, FK_Incomplete, FK_InitListBadDestinationType, FK_ListConstructorOverloadFailed, FK_ListInitializationFailed, FK_NarrowStringIntoWideCharArray, FK_NonConstantArrayInit, FK_NonConstLValueReferenceBindingToBitfield, FK_NonConstLValueReferenceBindingToMatrixElement, FK_NonConstLValueReferenceBindingToTemporary, FK_NonConstLValueReferenceBindingToUnrelated, FK_NonConstLValueReferenceBindingToVectorElement, FK_ParenthesizedListInitFailed, FK_ParenthesizedListInitForReference, FK_ParenthesizedListInitForScalar, FK_PlaceholderType, FK_PlainStringIntoUTF8Char, FK_ReferenceAddrspaceMismatchTemporary, FK_ReferenceBindingToInitList, FK_ReferenceInitDropsQualifiers, FK_ReferenceInitFailed, FK_ReferenceInitOverloadFailed, FK_RValueReferenceBindingToLValue, FK_TooManyInitsForReference, FK_TooManyInitsForScalar, FK_UserConversionOverloadFailed, FK_UTF8StringIntoPlainChar, FK_VariableLengthArrayHasInitializer, FK_WideStringIntoCharArray, NormalSequence, SK_ArrayInit, SK_ArrayLoopIndex, SK_ArrayLoopInit, SK_AtomicConversion, SK_BindReference, SK_BindReferenceToTemporary, SK_CAssignment, SK_CastDerivedToBaseLValue, SK_CastDerivedToBasePRValue, SK_CastDerivedToBaseXValue, SK_ConstructorInitialization, SK_ConstructorInitializationFromList, SK_ConversionSequence, SK_ConversionSequenceNoNarrowing, SK_ExtraneousCopyToTemporary, SK_FinalCopy, SK_FunctionReferenceConversion, SK_GNUArrayInit, SK_ListInitialization, SK_ObjCObjectConversion, SK_OCLSamplerInit, SK_OCLZeroOpaqueType, SK_ParenthesizedArrayInit, SK_ParenthesizedListInit, SK_PassByIndirectCopyRestore, SK_PassByIndirectRestore, SK_ProduceObjCObject, SK_QualificationConversionLValue, SK_QualificationConversionPRValue, SK_QualificationConversionXValue, SK_ResolveAddressOfOverloadedFunction, SK_RewrapInitList, SK_StdInitializerList, SK_StdInitializerListConstructorCall, SK_StringInit, SK_UnwrapInitList, SK_UserConversion, SK_ZeroInitialization, step_begin(), and step_end().

◆ Failed()

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

◆ getFailedCandidateSet()

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

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

Definition at line 1405 of file Initialization.h.

Referenced by InitializeFrom(), TryConstructorInitialization(), tryDiagnoseOverloadedCast(), TryReferenceInitializationCore(), TryRefInitWithConversionFunction(), and TryUserDefinedConversion().

◆ 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 1411 of file Initialization.h.

Referenced by tryDiagnoseOverloadedCast().

◆ getFailureKind()

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

Determine why initialization failed.

Definition at line 1423 of file Initialization.h.

References Failed().

Referenced by InitializeFrom(), isAmbiguous(), and tryDiagnoseOverloadedCast().

◆ getKind()

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

Determine the kind of initialization sequence computed.

Definition at line 1229 of file Initialization.h.

Referenced by Perform().

◆ InitializeFrom()

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

Definition at line 6319 of file SemaInit.cpp.

References AddArrayInitLoopStep(), AddArrayInitStep(), AddAtomicConversionStep(), AddCAssignmentStep(), AddConversionSequenceStep(), AddListInitializationStep(), AddParenthesizedArrayInitStep(), AddPassByIndirectCopyRestoreStep(), AddZeroInitializationStep(), clang::Atomic, clang::OverloadCandidateSet::BestViableFunction(), canPerformArrayCopy(), clang::SemaObjC::CheckConversionToObjCLiteral(), clang::SemaObjC::CheckObjCBridgeRelatedConversions(), clang::Sema::CheckPlaceholderExpr(), clang::Sema::Context, clang::IntegerLiteral::Create(), DependentSequence, E, clang::InitializedEntity::EK_Member, Failed(), clang::StandardConversionSequence::First, FK_AddressOfOverloadFailed, FK_AddressOfUnaddressableFunction, FK_ArrayNeedsInitList, FK_ArrayNeedsInitListOrStringLiteral, FK_ArrayNeedsInitListOrWideStringLiteral, FK_ArrayTypeMismatch, FK_ConstructorOverloadFailed, FK_ConversionFailed, FK_IncompatWideStringIntoWideChar, FK_NarrowStringIntoWideCharArray, FK_NonConstantArrayInit, FK_ParenthesizedListInitForReference, FK_ParenthesizedListInitForScalar, FK_PlaceholderType, FK_PlainStringIntoUTF8Char, FK_TooManyInitsForReference, FK_TooManyInitsForScalar, FK_UTF8StringIntoPlainChar, FK_VariableLengthArrayHasInitializer, FK_WideStringIntoCharArray, clang::Found, clang::ActionResult< PtrTy, Compress >::get(), clang::Type::getAs(), clang::ASTContext::getAsArrayType(), clang::Sema::getASTContext(), clang::RecordType::getDecl(), clang::InitializedEntity::getDecl(), clang::ArrayType::getElementType(), getFailedCandidateSet(), getFailureKind(), clang::ASTContext::getIntWidth(), clang::InitializedEntity::getKind(), clang::Sema::getLangOpts(), clang::ImplicitConversionSequence::getNullptrToBool(), clang::VectorType::getNumElements(), clang::StandardConversionSequence::getToType(), clang::InitializedEntity::getType(), clang::Expr::getValueKind(), clang::Expr::hasAnyTypeDependentArguments(), hasCompatibleArrayTypes(), clang::ASTContext::hasSameUnqualifiedType(), clang::ICK_Array_To_Pointer, clang::ICK_Lvalue_To_Rvalue, clang::ICK_Writeback_Conversion, clang::InitializationKind::IK_Copy, clang::InitializationKind::IK_Default, clang::InitializationKind::IK_Direct, clang::InitializationKind::IK_Value, clang::InitializedEntity::InitializeElement(), InitializeFrom(), clang::Initializer, clang::ASTContext::IntTy, clang::Type::isArrayParameterType(), clang::Type::isArrayType(), clang::ImplicitConversionSequence::isBad(), clang::Type::isBooleanType(), clang::Type::isCharType(), clang::Type::isDependentType(), clang::Sema::IsDerivedFrom(), isExprAnUnaddressableFunction(), clang::Type::isExtVectorType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), isLibstdcxxPointerReturnFalseHack(), clang::QualType::isNull(), clang::Type::isNullPtrType(), clang::InitializedEntity::isParameterKind(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::ImplicitConversionSequence::isStandard(), IsStringInit(), IsWideCharCompatible(), MaybeProduceObjCObject(), NormalSequence, clang::Sema::ObjC(), clang::Decl::OBJC_TQ_Out, clang::OR_Deleted, clang::ASTContext::OverloadTy, clang::Sema::ResolveAddressOfOverloadedFunction(), clang::StandardConversionSequence::Second, clang::StandardConversionSequence::setAllToTypes(), clang::StandardConversionSequence::setAsIdentityConversion(), SetFailed(), setSequenceKind(), clang::ImplicitConversionSequence::setStandard(), SIF_IncompatWideStringIntoWideChar, SIF_NarrowStringIntoWideChar, SIF_None, SIF_Other, SIF_PlainStringIntoUTF8Char, SIF_UTF8StringIntoPlainChar, SIF_WideStringIntoChar, clang::ImplicitConversionSequence::Standard, TryConstructorInitialization(), TryDefaultInitialization(), clang::Sema::TryImplicitConversion(), TryListInitialization(), tryObjCWritebackConversion(), TryOCLSamplerInitialization(), TryOCLZeroOpaqueTypeInitialization(), TryOrBuildParenListInitialization(), TryReferenceInitialization(), TryStringLiteralInitialization(), TryUserDefinedConversion(), and TryValueInitialization().

Referenced by InitializationSequence(), InitializeFrom(), and TryListInitialization().

◆ isAmbiguous()

bool InitializationSequence::isAmbiguous ( ) const

Determine whether this initialization failed due to an ambiguity.

Definition at line 3810 of file SemaInit.cpp.

References Failed(), FK_AddressOfOverloadFailed, FK_AddressOfUnaddressableFunction, FK_ArrayNeedsInitList, FK_ArrayNeedsInitListOrStringLiteral, FK_ArrayNeedsInitListOrWideStringLiteral, FK_ArrayTypeMismatch, FK_ConstructorOverloadFailed, FK_ConversionFailed, FK_ConversionFromPropertyFailed, FK_DefaultInitOfConst, FK_DesignatedInitForNonAggregate, FK_ExplicitConstructor, FK_IncompatWideStringIntoWideChar, FK_Incomplete, FK_InitListBadDestinationType, FK_ListConstructorOverloadFailed, FK_ListInitializationFailed, FK_NarrowStringIntoWideCharArray, FK_NonConstantArrayInit, FK_NonConstLValueReferenceBindingToBitfield, FK_NonConstLValueReferenceBindingToMatrixElement, FK_NonConstLValueReferenceBindingToTemporary, FK_NonConstLValueReferenceBindingToUnrelated, FK_NonConstLValueReferenceBindingToVectorElement, FK_ParenthesizedListInitFailed, FK_ParenthesizedListInitForReference, FK_ParenthesizedListInitForScalar, FK_PlaceholderType, FK_PlainStringIntoUTF8Char, FK_ReferenceAddrspaceMismatchTemporary, FK_ReferenceBindingToInitList, FK_ReferenceInitDropsQualifiers, FK_ReferenceInitFailed, FK_ReferenceInitOverloadFailed, FK_RValueReferenceBindingToLValue, FK_TooManyInitsForReference, FK_TooManyInitsForScalar, FK_UserConversionOverloadFailed, FK_UTF8StringIntoPlainChar, FK_VariableLengthArrayHasInitializer, FK_WideStringIntoCharArray, getFailureKind(), and clang::OR_Ambiguous.

Referenced by TryClassUnification().

◆ isConstructorInitialization()

bool InitializationSequence::isConstructorInitialization ( ) const

Determine whether this initialization is direct call to a constructor.

Definition at line 3864 of file SemaInit.cpp.

References SK_ConstructorInitialization.

Referenced by TryStaticImplicitCast().

◆ isDirectReferenceBinding()

bool InitializationSequence::isDirectReferenceBinding ( ) const

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

Definition at line 3799 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 1235 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 7521 of file SemaInit.cpp.

References clang::Sema::ActOnParenListExpr(), bool, clang::Sema::BuildCXXConstructExpr(), clang::Sema::BuildCXXMemberCallExpr(), clang::Type::castAs(), clang::Sema::checkAddressOfFunctionIsAvailable(), clang::Sema::CheckAddressOfMemberAccess(), CheckC23ConstexprInitConversion(), clang::Sema::CheckConstructorAccess(), clang::Sema::CheckDerivedToBaseConversion(), clang::Sema::CheckDestructorAccess(), clang::Sema::CheckExceptionSpecCompatibility(), CheckForNullPointerDereference(), checkIndirectCopyRestoreSource(), clang::Sema::checkInitializerLifetime(), clang::Sema::CheckMemberOperatorAccess(), CheckMoveOnConstruction(), clang::Sema::CheckPlaceholderExpr(), clang::Sema::CheckSingleAssignmentConstraints(), CheckStringInit(), clang::Sema::CheckTransparentUnionArgumentConstraints(), clang::Sema::Cleanup, clang::Sema::Compatible, clang::Complete, clang::Sema::CompleteConstructorCall(), clang::Sema::Context, CopyObject(), clang::ImplicitCastExpr::Create(), clang::Sema::CreateBuiltinArraySubscriptExpr(), clang::FixItHint::CreateInsertion(), clang::Sema::CreateMaterializeTemporaryExpr(), clang::CStyleCast, clang::Sema::CurFPFeatureOverrides(), D, DependentSequence, clang::Destructor, clang::SemaBase::Diag(), Diagnose(), clang::Sema::DiagnoseAssignmentResult(), DiagnoseNarrowingInInitList(), clang::Sema::DiagnoseUseOfDecl(), clang::Sema::DiscardMisalignedMemberAddress(), E, clang::InitializedEntity::EK_Base, clang::InitializedEntity::EK_Delegating, clang::InitializedEntity::EK_Member, clang::InitializedEntity::EK_Parameter_CF_Audited, clang::InitializedEntity::EK_ParenAggInitMember, clang::InitializedEntity::EK_Result, clang::InitializedEntity::EK_Variable, clang::Expr::EvaluateAsRValue(), clang::Evaluated, clang::ExprError(), Failed(), clang::Sema::FixOverloadedFunctionReference(), clang::InitializationSequence::Step::F::FoundDecl, clang::InitializationSequence::Step::F::Function, clang::InitializationSequence::Step::Function, clang::FunctionalCast, clang::ActionResult< PtrTy, Compress >::get(), clang::QualType::getAddressSpace(), clang::ActionResult< PtrTy, Compress >::getAs(), clang::Type::getAs(), clang::TypeLoc::getAs(), clang::ASTContext::getAsArrayType(), clang::ASTContext::getAsConstantArrayType(), clang::Type::getAsCXXRecordDecl(), clang::ASTContext::getAsIncompleteArrayType(), getAssignmentAction(), clang::SourceRange::getBegin(), clang::DeclaratorDecl::getBeginLoc(), clang::Decl::getBeginLoc(), clang::Stmt::getBeginLoc(), clang::ASTContext::getConstantArrayType(), clang::InitializedEntity::getDecl(), clang::CXXRecordDecl::getDefinition(), clang::ASTContext::getDependentSizedArrayType(), clang::SourceRange::getEnd(), clang::Expr::getExprLoc(), clang::InitListExpr::getInits(), clang::APValue::getInt(), clang::ASTContext::getIntWidth(), clang::InitializedEntity::getKind(), getKind(), clang::Sema::getLangOpts(), clang::InitListExpr::getLBraceLoc(), clang::ASTContext::getLValueReferenceType(), clang::QualType::getNonLValueExprType(), clang::QualType::getNonReferenceType(), clang::InitListExpr::getNumInits(), clang::Expr::getObjectKind(), clang::Sema::getOpenCLOptions(), clang::Type::getPointeeOrArrayElementType(), clang::InitListExpr::getRBraceLoc(), clang::FunctionDecl::getReturnType(), clang::ASTContext::getRValueReferenceType(), clang::ASTContext::getSizeType(), clang::Stmt::getSourceRange(), clang::MaterializeTemporaryExpr::getStorageDuration(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::ValueDecl::getType(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::QualType::getTypePtr(), clang::InitializedEntity::getTypeSourceInfo(), clang::QualType::getUnqualifiedType(), clang::Expr::getValueKind(), clang::InitializationSequence::Step::F::HadMultipleCandidates, clang::QualType::hasAddressSpace(), clang::Decl::hasAttr(), clang::ASTContext::hasSameType(), clang::InitializationSequence::Step::ICS, clang::Expr::IgnoreParens(), clang::InitializationKind::IK_Copy, clang::InitializationKind::IK_Direct, clang::InitializationKind::IK_DirectList, clang::InitializationKind::IK_Value, clang::Sema::ImpCastExprToType(), clang::Implicit, clang::Init, clang::InitializedEntity::InitializeTemporary(), initializingConstexprVariable(), clang::EnterExpressionEvaluationContext::InitList, clang::Type::isArrayType(), clang::Type::isAtomicType(), clang::OpenCLOptions::isAvailableOption(), clang::Type::isDependentType(), clang::QualType::isDestructedType(), clang::Type::isEventT(), clang::Type::isExtVectorType(), clang::Type::isFunctionProtoType(), clang::Type::isIncompleteArrayType(), clang::Type::isIntegerType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::Expr::isLValue(), clang::Type::isLValueReferenceType(), clang::APValue::isNullPointer(), clang::Type::isOCLIntelSubgroupAVCType(), clang::InitializedEntity::isParameterKind(), clang::InitializedEntity::isParamOrTemplateParamKind(), clang::Expr::isPRValue(), clang::Type::isQueueT(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::Type::isSamplerT(), clang::ReferenceType::isSpelledAsLValue(), clang::Sema::isStdInitializerList(), clang::InitializationSequence::Step::Kind, Loc, clang::Sema::LookupDestructor(), clang::Sema::MarkFunctionReferenced(), clang::Sema::MaybeBindToTemporary(), clang::Normal, clang::ASTContext::OCLSamplerTy, clang::opencl_global, clang::OtherCast, clang::SemaBase::PDiag(), PerformConstructorInitialization(), clang::Sema::PerformImplicitConversion(), clang::Sema::PerformQualificationConversion(), Range, clang::Sema::RequireNonAbstractType(), clang::Result, clang::SD_Automatic, clang::CleanupInfo::setExprNeedsCleanups(), clang::InitListExpr::setSyntacticForm(), clang::Expr::setType(), clang::Expr::setValueKind(), shouldBindAsTemporary(), shouldDestroyEntity(), SK_ArrayInit, SK_ArrayLoopIndex, SK_ArrayLoopInit, SK_AtomicConversion, SK_BindReference, SK_BindReferenceToTemporary, SK_CAssignment, SK_CastDerivedToBaseLValue, SK_CastDerivedToBasePRValue, SK_CastDerivedToBaseXValue, SK_ConstructorInitialization, SK_ConstructorInitializationFromList, SK_ConversionSequence, SK_ConversionSequenceNoNarrowing, SK_ExtraneousCopyToTemporary, SK_FinalCopy, SK_FunctionReferenceConversion, SK_GNUArrayInit, SK_ListInitialization, SK_ObjCObjectConversion, SK_OCLSamplerInit, SK_OCLZeroOpaqueType, SK_ParenthesizedArrayInit, SK_ParenthesizedListInit, SK_PassByIndirectCopyRestore, SK_PassByIndirectRestore, SK_ProduceObjCObject, SK_QualificationConversionLValue, SK_QualificationConversionPRValue, SK_QualificationConversionXValue, SK_ResolveAddressOfOverloadedFunction, SK_RewrapInitList, SK_StdInitializerList, SK_StdInitializerListConstructorCall, SK_StringInit, SK_UnwrapInitList, SK_UserConversion, SK_ZeroInitialization, step_begin(), step_end(), clang::T, TryOrBuildParenListInitialization(), clang::InitializationSequence::Step::Type, updateGNUCompoundLiteralRValue(), clang::Expr::EvalResult::Val, clang::VK_LValue, clang::VK_PRValue, clang::VK_XValue, clang::QualType::withConst(), and clang::InitializationSequence::Step::WrappingSyntacticList.

Referenced by clang::SemaOpenMP::ActOnOpenMPFirstprivateClause(), clang::Sema::ActOnUninitializedDecl(), clang::Sema::AddInitializerToDecl(), clang::Sema::BuildBaseInitializer(), clang::Sema::BuildCaptureInit(), clang::Sema::BuildCompoundLiteralExpr(), clang::Sema::buildCoroutinePromise(), clang::Sema::BuildCXXNew(), clang::Sema::BuildCXXTypeConstructExpr(), clang::Sema::BuildDelegatingInitializer(), clang::Sema::BuildExceptionDeclaration(), BuildImplicitBaseInitializer(), BuildImplicitMemberInitializer(), clang::Sema::buildLambdaInitCaptureInitialization(), clang::Sema::BuildMemberInitializer(), clang::Sema::CheckTemplateArgument(), ConvertForConditional(), clang::Sema::ConvertParamDefaultArgument(), clang::Sema::CreateBuiltinBinOp(), clang::Sema::FindCompositePointerType(), clang::SemaObjC::SetIvarInitializers(), clang::Sema::tryConvertExprToType(), TryOrBuildParenListInitialization(), 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 4094 of file SemaInit.cpp.

References clang::InitListExpr::getInit(), clang::InitListExpr::getNumInits(), clang::Expr::getType(), SK_RewrapInitList, SK_UnwrapInitList, and clang::T.

Referenced by TryConstructorInitialization(), TryListInitialization(), and TryReferenceListInitialization().

◆ SetFailed()

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

◆ setIncompleteTypeFailure()

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

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

Definition at line 1417 of file Initialization.h.

References FK_Incomplete, and SetFailed().

Referenced by TryConstructorInitialization(), TryInitializerListConstruction(), and TryListInitialization().

◆ SetOverloadFailure()

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

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

Definition at line 4109 of file SemaInit.cpp.

References FailedSequence, clang::Result, and setSequenceKind().

Referenced by TryConstructorInitialization(), TryReferenceInitializationCore(), and TryUserDefinedConversion().

◆ setSequenceKind()

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

Set the kind of sequence computed.

Definition at line 1232 of file Initialization.h.

Referenced by InitializeFrom(), SetOverloadFailure(), and TryOrBuildParenListInitialization().

◆ 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 1150 of file Initialization.h.

Referenced by maybeRecoverWithZeroInitialization().

◆ step_begin()

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

◆ step_end()

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

Definition at line 1243 of file Initialization.h.

Referenced by dump(), Perform(), steps(), and TryReferenceListInitialization().

◆ steps()

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

Definition at line 1247 of file Initialization.h.

References step_begin(), and step_end().

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


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