clang: include/clang/Sema/Overload.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CLANG_SEMA_OVERLOAD_H
15#define LLVM_CLANG_SEMA_OVERLOAD_H
16
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"
37#include
38#include
39#include
40#include
41
43
45class ASTContext;
46class Sema;
47
48
49
51
53
54
56
57
59
60
63
65
66
68
69
71
72
75
76
77
78
79
80
81
82
83
85
86
87
88
90
92
93
95
96
98 };
99
100
101
102
103
105
107
108
110
111
113
114
116
117
119
120
122
123
125
126
128
129
131
132
134
135
137
138
140
141
143
144
146
147
149
150
152
153
155
156
158
159
161
162
164
165
167
168
170
171
173
174
176
177
179
180
182
183
185
186
188
189
191
192
194
195
197
198
200
201
203
204
206
207
209 };
210
211
212
213
214
216
218
219
221
222
224
225
227
228
230
231
233
234
236
237
239
240
242
243
245
246
247
249
250
252
253
255
256
258 };
259
261
265
266
267
269
271
272
274
275
277
278
279
281
282
283
285 };
286
287
288
289
290
291
293 public:
294
295
296
298
299
300
301
302
304
305
306
307
309
310
311
313
314
315
316
317 LLVM_PREFERRED_TYPE(bool)
319
320
321
322 LLVM_PREFERRED_TYPE(bool)
324
325
326
327 LLVM_PREFERRED_TYPE(bool)
329
330
331
332 LLVM_PREFERRED_TYPE(bool)
334
335
336
337 LLVM_PREFERRED_TYPE(bool)
339
340
341
342 LLVM_PREFERRED_TYPE(bool)
344
345
346 LLVM_PREFERRED_TYPE(bool)
348
349
350 LLVM_PREFERRED_TYPE(bool)
352
353
354
355 LLVM_PREFERRED_TYPE(bool)
357
358
359
360 LLVM_PREFERRED_TYPE(bool)
362
363
364
365
367
368
369
370
372
373
374
375
376
377
380
382
384 assert(Idx < 3 && "To type index is out of range");
386 }
387
392 }
393
396 }
397
399 assert(Idx < 3 && "To type index is out of range");
401 }
402
404
408 }
409
414 bool IgnoreFloatToIntegralConversion = false) const;
417 void dump() const;
418 };
419
420
421
423
424
425
426
427
428
429
430
431
432
433
435
436
437
438
439
440
441
443
444
445
446
448
449
450
452
453
454
455
457
458
459
460
462
463 void dump() const;
464 };
465
466
470
474
477 }
478
481 }
482
485
488 }
489
492 }
493
496 }
497
498 using iterator = ConversionSet::iterator;
499
502
504
507
511 };
512
513
514
524 };
525
526
528
530
531 private:
532
533 void *FromTy;
534
535
536 void *ToTy;
537
538 public:
542 }
543
549 }
550
553
557 }
558
561 };
562
563
564
565
566
568 public:
569
570
571
572
573
574
575
584
585 private:
586 enum {
588 };
589
590
591 LLVM_PREFERRED_TYPE(Kind)
592 unsigned ConversionKind : 31;
593
594
595 LLVM_PREFERRED_TYPE(bool)
596 unsigned InitializerListOfIncompleteArray : 1;
597
598
599
600
601
602
603 QualType InitializerListContainerType;
604
605 void setKind(Kind K) {
606 destruct();
607 ConversionKind = K;
608 }
609
610 void destruct() {
612 }
613
614 public:
615 union {
616
617
619
620
621
623
624
625
627
628
629
631 };
632
634 : ConversionKind(Uninitialized),
635 InitializerListOfIncompleteArray(false) {
637 }
638
640 : ConversionKind(Other.ConversionKind),
641 InitializerListOfIncompleteArray(
642 Other.InitializerListOfIncompleteArray),
643 InitializerListContainerType(Other.InitializerListContainerType) {
644 switch (ConversionKind) {
645 case Uninitialized: break;
648 break;
653 }
654 }
655
658 destruct();
660 return *this;
661 }
662
664 destruct();
665 }
666
668 assert(isInitialized() && "querying uninitialized conversion");
669 return Kind(ConversionKind);
670 }
671
672
673
674
675
676
677
678
683 return 0;
684
687 return 1;
688
690 return 2;
691
693 return 3;
694 }
695
696 llvm_unreachable("Invalid ImplicitConversionSequence::Kind!");
697 }
698
703 }
708
709
710
711
712 bool isInitialized() const { return ConversionKind != Uninitialized; }
713
714
718 Bad.init(Failure, FromExpr, ToType);
719 }
720
721
725 Bad.init(Failure, FromType, ToType);
726 }
727
732
737 }
738
744 }
745
746
747
749 return !InitializerListContainerType.isNull();
750 }
752 InitializerListContainerType = T;
753 InitializerListOfIncompleteArray = IA;
754 }
756 return InitializerListOfIncompleteArray;
757 }
760 "not initializer list container");
761 return InitializerListContainerType;
762 }
763
764
765
768 bool NeedLValToRVal) {
773 if (NeedLValToRVal)
779 return ICS;
780 }
781
782
783
784
790
794
795 void dump() const;
796 };
797
803
804
805
806
808
809
810
811
812
813
814
815
816
817
819
820
821
823
824
825
827
828
829
830
832
833
834
836
837
838
840
841
843
844
845
847
848
849
851
852
853
854
856
857
858
860
861
862
864 };
865
866
867
870
871
873
874
875
876
878
879
880
881
883
884
885
887
888
889
891
892
893
894
896
897
899
900
902
903
904
905
906
907
908
909
911
912
913
914
916
917
918
919
920
921
922
923
925
927
928
930
931
934
935
936
938
939
940
942
943 union {
945
946
947
948
949
951 };
952
953
954
957 }
958
960
961
962
965 if (.isInitialized()) return false;
966 if (C.isAmbiguous()) return true;
967 }
968 return false;
969 }
970
976
977
978 if (!CanFix)
980
981 return CanFix;
982 }
983
990 }
994 }
995
997
998 private:
1004 };
1005
1006
1007
1009 public:
1011
1013
1014
1015
1016
1017
1018
1020
1021
1022
1023
1025
1026
1027
1028
1030
1031
1032
1034 };
1035
1036
1037
1042 bool AllowRewritten)
1045
1046
1048
1050
1052
1053
1054
1058 }
1059
1062 return true;
1063
1064
1065
1066
1072 }
1073
1074
1075
1083 return CRK;
1084 }
1085
1086
1091 }
1092
1093
1094
1096
1097
1098
1099
1102 };
1103
1104 private:
1107
1108
1109
1110 llvm::BumpPtrAllocator SlabAllocator;
1111
1114 OperatorRewriteInfo RewriteInfo;
1115
1116 constexpr static unsigned NumInlineBytes =
1118 unsigned NumInlineBytesUsed = 0;
1119 alignas(void *) char InlineSpace[NumInlineBytes];
1120
1121
1123
1124
1125
1126
1127
1128
1129
1130 template
1131 T *slabAllocate(unsigned N) {
1132
1133 static_assert(alignof(T) == alignof(void *),
1134 "Only works for pointer-aligned types.");
1135 static_assert(std::is_trivial::value ||
1136 std::is_same<ImplicitConversionSequence, T>::value,
1137 "Add destruction logic to OverloadCandidateSet::clear().");
1138
1139 unsigned NBytes = sizeof(T) * N;
1140 if (NBytes > NumInlineBytes - NumInlineBytesUsed)
1141 return SlabAllocator.Allocate<T>(N);
1142 char *FreeSpaceStart = InlineSpace + NumInlineBytesUsed;
1143 assert(uintptr_t(FreeSpaceStart) % alignof(void *) == 0 &&
1144 "Misaligned storage!");
1145
1146 NumInlineBytesUsed += NBytes;
1147 return reinterpret_cast<T *>(FreeSpaceStart);
1148 }
1149
1150 void destroyCandidates();
1151
1152 public:
1155 : Loc(Loc), Kind(CSK), RewriteInfo(RewriteInfo) {}
1159
1163
1164
1166
1167
1168
1172 Key |= static_cast<uintptr_t>(PO);
1173 return Functions.insert(Key).second;
1174 }
1175
1176
1180 }
1181
1182
1184
1186
1189
1190 size_t size() const { return Candidates.size(); }
1191 bool empty() const { return Candidates.empty(); }
1192
1193
1194
1198 slabAllocate(NumConversions);
1199
1200
1201 for (unsigned I = 0; I != NumConversions; ++I)
1203
1205 }
1206
1207
1208
1211 assert((Conversions.empty() || Conversions.size() == NumConversions) &&
1212 "preallocated conversion sequence has wrong length");
1213
1216 C.Conversions = Conversions.empty()
1218 : Conversions;
1219 return C;
1220 }
1221
1222
1225
1228 SourceLocation OpLoc = SourceLocation(),
1229 llvm::function_ref<bool(OverloadCandidate &)> Filter =
1230 [](OverloadCandidate &) { return true; });
1231
1234 ArrayRef<Expr *> Args, StringRef Opc = "",
1235 SourceLocation Loc = SourceLocation(),
1236 llvm::function_ref<bool(OverloadCandidate &)> Filter =
1237 [](OverloadCandidate &) { return true; });
1238
1240 ArrayRef<OverloadCandidate *> Cands,
1241 StringRef Opc = "",
1242 SourceLocation OpLoc = SourceLocation());
1243
1245
1249 "can't set the destination address space when not constructing an "
1250 "object");
1251 DestAS = AS;
1252 }
1253
1254 };
1255
1257 const OverloadCandidate &Cand1,
1258 const OverloadCandidate &Cand2,
1259 SourceLocation Loc,
1261
1266
1268 };
1269
1270
1271
1273 if (isa(ND))
1275
1276
1277
1280 nullptr};
1284 Info.Constructor = dyn_cast(D);
1285 return Info;
1286 }
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1301
1302}
1303
1304#endif
enum clang::sema::@1725::IndirectLocalPathEntry::EntryKind Kind
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.
QualType getConversionType() const
Returns the type that this conversion function is converting to.
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...
This represents one expression.
Represents a function declaration or definition.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
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
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()
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.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13....
void clear(CandidateSetKind CSK)
Clear out all of the candidates.
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 setDestAS(LangAS AS)
ConversionSequenceList allocateConversionSequences(unsigned NumConversions)
Allocate storage for conversion sequences for NumConversions conversions.
OverloadCandidateSet(SourceLocation Loc, CandidateSetKind CSK, OperatorRewriteInfo RewriteInfo={})
OperatorRewriteInfo getRewriteInfo() 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.
SmallVectorImpl< OverloadCandidate >::iterator iterator
void NoteCandidates(PartialDiagnosticAt PA, Sema &S, OverloadCandidateDisplayKind OCD, ArrayRef< Expr * > Args, StringRef Opc="", SourceLocation Loc=SourceLocation(), llvm::function_ref< bool(OverloadCandidate &)> Filter=[](OverloadCandidate &) { return true;})
When overload resolution fails, prints diagnostic messages containing the candidates in the candidate...
OverloadCandidateSet(const OverloadCandidateSet &)=delete
bool shouldDeferDiags(Sema &S, ArrayRef< Expr * > Args, SourceLocation OpLoc)
Whether diagnostics should be deferred.
OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best)
Find the best viable function on this overload set, if it exists.
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
SmallVector< OverloadCandidate *, 32 > CompleteCandidates(Sema &S, OverloadCandidateDisplayKind OCD, ArrayRef< Expr * > Args, SourceLocation OpLoc=SourceLocation(), llvm::function_ref< bool(OverloadCandidate &)> Filter=[](OverloadCandidate &) { return true;})
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,...
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)
QualType getToType(unsigned Idx) const
const T * castAs() const
Member-template castAs.
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.
llvm::MutableArrayRef< ImplicitConversionSequence > ConversionSequenceList
A list of implicit conversion sequences for the arguments of an OverloadCandidate.
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.
@ 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.
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.
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_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 isBetterOverloadCandidate(Sema &S, const OverloadCandidate &Cand1, const OverloadCandidate &Cand2, SourceLocation Loc, OverloadCandidateSet::CandidateSetKind Kind)
isBetterOverloadCandidate - Determines whether the first overload candidate is a better candidate tha...
const FunctionProtoType * T
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.
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
ConstructorInfo getConstructorInfo(NamedDecl *ND)
ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind)
GetConversionRank - Retrieve the implicit conversion rank corresponding to the given implicit convers...
@ Other
Other implicit parameter.
__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()
void setFromType(QualType T)
const_iterator end() const
void setToType(QualType T)
void addConversion(NamedDecl *Found, FunctionDecl *D)
SmallVector< std::pair< NamedDecl *, FunctionDecl * >, 4 > ConversionSet
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.
bool tryToFixConversion(const Expr *FromExpr, const QualType FromQTy, const QualType ToQTy, Sema &S)
If possible, generates and stores a fix for the given conversion.
A structure used to record information about a failed template argument deduction,...
Information about operator rewrites to consider when adding operator functions to a candidate set.
bool shouldAddReversed(Sema &S, ArrayRef< Expr * > OriginalArgs, FunctionDecl *FD)
Determine whether we should add a rewritten candidate for FD with reversed parameter order.
bool allowsReversed(OverloadedOperatorKind Op)
Determine whether reversing parameter order is allowed for operator Op.
OperatorRewriteInfo(OverloadedOperatorKind Op, SourceLocation OpLoc, bool AllowRewritten)
bool isRewrittenOperator(const FunctionDecl *FD)
Would use of this function result in a rewrite using a different operator?
SourceLocation OpLoc
The source location of the operator.
bool AllowRewrittenCandidates
Whether we should include rewritten candidates in the overload set.
bool isReversible()
Determines whether this operator could be implemented by a function with reversed parameter order.
OverloadedOperatorKind OriginalOperator
The original operator as written in the source.
bool isAcceptableCandidate(const FunctionDecl *FD)
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).
CallExpr::ADLCallKind IsADLCandidate
True if the candidate was found using ADL.
bool TryToFixBadConversion(unsigned Idx, Sema &S)
bool NotValidBecauseConstraintExprHasError() const
bool 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 ...
bool IgnoreObjectArgument
IgnoreObjectArgument - True to indicate that the first argument's conversion, which for this function...
DeclAccessPair FoundDecl
FoundDecl - The original declaration that was looked up / invented / otherwise found,...
FunctionDecl * Function
Function - The actual function that this candidate represents.
bool Viable
Viable - True to indicate that this overload candidate is viable.
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.
StandardConversionSequence FinalConversion
FinalConversion - For a conversion function (where Function is a CXXConversionDecl),...
unsigned getNumParams() const
unsigned ExplicitCallArguments
The number of call arguments that were explicitly provided, to be used while performing partial order...
unsigned char FailureKind
FailureKind - The reason why this candidate is not viable.
ConversionSequenceList Conversions
The conversion sequences used to convert the function arguments to the function parameters.
bool TookAddressOfOverload
DeductionFailureInfo DeductionFailure
bool Best
Whether this candidate is the best viable function, or tied for being the best viable function.
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.