clang 20.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
clang::ImplicitConversionSequence Class Reference

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)
 
ImplicitConversionSequenceoperator= (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 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...
 
}; 
 

Detailed Description

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 567 of file Overload.h.

Member Enumeration Documentation

◆ CompareKind

Enumerator
Better 
Indistinguishable 
Worse 

Definition at line 785 of file Overload.h.

◆ Kind

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 576 of file Overload.h.

Constructor & Destructor Documentation

◆ ImplicitConversionSequence() [1/2]

clang::ImplicitConversionSequence::ImplicitConversionSequence ( )
inline

Definition at line 633 of file Overload.h.

References clang::StandardConversionSequence::setAsIdentityConversion(), and Standard.

Referenced by operator=().

◆ ImplicitConversionSequence() [2/2]

clang::ImplicitConversionSequence::ImplicitConversionSequence ( const ImplicitConversionSequence Other)
inline

◆ ~ImplicitConversionSequence()

clang::ImplicitConversionSequence::~ImplicitConversionSequence ( )
inline

Definition at line 663 of file Overload.h.

Member Function Documentation

◆ DiagnoseAmbiguousConversion()

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 11152 of file SemaOverload.cpp.

References clang::SemaBase::Diag(), clang::Sema::Diags, E, clang::DiagnosticsEngine::getNumOverloadCandidatesToShow(), int, clang::Sema::NoteOverloadCandidate(), and clang::DiagnosticsEngine::overloadCandidatesShown().

Referenced by NoteAmbiguousUserConversions(), and clang::Sema::PerformImplicitConversion().

◆ dump()

void ImplicitConversionSequence::dump ( ) const

dump - Print this implicit conversion sequence to standard error.

Useful for debugging overloading issues.

Definition at line 670 of file SemaOverload.cpp.

References AmbiguousConversion, BadConversion, clang::StandardConversionSequence::dump(), clang::UserDefinedConversionSequence::dump(), EllipsisConversion, hasInitializerListContainerType(), Standard, StandardConversion, UserDefined, and UserDefinedConversion.

◆ getInitializerListContainerType()

QualType clang::ImplicitConversionSequence::getInitializerListContainerType ( ) const
inline

Definition at line 758 of file Overload.h.

References hasInitializerListContainerType().

Referenced by CompareImplicitConversionSequences().

◆ getKind()

Kind clang::ImplicitConversionSequence::getKind ( ) const
inline

◆ getKindRank()

unsigned clang::ImplicitConversionSequence::getKindRank ( ) const
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 679 of file Overload.h.

References AmbiguousConversion, BadConversion, EllipsisConversion, getKind(), StandardConversion, StaticObjectArgumentConversion, and UserDefinedConversion.

Referenced by CompareImplicitConversionSequences().

◆ getNullptrToBool()

static ImplicitConversionSequence clang::ImplicitConversionSequence::getNullptrToBool ( QualType  SourceType,
QualType  DestType,
bool  NeedLValToRVal 
)
inlinestatic

◆ hasInitializerListContainerType()

bool clang::ImplicitConversionSequence::hasInitializerListContainerType ( ) const
inline

◆ isAmbiguous()

bool clang::ImplicitConversionSequence::isAmbiguous ( ) const
inline

Definition at line 705 of file Overload.h.

References AmbiguousConversion, and getKind().

Referenced by isFailure(), and NoteAmbiguousUserConversions().

◆ isBad()

bool clang::ImplicitConversionSequence::isBad ( ) const
inline

◆ isEllipsis()

bool clang::ImplicitConversionSequence::isEllipsis ( ) const
inline

Definition at line 704 of file Overload.h.

References EllipsisConversion, and getKind().

◆ isFailure()

bool clang::ImplicitConversionSequence::isFailure ( ) const
inline

◆ isInitialized()

bool clang::ImplicitConversionSequence::isInitialized ( ) const
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 712 of file Overload.h.

Referenced by getKind().

◆ isInitializerListOfIncompleteArray()

