clang
15.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, 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. More... | |
bool | isBad () const |
bool | isStandard () const |
bool | isEllipsis () const |
bool | isAmbiguous () const |
bool | isUserDefined () const |
bool | isFailure () const |
bool | isInitialized () const |
Determines whether this conversion sequence has been initialized. More... | |
void | setBad (BadConversionSequence::FailureKind Failure, Expr *FromExpr, QualType ToType) |
Sets this sequence as a bad conversion for an explicit argument. More... | |
void | setBad (BadConversionSequence::FailureKind Failure, QualType FromType, QualType ToType) |
Sets this sequence as a bad conversion for an implicit argument. More... | |
void | setStandard () |
void | setEllipsis () |
void | setUserDefined () |
void | setAmbiguous () |
void | setAsIdentityConversion (QualType T) |
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. More... | |
void | dump () const |
dump - Print this implicit conversion sequence to standard error. More... | |
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. More... | |
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 518 of file Overload.h.
Enumerator | |
---|---|
Better | |
Indistinguishable | |
Worse |
Definition at line 723 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).
Enumerator | |
---|---|
StandardConversion | |
UserDefinedConversion | |
AmbiguousConversion | |
EllipsisConversion | |
BadConversion |
Definition at line 524 of file Overload.h.
|
inline |
Definition at line 578 of file Overload.h.
References clang::StandardConversionSequence::setAsIdentityConversion(), and Standard.
Referenced by operator=().
|
inline |
Definition at line 584 of file Overload.h.
References Ambiguous, AmbiguousConversion, Bad, BadConversion, clang::AmbiguousConversionSequence::copyFrom(), EllipsisConversion, Standard, StandardConversion, UserDefined, and UserDefinedConversion.
|
inline |
Definition at line 606 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 10502 of file SemaOverload.cpp.
Referenced by clang::Sema::PerformImplicitConversion().
void ImplicitConversionSequence::dump | ( | ) | const |
dump - Print this implicit conversion sequence to standard error.
Useful for debugging overloading issues.
Definition at line 541 of file SemaOverload.cpp.
|
inline |
Definition at line 696 of file Overload.h.
References hasInitializerListContainerType().
|
inline |
Definition at line 610 of file Overload.h.
References isInitialized().
Referenced by getKindRank(), isAmbiguous(), isBad(), isEllipsis(), isStandard(), isUserDefined(), and clang::Sema::PerformImplicitConversion().
|
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 622 of file Overload.h.
References AmbiguousConversion, BadConversion, EllipsisConversion, getKind(), StandardConversion, and UserDefinedConversion.
|
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 704 of file Overload.h.
References clang::StandardConversionSequence::First, clang::ICK_Boolean_Conversion, clang::ICK_Lvalue_To_Rvalue, clang::StandardConversionSequence::Second, clang::StandardConversionSequence::setAsIdentityConversion(), clang::StandardConversionSequence::setFromType(), setStandard(), clang::StandardConversionSequence::setToType(), and Standard.
|
inline |
Definition at line 686 of file Overload.h.
Referenced by getInitializerListContainerType().
|
inline |
Definition at line 644 of file Overload.h.
References AmbiguousConversion, and getKind().
Referenced by isFailure().
|
inline |
Definition at line 641 of file Overload.h.
References BadConversion, and getKind().
Referenced by isFailure(), clang::Sema::PerformContextuallyConvertToBool(), and clang::Sema::PerformContextuallyConvertToObjCPointer().
|
inline |
Definition at line 643 of file Overload.h.
References EllipsisConversion, and getKind().
|
inline |
Definition at line 646 of file Overload.h.
References isAmbiguous(), and isBad().
Referenced by clang::Sema::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 651 of file Overload.h.
Referenced by getKind().
|
inline |
Definition at line 693 of file Overload.h.
|
inline |
Definition at line 642 of file Overload.h.
References getKind(), and StandardConversion.
Referenced by hasDeprecatedStringLiteralToCharPtrConversion().
|
inline |
Definition at line 645 of file Overload.h.
References getKind(), and UserDefinedConversion.
Referenced by hasDeprecatedStringLiteralToCharPtrConversion().
|
inline |
Definition at line 600 of file Overload.h.
References ImplicitConversionSequence().
|
inline |
Definition at line 671 of file Overload.h.
References Ambiguous, AmbiguousConversion, and clang::AmbiguousConversionSequence::construct().
|
inline |
Definition at line 677 of file Overload.h.
References clang::StandardConversionSequence::setAllToTypes(), clang::StandardConversionSequence::setAsIdentityConversion(), clang::StandardConversionSequence::setFromType(), setStandard(), and Standard.
|
inline |
Sets this sequence as a bad conversion for an explicit argument.
Definition at line 654 of file Overload.h.
References Bad, BadConversion, and clang::BadConversionSequence::init().
|
inline |
Sets this sequence as a bad conversion for an implicit argument.
Definition at line 661 of file Overload.h.
References Bad, BadConversion, and clang::BadConversionSequence::init().
|
inline |
Definition at line 668 of file Overload.h.
References EllipsisConversion.
|
inline |
Definition at line 689 of file Overload.h.
|
inline |
Definition at line 667 of file Overload.h.
References StandardConversion.
Referenced by getNullptrToBool(), and setAsIdentityConversion().
|
inline |
Definition at line 669 of file Overload.h.
References UserDefinedConversion.
union { ... } |
AmbiguousConversionSequence clang::ImplicitConversionSequence::Ambiguous |
When ConversionKind == AmbiguousConversion, provides the details of the ambiguous conversion.
Definition at line 571 of file Overload.h.
Referenced by ImplicitConversionSequence(), and setAmbiguous().
BadConversionSequence clang::ImplicitConversionSequence::Bad |
When ConversionKind == BadConversion, provides the details of the bad conversion.
Definition at line 575 of file Overload.h.
Referenced by ImplicitConversionSequence(), and setBad().
StandardConversionSequence clang::ImplicitConversionSequence::Standard |
When ConversionKind == StandardConversion, provides the details of the standard conversion sequence.
Definition at line 563 of file Overload.h.
Referenced by getNullptrToBool(), hasDeprecatedStringLiteralToCharPtrConversion(), ImplicitConversionSequence(), clang::Sema::PerformImplicitConversion(), and setAsIdentityConversion().
UserDefinedConversionSequence clang::ImplicitConversionSequence::UserDefined |
When ConversionKind == UserDefinedConversion, provides the details of the user-defined conversion sequence.
Definition at line 567 of file Overload.h.
Referenced by clang::Sema::DiagnoseMultipleUserDefinedConversion(), hasDeprecatedStringLiteralToCharPtrConversion(), ImplicitConversionSequence(), and clang::Sema::PerformImplicitConversion().