|
clang 22.0.0git
|
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conversion sequence (C++ 13.3.3.1.1), user-defined conversion sequence (C++ 13.3.3.1.2), or an ellipsis conversion sequence (C++ 13.3.3.1.3). More...
#include "clang/Sema/Overload.h"
Public Types | |
| enum | Kind { StandardConversion = 0 , StaticObjectArgumentConversion , UserDefinedConversion , AmbiguousConversion , EllipsisConversion , BadConversion } |
| Kind - The kind of implicit conversion sequence. More... | |
| enum | CompareKind { Better = -1 , Indistinguishable = 0 , Worse = 1 } |
Public Member Functions | |
| ImplicitConversionSequence () | |
| ImplicitConversionSequence (const ImplicitConversionSequence &Other) | |
| ImplicitConversionSequence & | operator= (const ImplicitConversionSequence &Other) |
| ~ImplicitConversionSequence () | |
| Kind | getKind () const |
| unsigned | getKindRank () const |
| Return a ranking of the implicit conversion sequence kind, where smaller ranks represent better conversion sequences. | |
| bool | isBad () const |
| bool | isStandard () const |
| bool | isStaticObjectArgument () const |
| bool | isEllipsis () const |
| bool | isAmbiguous () const |
| bool | isUserDefined () const |
| bool | isFailure () const |
| bool | isInitialized () const |
| Determines whether this conversion sequence has been initialized. | |
| void | setBad (BadConversionSequence::FailureKind Failure, Expr *FromExpr, QualType ToType) |
| Sets this sequence as a bad conversion for an explicit argument. | |
| void | setBad (BadConversionSequence::FailureKind Failure, QualType FromType, QualType ToType) |
| Sets this sequence as a bad conversion for an implicit argument. | |
| void | setStandard () |
| void | setStaticObjectArgument () |
| void | setEllipsis () |
| void | setUserDefined () |
| void | setAmbiguous () |
| void | setAsIdentityConversion (QualType T) |
| bool | isPerfect (const ASTContext &C) const |
| A conversion sequence is perfect if it is an identity conversion and the type of the source is the same as the type of the target. | |
| bool | hasInitializerListContainerType () const |
| void | setInitializerListContainerType (QualType T, bool IA) |
| bool | isInitializerListOfIncompleteArray () const |
| QualType | getInitializerListContainerType () const |
| void | DiagnoseAmbiguousConversion (Sema &S, SourceLocation CaretLoc, const PartialDiagnostic &PDiag) const |
| Diagnoses an ambiguous conversion. | |
| void | dump () const |
| dump - Print this implicit conversion sequence to standard error. | |
Static Public Member Functions | |
| static ImplicitConversionSequence | getNullptrToBool (QualType SourceType, QualType DestType, bool NeedLValToRVal) |
| Form an "implicit" conversion sequence from nullptr_t to bool, for a direct-initialization of a bool object from nullptr_t. | |
Public Attributes | |
| union { | |
| StandardConversionSequence Standard | |
| When ConversionKind == StandardConversion, provides the details of the standard conversion sequence. More... | |
| UserDefinedConversionSequence UserDefined | |
| When ConversionKind == UserDefinedConversion, provides the details of the user-defined conversion sequence. More... | |
| AmbiguousConversionSequence Ambiguous | |
| When ConversionKind == AmbiguousConversion, provides the details of the ambiguous conversion. More... | |
| BadConversionSequence Bad | |
| When ConversionKind == BadConversion, provides the details of the bad conversion. More... | |
| }; | |
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conversion sequence (C++ 13.3.3.1.1), user-defined conversion sequence (C++ 13.3.3.1.2), or an ellipsis conversion sequence (C++ 13.3.3.1.3).
Definition at line 621 of file Overload.h.
| Enumerator | |
|---|---|
| Better | |
| Indistinguishable | |
| Worse | |
Definition at line 845 of file Overload.h.
Kind - The kind of implicit conversion sequence.
BadConversion specifies that there is no conversion from the source type to the target type. AmbiguousConversion represents the unique ambiguous conversion (C++0x [over.best.ics]p10). StaticObjectArgumentConversion represents the conversion rules for the synthesized first argument of calls to static member functions ([over.best.ics.general]p8).
| Enumerator | |
|---|---|
| StandardConversion | |
| StaticObjectArgumentConversion | |
| UserDefinedConversion | |
| AmbiguousConversion | |
| EllipsisConversion | |
| BadConversion | |
Definition at line 630 of file Overload.h.
|
inline |
Definition at line 687 of file Overload.h.
References false, and Standard.
Referenced by getNullptrToBool(), ImplicitConversionSequence(), and operator=().
|
inline |
Definition at line 693 of file Overload.h.
References Ambiguous, AmbiguousConversion, Bad, BadConversion, EllipsisConversion, ImplicitConversionSequence(), clang::Other, Standard, StandardConversion, StaticObjectArgumentConversion, UserDefined, and UserDefinedConversion.
|
inline |
Definition at line 717 of file Overload.h.
| void ImplicitConversionSequence::DiagnoseAmbiguousConversion | ( | Sema & | S, |
| SourceLocation | CaretLoc, | ||
| const PartialDiagnostic & | PDiag ) const |
Diagnoses an ambiguous conversion.
The partial diagnostic is the "lead" diagnostic; it will be given two arguments, the source and target types of the conversion.
Definition at line 11836 of file SemaOverload.cpp.
References Ambiguous, clang::SemaBase::Diag(), clang::Sema::Diags, clang::DiagnosticsEngine::getNumOverloadCandidatesToShow(), int, clang::Sema::NoteOverloadCandidate(), and clang::DiagnosticsEngine::overloadCandidatesShown().
Referenced by NoteAmbiguousUserConversions(), and clang::Sema::PerformImplicitConversion().
| void ImplicitConversionSequence::dump | ( | ) | const |
dump - Print this implicit conversion sequence to standard error.
Useful for debugging overloading issues.
Definition at line 672 of file SemaOverload.cpp.
References AmbiguousConversion, BadConversion, EllipsisConversion, hasInitializerListContainerType(), Standard, StandardConversion, UserDefined, and UserDefinedConversion.
|
inline |
Definition at line 818 of file Overload.h.
References hasInitializerListContainerType().
Referenced by CompareImplicitConversionSequences().
|
inline |
Definition at line 721 of file Overload.h.
References isInitialized().
Referenced by clang::Sema::AddConversionCandidate(), BuildConvertedConstantExpression(), CompareImplicitConversionSequences(), DiagnoseNarrowingInInitList(), getKindRank(), isAmbiguous(), isBad(), isEllipsis(), isStandard(), isStaticObjectArgument(), isUserDefined(), clang::Sema::PerformImplicitConversion(), and TryContextuallyConvertToObjCPointer().
|
inline |
Return a ranking of the implicit conversion sequence kind, where smaller ranks represent better conversion sequences.
In particular, this routine gives user-defined conversion sequences and ambiguous conversion sequences the same rank, per C++ [over.best.ics]p10.
Definition at line 733 of file Overload.h.
References AmbiguousConversion, BadConversion, EllipsisConversion, getKind(), StandardConversion, StaticObjectArgumentConversion, and UserDefinedConversion.
Referenced by CompareImplicitConversionSequences().
|
inlinestatic |
Form an "implicit" conversion sequence from nullptr_t to bool, for a direct-initialization of a bool object from nullptr_t.
Definition at line 826 of file Overload.h.
References clang::StandardConversionSequence::First, clang::ICK_Boolean_Conversion, clang::ICK_Lvalue_To_Rvalue, ImplicitConversionSequence(), clang::StandardConversionSequence::Second, clang::StandardConversionSequence::setAsIdentityConversion(), clang::StandardConversionSequence::setFromType(), setStandard(), clang::StandardConversionSequence::setToType(), and Standard.
Referenced by clang::InitializationSequence::InitializeFrom(), and TryContextuallyConvertToBool().
|
inline |
Definition at line 808 of file Overload.h.
Referenced by CompareImplicitConversionSequences(), dump(), and getInitializerListContainerType().
|
inline |
Definition at line 759 of file Overload.h.
References AmbiguousConversion, and getKind().
Referenced by isFailure(), and NoteAmbiguousUserConversions().
|
inline |
Definition at line 753 of file Overload.h.
References BadConversion, and getKind().
Referenced by clang::Sema::AddSurrogateCandidate(), CompareImplicitConversionSequences(), DiagnoseBadConversion(), clang::InitializationSequence::InitializeFrom(), isFailure(), NoteAmbiguousUserConversions(), clang::Sema::PerformContextuallyConvertToBool(), clang::Sema::PerformContextuallyConvertToObjCPointer(), clang::Sema::PerformImplicitObjectArgumentInitialization(), clang::Sema::SelectBestMethod(), TryCopyInitialization(), TryListConversion(), TryObjectArgumentInitialization(), and TryReferenceInitializationCore().
|
inline |
Definition at line 758 of file Overload.h.
References EllipsisConversion, and getKind().
|
inline |
Definition at line 761 of file Overload.h.
References isAmbiguous(), and isBad().
Referenced by clang::SemaOpenMP::checkOpenMPDeclareVariantFunction(), and clang::Sema::CheckSingleAssignmentConstraints().
|
inline |
Determines whether this conversion sequence has been initialized.
Most operations should never need to query uninitialized conversions and should assert as above.
Definition at line 766 of file Overload.h.
Referenced by getKind().
|
inline |
Definition at line 815 of file Overload.h.
Referenced by CompareImplicitConversionSequences().
|
inline |
A conversion sequence is perfect if it is an identity conversion and the type of the source is the same as the type of the target.
Definition at line 802 of file Overload.h.
References clang::C, isStandard(), and Standard.
|
inline |
Definition at line 754 of file Overload.h.
References getKind(), and StandardConversion.
Referenced by CheckC23ConstexprInitConversion(), CompareImplicitConversionSequences(), hasDeprecatedStringLiteralToCharPtrConversion(), clang::InitializationSequence::InitializeFrom(), isPerfect(), clang::Sema::SelectBestMethod(), and TryReferenceInit().
|
inline |
Definition at line 755 of file Overload.h.
References getKind(), and StaticObjectArgumentConversion.
|
inline |
Definition at line 760 of file Overload.h.
References getKind(), and UserDefinedConversion.
Referenced by CompareImplicitConversionSequences(), hasDeprecatedStringLiteralToCharPtrConversion(), and TryReferenceInit().
|
inline |
Definition at line 711 of file Overload.h.
References ImplicitConversionSequence(), and clang::Other.
|
inline |
Definition at line 787 of file Overload.h.
References Ambiguous, and AmbiguousConversion.
Referenced by FindConversionForRefInit(), and TryUserDefinedConversion().
|
inline |
Definition at line 793 of file Overload.h.
References setStandard(), Standard, and clang::T.
|
inline |
Sets this sequence as a bad conversion for an explicit argument.
Definition at line 769 of file Overload.h.
References Bad, and BadConversion.
Referenced by TryImplicitConversion(), TryListConversion(), TryObjectArgumentInitialization(), TryReferenceInit(), and TryUserDefinedConversion().
|
inline |
Sets this sequence as a bad conversion for an implicit argument.
Definition at line 776 of file Overload.h.
References Bad, and BadConversion.
|
inline |
Definition at line 784 of file Overload.h.
References EllipsisConversion.
|
inline |
Definition at line 782 of file Overload.h.
References StandardConversion.
Referenced by getNullptrToBool(), clang::InitializationSequence::InitializeFrom(), setAsIdentityConversion(), TryImplicitConversion(), TryListInitialization(), tryObjCWritebackConversion(), TryObjectArgumentInitialization(), TryReferenceInit(), TryRefInitWithConversionFunction(), TryUserDefinedConversion(), and TryUserDefinedConversion().
|
inline |
Definition at line 783 of file Overload.h.
References StaticObjectArgumentConversion.
|
inline |
Definition at line 785 of file Overload.h.
References UserDefinedConversion.
Referenced by FindConversionForRefInit(), and TryUserDefinedConversion().
| union { ... } clang::ImplicitConversionSequence |
| AmbiguousConversionSequence clang::ImplicitConversionSequence::Ambiguous |
When ConversionKind == AmbiguousConversion, provides the details of the ambiguous conversion.
Definition at line 680 of file Overload.h.
Referenced by DiagnoseAmbiguousConversion(), FindConversionForRefInit(), ImplicitConversionSequence(), setAmbiguous(), and TryUserDefinedConversion().
| BadConversionSequence clang::ImplicitConversionSequence::Bad |
When ConversionKind == BadConversion, provides the details of the bad conversion.
Definition at line 684 of file Overload.h.
Referenced by DiagnoseBadConversion(), ImplicitConversionSequence(), clang::Sema::PerformImplicitObjectArgumentInitialization(), setBad(), setBad(), and TryObjectArgumentInitialization().
| StandardConversionSequence clang::ImplicitConversionSequence::Standard |
When ConversionKind == StandardConversion, provides the details of the standard conversion sequence.
Definition at line 672 of file Overload.h.
Referenced by clang::Sema::AddConversionCandidate(), clang::Sema::AddSurrogateCandidate(), BuildConvertedConstantExpression(), CheckC23ConstexprInitConversion(), CompareImplicitConversionSequences(), DiagnoseNarrowingInInitList(), dump(), getNullptrToBool(), hasDeprecatedStringLiteralToCharPtrConversion(), ImplicitConversionSequence(), ImplicitConversionSequence(), clang::InitializationSequence::InitializeFrom(), isPerfect(), clang::Sema::PerformImplicitConversion(), clang::Sema::PerformImplicitObjectArgumentInitialization(), clang::Sema::SelectBestMethod(), setAsIdentityConversion(), TryContextuallyConvertToObjCPointer(), TryImplicitConversion(), TryListInitialization(), tryObjCWritebackConversion(), TryObjectArgumentInitialization(), TryReferenceInit(), TryRefInitWithConversionFunction(), TryUserDefinedConversion(), and TryUserDefinedConversion().
| UserDefinedConversionSequence clang::ImplicitConversionSequence::UserDefined |
When ConversionKind == UserDefinedConversion, provides the details of the user-defined conversion sequence.
Definition at line 676 of file Overload.h.
Referenced by BuildConvertedConstantExpression(), CompareImplicitConversionSequences(), clang::Sema::DiagnoseMultipleUserDefinedConversion(), DiagnoseNarrowingInInitList(), dump(), FindConversionForRefInit(), hasDeprecatedStringLiteralToCharPtrConversion(), ImplicitConversionSequence(), clang::Sema::PerformImplicitConversion(), TryContextuallyConvertToObjCPointer(), TryReferenceInit(), and TryUserDefinedConversion().