bool clang::ImplicitConversionSequence::isInitializerListOfIncompleteArray ( ) const
inline

Definition at line 755 of file Overload.h.

Referenced by CompareImplicitConversionSequences().

◆ isStandard()

bool clang::ImplicitConversionSequence::isStandard ( ) const
inline

◆ isStaticObjectArgument()

bool clang::ImplicitConversionSequence::isStaticObjectArgument ( ) const
inline

Definition at line 701 of file Overload.h.

References getKind(), and StaticObjectArgumentConversion.

◆ isUserDefined()

bool clang::ImplicitConversionSequence::isUserDefined ( ) const
inline

◆ operator=()

ImplicitConversionSequence & clang::ImplicitConversionSequence::operator= ( const ImplicitConversionSequence Other)
inline

Definition at line 657 of file Overload.h.

References ImplicitConversionSequence(), and clang::Other.

◆ setAmbiguous()

void clang::ImplicitConversionSequence::setAmbiguous ( )
inline

◆ setAsIdentityConversion()

void clang::ImplicitConversionSequence::setAsIdentityConversion ( QualType  T)
inline

◆ setBad() [1/2]

void clang::ImplicitConversionSequence::setBad ( BadConversionSequence::FailureKind  Failure,
Expr FromExpr,
QualType  ToType 
)
inline

Sets this sequence as a bad conversion for an explicit argument.

Definition at line 715 of file Overload.h.

References Bad, BadConversion, and clang::BadConversionSequence::init().

Referenced by TryImplicitConversion(), TryListConversion(), TryObjectArgumentInitialization(), TryReferenceInit(), and TryUserDefinedConversion().

◆ setBad() [2/2]

void clang::ImplicitConversionSequence::setBad ( BadConversionSequence::FailureKind  Failure,
QualType  FromType,
QualType  ToType 
)
inline

Sets this sequence as a bad conversion for an implicit argument.

Definition at line 722 of file Overload.h.

References Bad, BadConversion, and clang::BadConversionSequence::init().

◆ setEllipsis()

void clang::ImplicitConversionSequence::setEllipsis ( )
inline

Definition at line 730 of file Overload.h.

References EllipsisConversion.

◆ setInitializerListContainerType()

void clang::ImplicitConversionSequence::setInitializerListContainerType ( QualType  T,
bool  IA 
)
inline

Definition at line 751 of file Overload.h.

References clang::T.

◆ setStandard()

void clang::ImplicitConversionSequence::setStandard ( )
inline

◆ setStaticObjectArgument()

void clang::ImplicitConversionSequence::setStaticObjectArgument ( )
inline

Definition at line 729 of file Overload.h.

References StaticObjectArgumentConversion.

◆ setUserDefined()

void clang::ImplicitConversionSequence::setUserDefined ( )
inline

Definition at line 731 of file Overload.h.

References UserDefinedConversion.

Referenced by FindConversionForRefInit(), and TryUserDefinedConversion().

Member Data Documentation

◆ 

union { ... } clang::ImplicitConversionSequence::@239

◆ Ambiguous

AmbiguousConversionSequence clang::ImplicitConversionSequence::Ambiguous

When ConversionKind == AmbiguousConversion, provides the details of the ambiguous conversion.

Definition at line 626 of file Overload.h.

Referenced by FindConversionForRefInit(), ImplicitConversionSequence(), setAmbiguous(), and TryUserDefinedConversion().

◆ Bad

BadConversionSequence clang::ImplicitConversionSequence::Bad

When ConversionKind == BadConversion, provides the details of the bad conversion.

Definition at line 630 of file Overload.h.

Referenced by DiagnoseBadConversion(), ImplicitConversionSequence(), clang::Sema::PerformImplicitObjectArgumentInitialization(), setBad(), and TryObjectArgumentInitialization().

◆ Standard

StandardConversionSequence clang::ImplicitConversionSequence::Standard

◆ UserDefined

UserDefinedConversionSequence clang::ImplicitConversionSequence::UserDefined

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