Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/Sema/SemaOverload.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | static const ImplicitConversionRank | ||||
ICR_Conversion, | ICR_Conversion, | ||||
ICR_Conversion, | ICR_Conversion, | ||||
ICR_Conversion, | ICR_Conversion, | ||||
ICR_Conversion, | ICR_Conversion, | ||||
ICR_Conversion, | ICR_Conversion, | ||||
ICR_Conversion, | ICR_Conversion, | ||||
ICR_Conversion, | ICR_Conversion, | ||||
ICR_Conversion, | ICR_Conversion, | ||||
ICR_Conversion, | |||||
ICR_OCL_Scalar_Widening, | ICR_OCL_Scalar_Widening, | ||||
ICR_Complex_Real_Conversion, | ICR_Complex_Real_Conversion, | ||||
ICR_Conversion, | ICR_Conversion, | ||||
ICR_Conversion, | ICR_Conversion, | ||||
ICR_Writeback_Conversion, | ICR_Writeback_Conversion, | ||||
ICR_Exact_Match, // NOTE(gbiv): This may not be completely right -- | ICR_Exact_Match, // NOTE(gbiv): This may not be completely right -- | ||||
// it was omitted by the patch that added | // it was omitted by the patch that added | ||||
// ICK_Zero_Event_Conversion | // ICK_Zero_Event_Conversion | ||||
Show All 26 Lines | static const char* const Name[] = { | ||||
"Floating-integral conversion", | "Floating-integral conversion", | ||||
"Pointer conversion", | "Pointer conversion", | ||||
"Pointer-to-member conversion", | "Pointer-to-member conversion", | ||||
"Boolean conversion", | "Boolean conversion", | ||||
"Compatible-types conversion", | "Compatible-types conversion", | ||||
"Derived-to-base conversion", | "Derived-to-base conversion", | ||||
"Vector conversion", | "Vector conversion", | ||||
"SVE Vector conversion", | "SVE Vector conversion", | ||||
"RVV Vector conversion", | |||||
"Vector splat", | "Vector splat", | ||||
"Complex-real conversion", | "Complex-real conversion", | ||||
"Block Pointer conversion", | "Block Pointer conversion", | ||||
"Transparent Union Conversion", | "Transparent Union Conversion", | ||||
"Writeback conversion", | "Writeback conversion", | ||||
"OpenCL Zero Event Conversion", | "OpenCL Zero Event Conversion", | ||||
"OpenCL Zero Queue Conversion", | "OpenCL Zero Queue Conversion", | ||||
"C specific type conversion", | "C specific type conversion", | ||||
▲ Show 20 Lines • Show All 1,562 Lines • ▼ Show 20 Lines | static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType, | ||||
if (ToType->isSVESizelessBuiltinType() || | if (ToType->isSVESizelessBuiltinType() || | ||||
FromType->isSVESizelessBuiltinType()) | FromType->isSVESizelessBuiltinType()) | ||||
if (S.Context.areCompatibleSveTypes(FromType, ToType) || | if (S.Context.areCompatibleSveTypes(FromType, ToType) || | ||||
S.Context.areLaxCompatibleSveTypes(FromType, ToType)) { | S.Context.areLaxCompatibleSveTypes(FromType, ToType)) { | ||||
ICK = ICK_SVE_Vector_Conversion; | ICK = ICK_SVE_Vector_Conversion; | ||||
return true; | return true; | ||||
} | } | ||||
if (ToType->isRVVSizelessBuiltinType() || | |||||
FromType->isRVVSizelessBuiltinType()) | |||||
if (S.Context.areCompatibleRVVTypes(FromType, ToType) || | |||||
S.Context.areLaxCompatibleRVVTypes(FromType, ToType)) { | |||||
ICK = ICK_RVV_Vector_Conversion; | |||||
return true; | |||||
} | |||||
// We can perform the conversion between vector types in the following cases: | // We can perform the conversion between vector types in the following cases: | ||||
// 1)vector types are equivalent AltiVec and GCC vector types | // 1)vector types are equivalent AltiVec and GCC vector types | ||||
// 2)lax vector conversions are permitted and the vector types are of the | // 2)lax vector conversions are permitted and the vector types are of the | ||||
// same size | // same size | ||||
// 3)the destination type does not have the ARM MVE strict-polymorphism | // 3)the destination type does not have the ARM MVE strict-polymorphism | ||||
// attribute, which inhibits lax vector conversion for overload resolution | // attribute, which inhibits lax vector conversion for overload resolution | ||||
// only | // only | ||||
if (ToType->isVectorType() && FromType->isVectorType()) { | if (ToType->isVectorType() && FromType->isVectorType()) { | ||||
▲ Show 20 Lines • Show All 2,550 Lines • ▼ Show 20 Lines | if (SCS1.Second == ICK_SVE_Vector_Conversion && | ||||
if (SCS1IsCompatibleSVEVectorConversion != | if (SCS1IsCompatibleSVEVectorConversion != | ||||
SCS2IsCompatibleSVEVectorConversion) | SCS2IsCompatibleSVEVectorConversion) | ||||
return SCS1IsCompatibleSVEVectorConversion | return SCS1IsCompatibleSVEVectorConversion | ||||
? ImplicitConversionSequence::Better | ? ImplicitConversionSequence::Better | ||||
: ImplicitConversionSequence::Worse; | : ImplicitConversionSequence::Worse; | ||||
} | } | ||||
if (SCS1.Second == ICK_RVV_Vector_Conversion && | |||||
SCS2.Second == ICK_RVV_Vector_Conversion) { | |||||
bool SCS1IsCompatibleRVVVectorConversion = | |||||
S.Context.areCompatibleRVVTypes(SCS1.getFromType(), SCS1.getToType(2)); | |||||
bool SCS2IsCompatibleRVVVectorConversion = | |||||
S.Context.areCompatibleRVVTypes(SCS2.getFromType(), SCS2.getToType(2)); | |||||
if (SCS1IsCompatibleRVVVectorConversion != | |||||
SCS2IsCompatibleRVVVectorConversion) | |||||
return SCS1IsCompatibleRVVVectorConversion | |||||
? ImplicitConversionSequence::Better | |||||
: ImplicitConversionSequence::Worse; | |||||
} | |||||
return ImplicitConversionSequence::Indistinguishable; | return ImplicitConversionSequence::Indistinguishable; | ||||
} | } | ||||
/// CompareQualificationConversions - Compares two standard conversion | /// CompareQualificationConversions - Compares two standard conversion | ||||
/// sequences to determine whether they can be ranked based on their | /// sequences to determine whether they can be ranked based on their | ||||
/// qualification conversions (C++ 13.3.3.2p3 bullet 3). | /// qualification conversions (C++ 13.3.3.2p3 bullet 3). | ||||
static ImplicitConversionSequence::CompareKind | static ImplicitConversionSequence::CompareKind | ||||
CompareQualificationConversions(Sema &S, | CompareQualificationConversions(Sema &S, | ||||
▲ Show 20 Lines • Show All 1,422 Lines • ▼ Show 20 Lines | static bool CheckConvertedConstantConversions(Sema &S, | ||||
case ICK_Complex_Promotion: | case ICK_Complex_Promotion: | ||||
case ICK_Floating_Conversion: | case ICK_Floating_Conversion: | ||||
case ICK_Complex_Conversion: | case ICK_Complex_Conversion: | ||||
case ICK_Floating_Integral: | case ICK_Floating_Integral: | ||||
case ICK_Compatible_Conversion: | case ICK_Compatible_Conversion: | ||||
case ICK_Derived_To_Base: | case ICK_Derived_To_Base: | ||||
case ICK_Vector_Conversion: | case ICK_Vector_Conversion: | ||||
case ICK_SVE_Vector_Conversion: | case ICK_SVE_Vector_Conversion: | ||||
case ICK_RVV_Vector_Conversion: | |||||
case ICK_Vector_Splat: | case ICK_Vector_Splat: | ||||
case ICK_Complex_Real: | case ICK_Complex_Real: | ||||
case ICK_Block_Pointer_Conversion: | case ICK_Block_Pointer_Conversion: | ||||
case ICK_TransparentUnionConversion: | case ICK_TransparentUnionConversion: | ||||
case ICK_Writeback_Conversion: | case ICK_Writeback_Conversion: | ||||
case ICK_Zero_Event_Conversion: | case ICK_Zero_Event_Conversion: | ||||
case ICK_C_Only_Conversion: | case ICK_C_Only_Conversion: | ||||
case ICK_Incompatible_Pointer_Conversion: | case ICK_Incompatible_Pointer_Conversion: | ||||
▲ Show 20 Lines • Show All 9,823 Lines • Show Last 20 Lines |