clang
9.0.0
|
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3.1.1). More...
#include "clang/Sema/Overload.h"
Public Member Functions | |
void | setFromType (QualType T) |
void | setToType (unsigned Idx, QualType T) |
void | setAllToTypes (QualType T) |
QualType | getFromType () const |
QualType | getToType (unsigned Idx) const |
void | setAsIdentityConversion () |
StandardConversionSequence - Set the standard conversion sequence to the identity conversion. More... | |
bool | isIdentityConversion () const |
ImplicitConversionRank | getRank () const |
getRank - Retrieve the rank of this standard conversion sequence (C++ 13.3.3.1.1p3). More... | |
NarrowingKind | getNarrowingKind (ASTContext &Context, const Expr *Converted, APValue &ConstantValue, QualType &ConstantType, bool IgnoreFloatToIntegralConversion=false) const |
Check if this standard conversion sequence represents a narrowing conversion, according to C++11 [dcl.init.list]p7. More... | |
bool | isPointerConversionToBool () const |
isPointerConversionToBool - Determines whether this conversion is a conversion of a pointer or pointer-to-member to bool. More... | |
bool | isPointerConversionToVoidPointer (ASTContext &Context) const |
isPointerConversionToVoidPointer - Determines whether this conversion is a conversion of a pointer to a void pointer. More... | |
void | dump () const |
dump - Print this standard conversion sequence to standard error. More... | |
Public Attributes | |
ImplicitConversionKind | First: 8 |
First – The first conversion can be an lvalue-to-rvalue conversion, array-to-pointer conversion, or function-to-pointer conversion. More... | |
ImplicitConversionKind | Second: 8 |
Second - The second conversion can be an integral promotion, floating point promotion, integral conversion, floating point conversion, floating-integral conversion, pointer conversion, pointer-to-member conversion, or boolean conversion. More... | |
ImplicitConversionKind | Third: 8 |
Third - The third conversion can be a qualification conversion or a function conversion. More... | |
unsigned | DeprecatedStringLiteralToCharPtr: 1 |
Whether this is the deprecated conversion of a string literal to a pointer to non-const character data (C++ 4.2p2). More... | |
unsigned | QualificationIncludesObjCLifetime: 1 |
Whether the qualification conversion involves a change in the Objective-C lifetime (for automatic reference counting). More... | |
unsigned | IncompatibleObjC: 1 |
IncompatibleObjC - Whether this is an Objective-C conversion that we should warn about (if we actually use it). More... | |
unsigned | ReferenceBinding: 1 |
ReferenceBinding - True when this is a reference binding (C++ [over.ics.ref]). More... | |
unsigned | DirectBinding: 1 |
DirectBinding - True when this is a reference binding that is a direct binding (C++ [dcl.init.ref]). More... | |
unsigned | IsLvalueReference: 1 |
Whether this is an lvalue reference binding (otherwise, it's an rvalue reference binding). More... | |
unsigned | BindsToFunctionLvalue: 1 |
Whether we're binding to a function lvalue. More... | |
unsigned | BindsToRvalue: 1 |
Whether we're binding to an rvalue. More... | |
unsigned | BindsImplicitObjectArgumentWithoutRefQualifier: 1 |
Whether this binds an implicit object argument to a non-static member function without a ref-qualifier. More... | |
unsigned | ObjCLifetimeConversionBinding: 1 |
Whether this binds a reference to an object with a different Objective-C lifetime qualifier. More... | |
void * | FromTypePtr |
FromType - The type that this conversion is converting from. More... | |
void * | ToTypePtrs [3] |
ToType - The types that this conversion is converting to in each step. More... | |
CXXConstructorDecl * | CopyConstructor |
CopyConstructor - The copy constructor that is used to perform this conversion, when the conversion is actually just the initialization of an object via copy constructor. More... | |
DeclAccessPair | FoundCopyConstructor |
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3.1.1).
A standard conversion sequence contains between zero and three conversions. If a particular conversion is not needed, it will be set to the identity conversion (ICK_Identity). Note that the three conversions are specified as separate members (rather than in an array) so that we can keep the size of a standard conversion sequence to a single word.
Definition at line 229 of file Overload.h.
LLVM_DUMP_METHOD void StandardConversionSequence::dump | ( | ) | const |
dump - Print this standard conversion sequence to standard error.
Useful for debugging overloading issues.
Definition at line 467 of file SemaOverload.cpp.
References clang::First, GetImplicitConversionName(), and clang::ICK_Identity.
|
inline |
Definition at line 316 of file Overload.h.
References clang::QualType::getFromOpaquePtr().
Referenced by CheckConvertedConstantConversions(), CompareDerivedToBaseConversions(), and CompareStandardConversionSequences().
NarrowingKind StandardConversionSequence::getNarrowingKind | ( | ASTContext & | Ctx, |
const Expr * | Converted, | ||
APValue & | ConstantValue, | ||
QualType & | ConstantType, | ||
bool | IgnoreFloatToIntegralConversion = false |
||
) | const |
Check if this standard conversion sequence represents a narrowing conversion, according to C++11 [dcl.init.list]p7.
Ctx | The AST context. |
Converted | The result of applying this standard conversion sequence. |
ConstantValue | If this is an NK_Constant_Narrowing conversion, the value of the expression prior to the narrowing conversion. |
ConstantType | If this is an NK_Constant_Narrowing conversion, the type of the expression prior to the narrowing conversion. |
IgnoreFloatToIntegralConversion | If true type-narrowing conversions from floating point types to integral types should be ignored. |
Definition at line 293 of file SemaOverload.cpp.
References clang::Type::getAs(), clang::APValue::getFloat(), clang::ASTContext::getFloatingTypeOrder(), clang::ASTContext::getFloatTypeSemantics(), clang::ASTContext::getIntWidth(), clang::ASTContext::getLangOpts(), clang::Expr::getType(), clang::ICK_Boolean_Conversion, clang::ICK_Floating_Conversion, clang::ICK_Floating_Integral, clang::ICK_Integral_Conversion, IgnoreNarrowingConversion(), clang::Initializer, clang::Expr::isCXX11ConstantExpr(), clang::APValue::isFloat(), clang::Expr::isIntegerConstantExpr(), clang::Type::isIntegralOrUnscopedEnumerationType(), clang::Type::isIntegralType(), clang::Type::isRealFloatingType(), clang::Type::isSignedIntegerOrEnumerationType(), clang::Expr::isValueDependent(), clang::NK_Constant_Narrowing, clang::NK_Dependent_Narrowing, clang::NK_Not_Narrowing, clang::NK_Type_Narrowing, and clang::NK_Variable_Narrowing.
Referenced by CheckConvertedConstantExpression(), checkThreeWayNarrowingConversion(), DiagnoseNarrowingInInitList(), and isIdentityConversion().
ImplicitConversionRank StandardConversionSequence::getRank | ( | ) | const |
getRank - Retrieve the rank of this standard conversion sequence (C++ 13.3.3.1.1p3).
The rank is the largest rank of each of the implicit conversions.
Definition at line 203 of file SemaOverload.cpp.
References clang::First, clang::GetConversionRank(), and clang::ICR_Exact_Match.
Referenced by CompareStandardConversionSequences(), and isIdentityConversion().
|
inline |
Definition at line 320 of file Overload.h.
References clang::QualType::getFromOpaquePtr(), and setAsIdentityConversion().
Referenced by CheckConvertedConstantConversions(), CompareDerivedToBaseConversions(), CompareQualificationConversions(), CompareStandardConversionSequences(), TryListInitialization(), and TryRefInitWithConversionFunction().
|
inline |
Definition at line 327 of file Overload.h.
References getNarrowingKind(), getRank(), clang::ICK_Identity, Second, and Third.
bool StandardConversionSequence::isPointerConversionToBool | ( | ) | const |
isPointerConversionToBool - Determines whether this conversion is a conversion of a pointer or pointer-to-member to bool.
This is used as part of the ranking of standard conversion sequences (C++ 13.3.3.2p4).
Definition at line 218 of file SemaOverload.cpp.
References clang::First, clang::ICK_Array_To_Pointer, clang::ICK_Function_To_Pointer, isBooleanType(), and isPointerConversionToVoidPointer().
Referenced by CompareStandardConversionSequences().
bool StandardConversionSequence::isPointerConversionToVoidPointer | ( | ASTContext & | Context | ) | const |
isPointerConversionToVoidPointer - Determines whether this conversion is a conversion of a pointer to a void pointer.
This is used as part of the ranking of standard conversion sequences (C++ 13.3.3.2p4).
Definition at line 241 of file SemaOverload.cpp.
Referenced by CompareStandardConversionSequences(), and isPointerConversionToBool().
|
inline |
Definition at line 310 of file Overload.h.
References clang::QualType::getAsOpaquePtr().
Referenced by IsInitializerListConstructorConversion(), IsStandardConversion(), IsUserDefinedConversion(), TryImplicitConversion(), TryListConversion(), TryObjectArgumentInitialization(), and TryUserDefinedConversion().
void StandardConversionSequence::setAsIdentityConversion | ( | ) |
StandardConversionSequence - Set the standard conversion sequence to the identity conversion.
Definition at line 184 of file SemaOverload.cpp.
References clang::First, and clang::ICK_Identity.
Referenced by checkThreeWayNarrowingConversion(), getToType(), IsInitializerListConstructorConversion(), IsStandardConversion(), IsUserDefinedConversion(), TryImplicitConversion(), TryListConversion(), TryListInitialization(), tryObjCWritebackConversion(), TryObjectArgumentInitialization(), and TryUserDefinedConversion().
|
inline |
Definition at line 303 of file Overload.h.
References clang::QualType::getAsOpaquePtr().
Referenced by clang::BadConversionSequence::init(), IsInitializerListConstructorConversion(), IsStandardConversion(), IsUserDefinedConversion(), clang::BadConversionSequence::setFromExpr(), TryImplicitConversion(), TryListConversion(), TryListInitialization(), TryObjectArgumentInitialization(), and TryUserDefinedConversion().
|
inline |
Definition at line 305 of file Overload.h.
References clang::QualType::getAsOpaquePtr().
Referenced by checkThreeWayNarrowingConversion(), clang::BadConversionSequence::init(), IsStandardConversion(), tryAtomicConversion(), and TryListInitialization().
unsigned clang::StandardConversionSequence::BindsImplicitObjectArgumentWithoutRefQualifier |
Whether this binds an implicit object argument to a non-static member function without a ref-qualifier.
Definition at line 279 of file Overload.h.
Referenced by isBetterReferenceBindingKind(), TryListConversion(), and TryObjectArgumentInitialization().
unsigned clang::StandardConversionSequence::BindsToFunctionLvalue |
Whether we're binding to a function lvalue.
Definition at line 272 of file Overload.h.
Referenced by isBetterReferenceBindingKind(), TryListConversion(), and TryObjectArgumentInitialization().
unsigned clang::StandardConversionSequence::BindsToRvalue |
Whether we're binding to an rvalue.
Definition at line 275 of file Overload.h.
Referenced by isBetterReferenceBindingKind(), TryListConversion(), and TryObjectArgumentInitialization().
CXXConstructorDecl* clang::StandardConversionSequence::CopyConstructor |
CopyConstructor - The copy constructor that is used to perform this conversion, when the conversion is actually just the initialization of an object via copy constructor.
Such conversions are either identity conversions or derived-to-base conversions.
Definition at line 300 of file Overload.h.
Referenced by IsStandardConversion(), clang::Sema::PerformImplicitConversion(), TryImplicitConversion(), and TryUserDefinedConversion().
unsigned clang::StandardConversionSequence::DeprecatedStringLiteralToCharPtr |
Whether this is the deprecated conversion of a string literal to a pointer to non-const character data (C++ 4.2p2).
Definition at line 249 of file Overload.h.
Referenced by CompareQualificationConversions(), hasDeprecatedStringLiteralToCharPtrConversion(), IsStandardConversion(), and clang::Sema::PerformImplicitConversion().
unsigned clang::StandardConversionSequence::DirectBinding |
DirectBinding - True when this is a reference binding that is a direct binding (C++ [dcl.init.ref]).
Definition at line 265 of file Overload.h.
Referenced by CheckConvertedConstantExpression(), FindConversionForRefInit(), and TryObjectArgumentInitialization().
ImplicitConversionKind clang::StandardConversionSequence::First |
First – The first conversion can be an lvalue-to-rvalue conversion, array-to-pointer conversion, or function-to-pointer conversion.
Definition at line 234 of file Overload.h.
Referenced by CompareDerivedToBaseConversions(), CompareQualificationConversions(), CompareStandardConversionSequences(), IsStandardConversion(), clang::Sema::PerformImplicitConversion(), TryListInitialization(), and tryObjCWritebackConversion().
DeclAccessPair clang::StandardConversionSequence::FoundCopyConstructor |
Definition at line 301 of file Overload.h.
Referenced by clang::Sema::PerformImplicitConversion(), and TryUserDefinedConversion().
void* clang::StandardConversionSequence::FromTypePtr |
FromType - The type that this conversion is converting from.
This is an opaque pointer that can be translated into a QualType.
Definition at line 288 of file Overload.h.
unsigned clang::StandardConversionSequence::IncompatibleObjC |
IncompatibleObjC - Whether this is an Objective-C conversion that we should warn about (if we actually use it).
Definition at line 257 of file Overload.h.
Referenced by IsStandardConversion(), and clang::Sema::PerformImplicitConversion().
unsigned clang::StandardConversionSequence::IsLvalueReference |
Whether this is an lvalue reference binding (otherwise, it's an rvalue reference binding).
Definition at line 269 of file Overload.h.
Referenced by isBetterReferenceBindingKind(), TryListConversion(), and TryObjectArgumentInitialization().
unsigned clang::StandardConversionSequence::ObjCLifetimeConversionBinding |
Whether this binds a reference to an object with a different Objective-C lifetime qualifier.
Definition at line 283 of file Overload.h.
Referenced by CompareStandardConversionSequences(), and TryListConversion().
unsigned clang::StandardConversionSequence::QualificationIncludesObjCLifetime |
Whether the qualification conversion involves a change in the Objective-C lifetime (for automatic reference counting).
Definition at line 253 of file Overload.h.
Referenced by CompareQualificationConversions(), IsStandardConversion(), and tryAtomicConversion().
unsigned clang::StandardConversionSequence::ReferenceBinding |
ReferenceBinding - True when this is a reference binding (C++ [over.ics.ref]).
Definition at line 261 of file Overload.h.
Referenced by CheckConvertedConstantExpression(), CompareStandardConversionSequences(), FindConversionForRefInit(), TryListConversion(), and TryObjectArgumentInitialization().
ImplicitConversionKind clang::StandardConversionSequence::Second |
Second - The second conversion can be an integral promotion, floating point promotion, integral conversion, floating point conversion, floating-integral conversion, pointer conversion, pointer-to-member conversion, or boolean conversion.
Definition at line 240 of file Overload.h.
Referenced by CheckConvertedConstantConversions(), checkThreeWayNarrowingConversion(), CompareDerivedToBaseConversions(), CompareQualificationConversions(), CompareStandardConversionSequences(), dropPointerConversion(), isIdentityConversion(), IsStandardConversion(), clang::Sema::PerformImplicitConversion(), tryAtomicConversion(), TryImplicitConversion(), TryListInitialization(), TryObjectArgumentInitialization(), and TryUserDefinedConversion().
ImplicitConversionKind clang::StandardConversionSequence::Third |
Third - The third conversion can be a qualification conversion or a function conversion.
Definition at line 244 of file Overload.h.
Referenced by CompareQualificationConversions(), dropPointerConversion(), isIdentityConversion(), IsStandardConversion(), clang::Sema::PerformImplicitConversion(), and tryAtomicConversion().
void* clang::StandardConversionSequence::ToTypePtrs[3] |
ToType - The types that this conversion is converting to in each step.
This is an opaque pointer that can be translated into a QualType.
Definition at line 293 of file Overload.h.
Referenced by dropPointerConversion().