clang
3.7.0
|
#include <Overload.h>
Public Types | |
enum | Kind { StandardConversion = 0, UserDefinedConversion, AmbiguousConversion, EllipsisConversion, BadConversion } |
enum | CompareKind { Better = -1, Indistinguishable = 0, Worse = 1 } |
Public Member Functions | |
ImplicitConversionSequence () | |
~ImplicitConversionSequence () | |
ImplicitConversionSequence (const ImplicitConversionSequence &Other) | |
ImplicitConversionSequence & | operator= (const ImplicitConversionSequence &Other) |
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 |
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 () |
bool | isStdInitializerListElement () const |
Whether the target is really a std::initializer_list, and the sequence only represents the worst element conversion. More... | |
void | setStdInitializerListElement (bool V=true) |
void | DiagnoseAmbiguousConversion (Sema &S, SourceLocation CaretLoc, const PartialDiagnostic &PDiag) const |
void | dump () const |
Public Attributes | |
union { | |
StandardConversionSequence Standard | |
UserDefinedConversionSequence UserDefined | |
AmbiguousConversionSequence Ambiguous | |
BadConversionSequence Bad | |
}; | |
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 372 of file Overload.h.
Enumerator | |
---|---|
Better | |
Indistinguishable | |
Worse |
Definition at line 532 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 378 of file Overload.h.
|
inline |
Definition at line 426 of file Overload.h.
Referenced by operator=().
|
inline |
Definition at line 429 of file Overload.h.
|
inline |
Definition at line 432 of file Overload.h.
References Ambiguous, AmbiguousConversion, Bad, BadConversion, clang::AmbiguousConversionSequence::copyFrom(), EllipsisConversion, Standard, StandardConversion, UserDefined, and UserDefinedConversion.
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 8646 of file SemaOverload.cpp.
References Ambiguous, clang::AmbiguousConversionSequence::begin(), clang::Sema::Diag(), clang::Sema::Diags, clang::AmbiguousConversionSequence::end(), clang::AmbiguousConversionSequence::getFromType(), clang::DiagnosticsEngine::getShowOverloads(), clang::AmbiguousConversionSequence::getToType(), clang::Sema::NoteOverloadCandidate(), and clang::Ovl_Best.
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 485 of file SemaOverload.cpp.
|
inline |
Definition at line 453 of file Overload.h.
References isInitialized().
Referenced by CheckConvertedConstantExpression(), CompareImplicitConversionSequences(), DiagnoseNarrowingInInitList(), getKindRank(), isAmbiguous(), isBad(), isEllipsis(), isStandard(), 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 465 of file Overload.h.
References AmbiguousConversion, BadConversion, EllipsisConversion, getKind(), StandardConversion, and UserDefinedConversion.
Referenced by CompareImplicitConversionSequences().
|
inline |
Definition at line 487 of file Overload.h.
References AmbiguousConversion, and getKind().
Referenced by isFailure(), and NoteAmbiguousUserConversions().
|
inline |
Definition at line 484 of file Overload.h.
References BadConversion, and getKind().
Referenced by clang::Sema::AddBuiltinCandidate(), clang::Sema::AddConversionCandidate(), clang::Sema::AddMethodCandidate(), clang::Sema::AddOverloadCandidate(), clang::Sema::AddSurrogateCandidate(), CompareImplicitConversionSequences(), CompleteNonViableCandidate(), DiagnoseBadConversion(), clang::InitializationSequence::InitializeFrom(), isFailure(), NoteAmbiguousUserConversions(), NoteFunctionCandidate(), clang::Sema::PerformContextuallyConvertToBool(), clang::Sema::PerformContextuallyConvertToObjCPointer(), clang::Sema::PerformObjectArgumentInitialization(), TryCopyInitialization(), TryListConversion(), and TryReferenceInitializationCore().
|
inline |
Definition at line 486 of file Overload.h.
References EllipsisConversion, and getKind().
Referenced by TryListConversion().
|
inline |
Definition at line 489 of file Overload.h.
References isAmbiguous(), and isBad().
Referenced by clang::Sema::CheckSingleAssignmentConstraints(), and TryListConversion().
|
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 494 of file Overload.h.
Referenced by CompleteNonViableCandidate(), and getKind().
|
inline |
Definition at line 485 of file Overload.h.
References getKind(), and StandardConversion.
Referenced by CompareImplicitConversionSequences(), hasDeprecatedStringLiteralToCharPtrConversion(), clang::InitializationSequence::InitializeFrom(), and TryListConversion().
|
inline |
Whether the target is really a std::initializer_list, and the sequence only represents the worst element conversion.
Definition at line 521 of file Overload.h.
Referenced by CompareImplicitConversionSequences().
|
inline |
Definition at line 488 of file Overload.h.
References getKind(), and UserDefinedConversion.
Referenced by CompareImplicitConversionSequences(), and hasDeprecatedStringLiteralToCharPtrConversion().
|
inline |
Definition at line 447 of file Overload.h.
References ImplicitConversionSequence().
|
inline |
Definition at line 513 of file Overload.h.
References Ambiguous, AmbiguousConversion, and clang::AmbiguousConversionSequence::construct().
Referenced by FindConversionForRefInit(), and TryUserDefinedConversion().
|
inline |
Sets this sequence as a bad conversion for an explicit argument.
Definition at line 497 of file Overload.h.
References Bad, BadConversion, and clang::BadConversionSequence::init().
Referenced by TryImplicitConversion(), TryListConversion(), TryObjectArgumentInitialization(), TryReferenceInit(), and TryUserDefinedConversion().
|
inline |
Sets this sequence as a bad conversion for an implicit argument.
Definition at line 504 of file Overload.h.
References Bad, BadConversion, and clang::BadConversionSequence::init().
|
inline |
Definition at line 511 of file Overload.h.
References EllipsisConversion.
Referenced by clang::Sema::AddOverloadCandidate(), clang::Sema::AddSurrogateCandidate(), and CompleteNonViableCandidate().
|
inline |
Definition at line 510 of file Overload.h.
References StandardConversion.
Referenced by clang::InitializationSequence::InitializeFrom(), TryImplicitConversion(), TryListConversion(), tryObjCWritebackConversion(), TryObjectArgumentInitialization(), TryRefInitWithConversionFunction(), and TryUserDefinedConversion().
Definition at line 525 of file Overload.h.
Referenced by TryListConversion().
|
inline |
Definition at line 512 of file Overload.h.
References UserDefinedConversion.
Referenced by clang::Sema::AddSurrogateCandidate(), FindConversionForRefInit(), TryListConversion(), and TryUserDefinedConversion().
union { ... } |
AmbiguousConversionSequence clang::ImplicitConversionSequence::Ambiguous |
When ConversionKind == AmbiguousConversion, provides the details of the ambiguous conversion.
Definition at line 419 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 423 of file Overload.h.
Referenced by DiagnoseBadConversion(), ImplicitConversionSequence(), clang::Sema::PerformObjectArgumentInitialization(), setBad(), and clang::OverloadCandidate::TryToFixBadConversion().
StandardConversionSequence clang::ImplicitConversionSequence::Standard |
When ConversionKind == StandardConversion, provides the details of the standard conversion sequence.
Definition at line 411 of file Overload.h.
Referenced by clang::Sema::AddSurrogateCandidate(), CheckConvertedConstantExpression(), CompareImplicitConversionSequences(), DiagnoseNarrowingInInitList(), hasDeprecatedStringLiteralToCharPtrConversion(), ImplicitConversionSequence(), clang::InitializationSequence::InitializeFrom(), clang::Sema::PerformImplicitConversion(), clang::Sema::PerformObjectArgumentInitialization(), TryContextuallyConvertToObjCPointer(), TryImplicitConversion(), TryListConversion(), tryObjCWritebackConversion(), TryObjectArgumentInitialization(), TryRefInitWithConversionFunction(), and TryUserDefinedConversion().
UserDefinedConversionSequence clang::ImplicitConversionSequence::UserDefined |
When ConversionKind == UserDefinedConversion, provides the details of the user-defined conversion sequence.
Definition at line 415 of file Overload.h.
Referenced by clang::Sema::AddSurrogateCandidate(), CheckConvertedConstantExpression(), CompareImplicitConversionSequences(), clang::Sema::DiagnoseMultipleUserDefinedConversion(), DiagnoseNarrowingInInitList(), FindConversionForRefInit(), hasDeprecatedStringLiteralToCharPtrConversion(), ImplicitConversionSequence(), clang::Sema::PerformImplicitConversion(), TryContextuallyConvertToObjCPointer(), TryListConversion(), and TryUserDefinedConversion().