14#ifndef LLVM_CLANG_SEMA_OVERLOAD_H
15#define LLVM_CLANG_SEMA_OVERLOAD_H
28#include "llvm/ADT/ArrayRef.h"
29#include "llvm/ADT/STLExtras.h"
30#include "llvm/ADT/SmallPtrSet.h"
31#include "llvm/ADT/SmallVector.h"
32#include "llvm/ADT/StringRef.h"
33#include "llvm/Support/AlignOf.h"
34#include "llvm/Support/Allocator.h"
35#include "llvm/Support/Casting.h"
36#include "llvm/Support/ErrorHandling.h"
267 ImplicitConversionKind Dimension);
320 LLVM_PREFERRED_TYPE(
bool)
325 LLVM_PREFERRED_TYPE(
bool)
330 LLVM_PREFERRED_TYPE(
bool)
335 LLVM_PREFERRED_TYPE(
bool)
340 LLVM_PREFERRED_TYPE(
bool)
345 LLVM_PREFERRED_TYPE(
bool)
349 LLVM_PREFERRED_TYPE(
bool)
353 LLVM_PREFERRED_TYPE(
bool)
358 LLVM_PREFERRED_TYPE(
bool)
363 LLVM_PREFERRED_TYPE(
bool)
370 LLVM_PREFERRED_TYPE(
bool)
394 assert(Idx < 3 &&
"To type index is out of range");
409 assert(Idx < 3 &&
"To type index is out of range");
436 if (
T->isArrayType() ||
T->isFunctionType())
437 T =
C.getDecayedType(
T);
443 T =
C.getDecayedType(N->getPointeeType());
465 bool IgnoreFloatToIntegralConversion =
false)
const;
642 LLVM_PREFERRED_TYPE(Kind)
643 unsigned ConversionKind : 31;
646 LLVM_PREFERRED_TYPE(
bool)
647 unsigned InitializerListOfIncompleteArray : 1;
654 QualType InitializerListContainerType;
656 void setKind(Kind K) {
685 : ConversionKind(Uninitialized),
686 InitializerListOfIncompleteArray(
false) {
691 : ConversionKind(
Other.ConversionKind),
692 InitializerListOfIncompleteArray(
693 Other.InitializerListOfIncompleteArray),
694 InitializerListContainerType(
Other.InitializerListContainerType) {
695 switch (ConversionKind) {
696 case Uninitialized:
break;
719 assert(
isInitialized() &&
"querying uninitialized conversion");
720 return Kind(ConversionKind);
747 llvm_unreachable(
"Invalid ImplicitConversionSequence::Kind!");
769 Bad.init(Failure, FromExpr, ToType);
776 Bad.init(Failure, FromType, ToType);
806 return !InitializerListContainerType.isNull();
809 InitializerListContainerType =
T;
810 InitializerListOfIncompleteArray = IA;
813 return InitializerListOfIncompleteArray;
817 "not initializer list container");
818 return InitializerListContainerType;
825 bool NeedLValToRVal) {
929 struct OverloadCandidate {
958 LLVM_PREFERRED_TYPE(
bool)
968 LLVM_PREFERRED_TYPE(
bool)
974 LLVM_PREFERRED_TYPE(
bool)
984 LLVM_PREFERRED_TYPE(
bool)
987 LLVM_PREFERRED_TYPE(
bool)
993 LLVM_PREFERRED_TYPE(
bool)
997 LLVM_PREFERRED_TYPE(
CallExpr::ADLCallKind)
1001 LLVM_PREFERRED_TYPE(
bool)
1039 if (!
C.isInitialized())
return false;
1040 if (
C.isAmbiguous())
return true;
1051 if (!
C.isInitialized() || !
C.isPerfect(Ctx))
1060 bool CanFix =
Fix.tryToFixConversion(
1102 LLVM_PREFERRED_TYPE(Kind)
1104 LLVM_PREFERRED_TYPE(
bool)
1106 LLVM_PREFERRED_TYPE(
bool)
1108 LLVM_PREFERRED_TYPE(
bool)
1110 LLVM_PREFERRED_TYPE(
bool)
1112 LLVM_PREFERRED_TYPE(
bool)
1114 LLVM_PREFERRED_TYPE(
bool)
1126 static_assert(std::is_trivially_destructible_v<
1139 static_assert(std::is_trivially_destructible_v<
1151 static_assert(std::is_trivially_destructible_v<
1195 bool AllowRewritten)
1262 unsigned DeferredCandidatesCount : 8 *
sizeof(
unsigned) - 2;
1263 LLVM_PREFERRED_TYPE(
bool)
1264 unsigned HasDeferredTemplateConstructors : 1;
1265 LLVM_PREFERRED_TYPE(
bool)
1266 unsigned ResolutionByPerfectCandidateIsDisabled : 1;
1271 llvm::BumpPtrAllocator SlabAllocator;
1274 CandidateSetKind Kind;
1275 OperatorRewriteInfo RewriteInfo;
1279 constexpr static unsigned NumInlineBytes =
1282 unsigned NumInlineBytesUsed = 0;
1283 alignas(
void *)
char InlineSpace[NumInlineBytes];
1292 template <
typename T>
1293 T *slabAllocate(
unsigned N) {
1295 static_assert(
alignof(
T) ==
alignof(
void *),
1296 "Only works for pointer-aligned types.");
1297 static_assert(std::is_trivially_destructible_v<T> ||
1298 (std::is_same_v<ImplicitConversionSequence, T>),
1299 "Add destruction logic to OverloadCandidateSet::clear().");
1301 unsigned NBytes =
sizeof(
T) * N;
1302 if (NBytes > NumInlineBytes - NumInlineBytesUsed)
1303 return SlabAllocator.Allocate<
T>(N);
1304 char *FreeSpaceStart = InlineSpace + NumInlineBytesUsed;
1305 assert(
uintptr_t(FreeSpaceStart) %
alignof(
void *) == 0 &&
1306 "Misaligned storage!");
1308 NumInlineBytesUsed += NBytes;
1309 return reinterpret_cast<T *
>(FreeSpaceStart);
1317 template <
typename T> T *allocateDeferredCandidate() {
1318 T *C = slabAllocate<T>(1);
1319 if (!FirstDeferredCandidate)
1320 FirstDeferredCandidate = C;
1322 auto *F = FirstDeferredCandidate;
1327 DeferredCandidatesCount++;
1331 void destroyCandidates();
1336 : FirstDeferredCandidate(
nullptr), DeferredCandidatesCount(0),
1337 HasDeferredTemplateConstructors(
false),
1338 ResolutionByPerfectCandidateIsDisabled(
false), Loc(Loc), Kind(CSK),
1339 RewriteInfo(RewriteInfo) {}
1352 bool shouldDeferTemplateArgumentDeduction(
const LangOptions &Opts)
const;
1360 return Functions.insert(Key).second;
1370 void clear(CandidateSetKind CSK);
1377 size_t size()
const {
return Candidates.size() + DeferredCandidatesCount; }
1382 return Candidates.empty() && DeferredCandidatesCount == 0;
1390 slabAllocate<ImplicitConversionSequence>(NumConversions);
1393 for (
unsigned I = 0; I != NumConversions; ++I)
1405 Expr **Exprs = slabAllocate<Expr *>(N);
1409 template <
typename...
T>
1413 llvm::copy(std::initializer_list<Expr *>{Exprs...}, Arr.data());
1421 assert((Conversions.empty() || Conversions.size() == NumConversions) &&
1422 "preallocated conversion sequence has wrong length");
1426 C.Conversions = Conversions.empty()
1427 ? allocateConversionSequences(NumConversions)
1432 void AddDeferredTemplateCandidate(
1433 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
1435 bool PartialOverloading,
bool AllowExplicit,
1436 CallExpr::ADLCallKind IsADLCandidate, OverloadCandidateParamOrder PO,
1437 bool AggregateCandidateDeduction);
1439 void AddDeferredMethodTemplateCandidate(
1440 FunctionTemplateDecl *MethodTmpl, DeclAccessPair FoundDecl,
1441 CXXRecordDecl *ActingContext, QualType ObjectType,
1443 bool SuppressUserConversions,
bool PartialOverloading,
1444 OverloadCandidateParamOrder PO);
1446 void AddDeferredConversionTemplateCandidate(
1447 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
1448 CXXRecordDecl *ActingContext, Expr *From, QualType ToType,
1449 bool AllowObjCConversionOnExplicit,
bool AllowExplicit,
1450 bool AllowResultConversion);
1452 void InjectNonDeducedTemplateCandidates(Sema &S);
1455 ResolutionByPerfectCandidateIsDisabled =
true;
1468 void NoteCandidates(
1469 PartialDiagnosticAt PA, Sema &S, OverloadCandidateDisplayKind OCD,
1471 SourceLocation Loc = SourceLocation(),
1472 llvm::function_ref<
bool(OverloadCandidate &)> Filter =
1473 [](OverloadCandidate &) {
return true; });
1475 void NoteCandidates(Sema &S, ArrayRef<Expr *> Args,
1476 ArrayRef<OverloadCandidate *> Cands,
1478 SourceLocation OpLoc = SourceLocation());
1485 "can't set the destination address space when not constructing an "
1492 void CudaExcludeWrongSideCandidates(
1500 const OverloadCandidate &Cand2,
1527 Info.
Constructor = dyn_cast<CXXConstructorDecl>(D);
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::SourceLocation class and associated facilities.
C Language Family Type Representation.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a C++ constructor within a class.
Represents a C++ conversion function within a class.
Represents a C++ struct/union/class.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
Decl - This represents one declaration (or definition), e.g.
AccessSpecifier getAccess() const
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
The return type of classify().
This represents one expression.
Represents a function declaration or definition.
Represents a prototype with parameter type info, e.g.
Declaration of a template function.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
void dump() const
dump - Print this implicit conversion sequence to standard error.
ImplicitConversionSequence & operator=(const ImplicitConversionSequence &Other)
bool isUserDefined() const
Kind
Kind - The kind of implicit conversion sequence.
@ StaticObjectArgumentConversion
bool isPerfect(const ASTContext &C) const
A conversion sequence is perfect if it is an identity conversion and the type of the source is the sa...
StandardConversionSequence Standard
When ConversionKind == StandardConversion, provides the details of the standard conversion sequence.
void setBad(BadConversionSequence::FailureKind Failure, Expr *FromExpr, QualType ToType)
Sets this sequence as a bad conversion for an explicit argument.
UserDefinedConversionSequence UserDefined
When ConversionKind == UserDefinedConversion, provides the details of the user-defined conversion seq...
ImplicitConversionSequence(const ImplicitConversionSequence &Other)
bool isInitialized() const
Determines whether this conversion sequence has been initialized.
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 ...
AmbiguousConversionSequence Ambiguous
When ConversionKind == AmbiguousConversion, provides the details of the ambiguous conversion.
void setInitializerListContainerType(QualType T, bool IA)
bool hasInitializerListContainerType() const
unsigned getKindRank() const
Return a ranking of the implicit conversion sequence kind, where smaller ranks represent better conve...
bool isStaticObjectArgument() const
void setStaticObjectArgument()
bool isInitializerListOfIncompleteArray() const
BadConversionSequence Bad
When ConversionKind == BadConversion, provides the details of the bad conversion.
QualType getInitializerListContainerType() const
~ImplicitConversionSequence()
void setAsIdentityConversion(QualType T)
void DiagnoseAmbiguousConversion(Sema &S, SourceLocation CaretLoc, const PartialDiagnostic &PDiag) const
Diagnoses an ambiguous conversion.
void setBad(BadConversionSequence::FailureKind Failure, QualType FromType, QualType ToType)
Sets this sequence as a bad conversion for an implicit argument.
ImplicitConversionSequence()
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
A pointer to member type per C++ 8.3.3 - Pointers to members.
bool isMemberFunctionPointer() const
Returns true if the member type (i.e.
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
llvm::MutableArrayRef< Expr * > getPersistentArgsArray(T *...Exprs)
OverloadCandidateSet & operator=(const OverloadCandidateSet &)=delete
bool isNewCandidate(Decl *F, OverloadCandidateParamOrder PO=OverloadCandidateParamOrder::Normal)
Determine when this overload candidate will be new to the overload set.
void DisableResolutionByPerfectCandidate()
void setDestAS(LangAS AS)
ConversionSequenceList allocateConversionSequences(unsigned NumConversions)
Allocate storage for conversion sequences for NumConversions conversions.
OverloadCandidateSet(SourceLocation Loc, CandidateSetKind CSK, OperatorRewriteInfo RewriteInfo={})
llvm::MutableArrayRef< Expr * > getPersistentArgsArray(unsigned N)
Provide storage for any Expr* arg that must be preserved until deferred template candidates are deduc...
OperatorRewriteInfo getRewriteInfo() const
bool shouldDeferTemplateArgumentDeduction(const LangOptions &Opts) const
@ CSK_AddressOfOverloadSet
C++ [over.match.call.general] Resolve a call through the address of an overload set.
@ CSK_InitByConstructor
C++ [over.match.ctor], [over.match.list] Initialization of an object of class type by constructor,...
@ CSK_InitByUserDefinedConversion
C++ [over.match.copy]: Copy-initialization of an object of class type by user-defined conversion.
@ CSK_Normal
Normal lookup.
@ CSK_Operator
C++ [over.match.oper]: Lookup of operator function candidates in a call using operator syntax.
@ CSK_CodeCompletion
When doing overload resolution during code completion, we want to show all viable candidates,...
SmallVectorImpl< OverloadCandidate >::iterator iterator
OverloadCandidateSet(const OverloadCandidateSet &)=delete
void exclude(Decl *F)
Exclude a function from being considered by overload resolution.
SourceLocation getLocation() const
OverloadCandidate & addCandidate(unsigned NumConversions=0, ConversionSequenceList Conversions={})
Add a new candidate with NumConversions conversion sequence slots to the overload set.
CandidateSetKind getKind() const
size_t nonDeferredCandidatesCount() const
A (possibly-)qualified type.
static QualType getFromOpaquePtr(const void *Ptr)
Sema - This implements semantic analysis and AST building for C.
Encodes a location in the source.
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3....
void dump() const
dump - Print this standard conversion sequence to standard error.
void setFromType(QualType T)
DeclAccessPair FoundCopyConstructor
bool isIdentityConversion() const
void * FromTypePtr
FromType - The type that this conversion is converting from.
unsigned BindsToRvalue
Whether we're binding to an rvalue.
ImplicitConversionKind Second
Second - The second conversion can be an integral promotion, floating point promotion,...
bool isPerfect(const ASTContext &C) const
A conversion sequence is perfect if it is an identity conversion and the type of the source is the sa...
QualType getFromType() const
ImplicitConversionKind First
First – The first conversion can be an lvalue-to-rvalue conversion, array-to-pointer conversion,...
unsigned BindsImplicitObjectArgumentWithoutRefQualifier
Whether this binds an implicit object argument to a non-static member function without a ref-qualifie...
unsigned ReferenceBinding
ReferenceBinding - True when this is a reference binding (C++ [over.ics.ref]).
void setAsIdentityConversion()
StandardConversionSequence - Set the standard conversion sequence to the identity conversion.
unsigned DeprecatedStringLiteralToCharPtr
Whether this is the deprecated conversion of a string literal to a pointer to non-const character dat...
CXXConstructorDecl * CopyConstructor
CopyConstructor - The copy constructor that is used to perform this conversion, when the conversion i...
unsigned IncompatibleObjC
IncompatibleObjC - Whether this is an Objective-C conversion that we should warn about (if we actuall...
unsigned ObjCLifetimeConversionBinding
Whether this binds a reference to an object with a different Objective-C lifetime qualifier.
ImplicitConversionKind Third
Third - The third conversion can be a qualification conversion or a function conversion.
unsigned QualificationIncludesObjCLifetime
Whether the qualification conversion involves a change in the Objective-C lifetime (for automatic ref...
void setToType(unsigned Idx, QualType T)
bool isPointerConversionToBool() const
isPointerConversionToBool - Determines whether this conversion is a conversion of a pointer or pointe...
void * ToTypePtrs[3]
ToType - The types that this conversion is converting to in each step.
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...
unsigned IsLvalueReference
Whether this is an lvalue reference binding (otherwise, it's an rvalue reference binding).
ImplicitConversionKind Dimension
Dimension - Between the second and third conversion a vector or matrix dimension conversion may occur...
unsigned BindsToFunctionLvalue
Whether we're binding to a function lvalue.
unsigned DirectBinding
DirectBinding - True when this is a reference binding that is a direct binding (C++ [dcl....
ImplicitConversionRank getRank() const
getRank - Retrieve the rank of this standard conversion sequence (C++ 13.3.3.1.1p3).
bool isPointerConversionToVoidPointer(ASTContext &Context) const
isPointerConversionToVoidPointer - Determines whether this conversion is a conversion of a pointer to...
void setAllToTypes(QualType T)
unsigned FromBracedInitList
Whether the source expression was originally a single element braced-init-list.
QualType getToType(unsigned Idx) const
const T * castAs() const
Member-template castAs<specific type>.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isPointerOrReferenceType() const
The JSON file list parser is used to communicate input to InstallAPI.
ImplicitConversionRank GetDimensionConversionRank(ImplicitConversionRank Base, ImplicitConversionKind Dimension)
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
bool isa(CodeGen::Address addr)
OverloadingResult
OverloadingResult - Capture the result of performing overload resolution.
@ OR_Deleted
Succeeded, but refers to a deleted function.
@ OR_Success
Overload resolution succeeded.
@ OR_Ambiguous
Ambiguous candidates found.
@ OR_No_Viable_Function
No viable function found.
bool isBetterOverloadCandidate(Sema &S, const OverloadCandidate &Cand1, const OverloadCandidate &Cand2, SourceLocation Loc, OverloadCandidateSet::CandidateSetKind Kind, bool PartialOverloading=false)
isBetterOverloadCandidate - Determines whether the first overload candidate is a better candidate tha...
@ ovl_fail_final_conversion_not_exact
This conversion function template specialization candidate is not viable because the final conversion...
@ ovl_fail_enable_if
This candidate function was not viable because an enable_if attribute disabled it.
@ ovl_fail_illegal_constructor
This conversion candidate was not considered because it is an illegal instantiation of a constructor ...
@ ovl_fail_bad_final_conversion
This conversion candidate is not viable because its result type is not implicitly convertible to the ...
@ ovl_fail_module_mismatched
This candidate was not viable because it has internal linkage and is from a different module unit tha...
@ ovl_fail_too_few_arguments
@ ovl_fail_addr_not_available
This candidate was not viable because its address could not be taken.
@ ovl_fail_too_many_arguments
@ ovl_non_default_multiversion_function
This candidate was not viable because it is a non-default multiversioned function.
@ ovl_fail_constraints_not_satisfied
This candidate was not viable because its associated constraints were not satisfied.
@ ovl_fail_bad_conversion
@ ovl_fail_bad_target
(CUDA) This candidate was not viable because the callee was not accessible from the caller's target (...
@ ovl_fail_inhctor_slice
This inherited constructor is not viable because it would slice the argument.
@ ovl_fail_object_addrspace_mismatch
This constructor/conversion candidate fail due to an address space mismatch between the object being ...
@ ovl_fail_explicit
This candidate constructor or conversion function is explicit but the context doesn't permit explicit...
@ ovl_fail_trivial_conversion
This conversion candidate was not considered because it duplicates the work of a trivial or derived-t...
ImplicitConversionRank
ImplicitConversionRank - The rank of an implicit conversion kind.
@ ICR_Conversion
Conversion.
@ ICR_Writeback_Conversion
ObjC ARC writeback conversion.
@ ICR_HLSL_Dimension_Reduction
HLSL Matching Dimension Reduction.
@ ICR_HLSL_Dimension_Reduction_Conversion
HLSL Dimension reduction with conversion.
@ ICR_HLSL_Scalar_Widening
HLSL Scalar Widening.
@ ICR_C_Conversion
Conversion only allowed in the C standard (e.g. void* to char*).
@ ICR_OCL_Scalar_Widening
OpenCL Scalar Widening.
@ ICR_Complex_Real_Conversion
Complex <-> Real conversion.
@ ICR_HLSL_Scalar_Widening_Conversion
HLSL Scalar Widening with conversion.
@ ICR_HLSL_Dimension_Reduction_Promotion
HLSL Dimension reduction with promotion.
@ ICR_Promotion
Promotion.
@ ICR_Exact_Match
Exact Match.
@ ICR_C_Conversion_Extension
Conversion not allowed by the C standard, but that we accept as an extension anyway.
@ ICR_HLSL_Scalar_Widening_Promotion
HLSL Scalar Widening with promotion.
OverloadCandidateDisplayKind
@ OCD_AmbiguousCandidates
Requests that only tied-for-best candidates be shown.
@ OCD_ViableCandidates
Requests that only viable candidates be shown.
@ OCD_AllCandidates
Requests that all candidates be shown.
OverloadCandidateParamOrder
The parameter ordering that will be used for the candidate.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
llvm::MutableArrayRef< ImplicitConversionSequence > ConversionSequenceList
A list of implicit conversion sequences for the arguments of an OverloadCandidate.
OverloadCandidateRewriteKind
The kinds of rewrite we perform on overload candidates.
@ CRK_Reversed
Candidate is a rewritten candidate with a reversed order of parameters.
@ CRK_None
Candidate is not a rewritten candidate.
@ CRK_DifferentOperator
Candidate is a rewritten candidate with a different operator name.
const FunctionProtoType * T
ImplicitConversionKind
ImplicitConversionKind - The kind of implicit conversion used to convert an argument to a parameter's...
@ ICK_Complex_Conversion
Complex conversions (C99 6.3.1.6)
@ ICK_Floating_Promotion
Floating point promotions (C++ [conv.fpprom])
@ ICK_Boolean_Conversion
Boolean conversions (C++ [conv.bool])
@ ICK_Integral_Conversion
Integral conversions (C++ [conv.integral])
@ ICK_Fixed_Point_Conversion
Fixed point type conversions according to N1169.
@ ICK_Vector_Conversion
Vector conversions.
@ ICK_Block_Pointer_Conversion
Block Pointer conversions.
@ ICK_Pointer_Member
Pointer-to-member conversions (C++ [conv.mem])
@ ICK_Floating_Integral
Floating-integral conversions (C++ [conv.fpint])
@ ICK_HLSL_Array_RValue
HLSL non-decaying array rvalue cast.
@ ICK_SVE_Vector_Conversion
Arm SVE Vector conversions.
@ ICK_HLSL_Vector_Truncation
HLSL vector truncation.
@ ICK_Incompatible_Pointer_Conversion
C-only conversion between pointers with incompatible types.
@ ICK_Array_To_Pointer
Array-to-pointer conversion (C++ [conv.array])
@ ICK_RVV_Vector_Conversion
RISC-V RVV Vector conversions.
@ ICK_Complex_Promotion
Complex promotions (Clang extension)
@ ICK_Num_Conversion_Kinds
The number of conversion kinds.
@ ICK_Function_Conversion
Function pointer conversion (C++17 [conv.fctptr])
@ ICK_Vector_Splat
A vector splat from an arithmetic type.
@ ICK_Zero_Queue_Conversion
Zero constant to queue.
@ ICK_Identity
Identity conversion (no conversion)
@ ICK_Derived_To_Base
Derived-to-base (C++ [over.best.ics])
@ ICK_Lvalue_To_Rvalue
Lvalue-to-rvalue conversion (C++ [conv.lval])
@ ICK_Qualification
Qualification conversions (C++ [conv.qual])
@ ICK_Pointer_Conversion
Pointer conversions (C++ [conv.ptr])
@ ICK_TransparentUnionConversion
Transparent Union Conversions.
@ ICK_Integral_Promotion
Integral promotions (C++ [conv.prom])
@ ICK_HLSL_Matrix_Truncation
HLSL Matrix truncation.
@ ICK_Floating_Conversion
Floating point conversions (C++ [conv.double].
@ ICK_Compatible_Conversion
Conversions between compatible types in C99.
@ ICK_C_Only_Conversion
Conversions allowed in C, but not C++.
@ ICK_Writeback_Conversion
Objective-C ARC writeback conversion.
@ ICK_Zero_Event_Conversion
Zero constant to event (OpenCL1.2 6.12.10)
@ ICK_Complex_Real
Complex-real conversions (C99 6.3.1.7)
@ ICK_Function_To_Pointer
Function-to-pointer (C++ [conv.array])
LangAS
Defines the address space values used by the address space qualifier of QualType.
OverloadedOperatorKind getRewrittenOverloadedOperator(OverloadedOperatorKind Kind)
Get the other overloaded operator that the given operator can be rewritten into, if any such operator...
bool shouldEnforceArgLimit(bool PartialOverloading, FunctionDecl *Function)
NarrowingKind
NarrowingKind - The kind of narrowing conversion being performed by a standard conversion sequence ac...
@ NK_Not_Narrowing
Not a narrowing conversion.
@ NK_Constant_Narrowing
A narrowing conversion, because a constant expression got narrowed.
@ NK_Dependent_Narrowing
Cannot tell whether this is a narrowing conversion because the expression is value-dependent.
@ NK_Type_Narrowing
A narrowing conversion by virtue of the source and destination types.
@ NK_Variable_Narrowing
A narrowing conversion, because a non-constant-expression variable might have got narrowed.
ConstructorInfo getConstructorInfo(NamedDecl *ND)
ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind)
GetConversionRank - Retrieve the implicit conversion rank corresponding to the given implicit convers...
@ Other
Other implicit parameter.
Diagnostic wrappers for TextAPI types for error reporting.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Represents an ambiguous user-defined conversion sequence.
ConversionSet::const_iterator const_iterator
QualType getFromType() const
const ConversionSet & conversions() const
QualType getToType() const
ConversionSet & conversions()
SmallVector< std::pair< NamedDecl *, FunctionDecl * >, 4 > ConversionSet
void setFromType(QualType T)
const_iterator end() const
void setToType(QualType T)
void addConversion(NamedDecl *Found, FunctionDecl *D)
char Buffer[sizeof(ConversionSet)]
void copyFrom(const AmbiguousConversionSequence &)
ConversionSet::iterator iterator
const_iterator begin() const
BadConversionSequence - Records information about an invalid conversion sequence.
void setToType(QualType T)
void setFromType(QualType T)
void init(FailureKind K, Expr *From, QualType To)
void init(FailureKind K, QualType From, QualType To)
QualType getToType() const
void setFromExpr(Expr *E)
QualType getFromType() const
FunctionTemplateDecl * ConstructorTmpl
CXXConstructorDecl * Constructor
The class facilities generation and storage of conversion FixIts.
A structure used to record information about a failed template argument deduction,...
FunctionTemplateDecl * FunctionTemplate
CXXRecordDecl * ActingContext
FunctionTemplateDecl * FunctionTemplate
CallExpr::ADLCallKind IsADLCandidate
OverloadCandidateParamOrder PO
Expr::Classification ObjectClassification
CXXRecordDecl * ActingContext
OverloadCandidateParamOrder PO
FunctionTemplateDecl * FunctionTemplate
unsigned AggregateCandidateDeduction
unsigned AllowObjCConversionOnExplicit
DeferredTemplateOverloadCandidate * Next
unsigned SuppressUserConversions
unsigned PartialOverloading
unsigned AllowResultConversion
Information about operator rewrites to consider when adding operator functions to a candidate set.
bool allowsReversed(OverloadedOperatorKind Op) const
Determine whether reversing parameter order is allowed for operator Op.
bool isRewrittenOperator(const FunctionDecl *FD) const
Would use of this function result in a rewrite using a different operator?
OperatorRewriteInfo(OverloadedOperatorKind Op, SourceLocation OpLoc, bool AllowRewritten)
bool isAcceptableCandidate(const FunctionDecl *FD) const
bool isReversible() const
Determines whether this operator could be implemented by a function with reversed parameter order.
SourceLocation OpLoc
The source location of the operator.
bool AllowRewrittenCandidates
Whether we should include rewritten candidates in the overload set.
OverloadedOperatorKind OriginalOperator
The original operator as written in the source.
OverloadCandidateRewriteKind getRewriteKind(const FunctionDecl *FD, OverloadCandidateParamOrder PO)
Determine the kind of rewrite that should be performed for this candidate.
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
unsigned StrictPackMatch
Have we matched any packs on the parameter side, versus any non-packs on the argument side,...
unsigned IgnoreObjectArgument
IgnoreObjectArgument - True to indicate that the first argument's conversion, which for this function...
bool TryToFixBadConversion(unsigned Idx, Sema &S)
bool NotValidBecauseConstraintExprHasError() const
unsigned IsADLCandidate
True if the candidate was found using ADL.
unsigned IsSurrogate
IsSurrogate - True to indicate that this candidate is a surrogate for a conversion to a function poin...
QualType BuiltinParamTypes[3]
BuiltinParamTypes - Provides the parameter types of a built-in overload candidate.
bool hasAmbiguousConversion() const
hasAmbiguousConversion - Returns whether this overload candidate requires an ambiguous conversion or ...
DeclAccessPair FoundDecl
FoundDecl - The original declaration that was looked up / invented / otherwise found,...
FunctionDecl * Function
Function - The actual function that this candidate represents.
unsigned RewriteKind
Whether this is a rewritten candidate, and if so, of what kind?
ConversionFixItGenerator Fix
The FixIt hints which can be used to fix the Bad candidate.
unsigned Best
Whether this candidate is the best viable function, or tied for being the best viable function.
StandardConversionSequence FinalConversion
FinalConversion - For a conversion function (where Function is a CXXConversionDecl),...
unsigned getNumParams() const
unsigned HasFinalConversion
Whether FinalConversion has been set.
unsigned TookAddressOfOverload
unsigned FailureKind
FailureKind - The reason why this candidate is not viable.
unsigned ExplicitCallArguments
The number of call arguments that were explicitly provided, to be used while performing partial order...
ConversionSequenceList Conversions
The conversion sequences used to convert the function arguments to the function parameters.
friend class OverloadCandidateSet
DeductionFailureInfo DeductionFailure
unsigned Viable
Viable - True to indicate that this overload candidate is viable.
bool isPerfectMatch(const ASTContext &Ctx) const
CXXConversionDecl * Surrogate
Surrogate - The conversion function for which this candidate is a surrogate, but only if IsSurrogate ...
OverloadCandidateRewriteKind getRewriteKind() const
Get RewriteKind value in OverloadCandidateRewriteKind type (This function is to workaround the spurio...
UserDefinedConversionSequence - Represents a user-defined conversion sequence (C++ 13....
StandardConversionSequence Before
Represents the standard conversion that occurs before the actual user-defined conversion.
FunctionDecl * ConversionFunction
ConversionFunction - The function that will perform the user-defined conversion.
bool HadMultipleCandidates
HadMultipleCandidates - When this is true, it means that the conversion function was resolved from an...
StandardConversionSequence After
After - Represents the standard conversion that occurs after the actual user-defined conversion.
bool EllipsisConversion
EllipsisConversion - When this is true, it means user-defined conversion sequence starts with a ....
DeclAccessPair FoundConversionFunction
The declaration that we found via name lookup, which might be the same as ConversionFunction or it mi...
void dump() const
dump - Print this user-defined conversion sequence to standard error.