clang 24.0.0git
Overload.h
Go to the documentation of this file.
1//===- Overload.h - C++ Overloading -----------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the data structures and types used in C++
10// overload resolution.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_SEMA_OVERLOAD_H
15#define LLVM_CLANG_SEMA_OVERLOAD_H
16
17#include "clang/AST/Decl.h"
19#include "clang/AST/DeclBase.h"
20#include "clang/AST/DeclCXX.h"
22#include "clang/AST/Expr.h"
23#include "clang/AST/Type.h"
24#include "clang/Basic/LLVM.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"
37#include <cassert>
38#include <cstddef>
39#include <cstdint>
40#include <utility>
41
42namespace clang {
43
44class APValue;
45class ASTContext;
46class Sema;
47
48 /// OverloadingResult - Capture the result of performing overload
49 /// resolution.
51 /// Overload resolution succeeded.
53
54 /// No viable function found.
56
57 /// Ambiguous candidates found.
59
60 /// Succeeded, but refers to a deleted function.
62 };
63
65 /// Requests that all candidates be shown. Viable candidates will
66 /// be printed first.
68
69 /// Requests that only viable candidates be shown.
71
72 /// Requests that only tied-for-best candidates be shown.
74 };
75
76 /// The parameter ordering that will be used for the candidate. This is
77 /// used to represent C++20 binary operator rewrites that reverse the order
78 /// of the arguments. If the parameter ordering is Reversed, the Args list is
79 /// reversed (but obviously the ParamDecls for the function are not).
80 ///
81 /// After forming an OverloadCandidate with reversed parameters, the list
82 /// of conversions will (as always) be indexed by argument, so will be
83 /// in reverse parameter order.
85
86 /// The kinds of rewrite we perform on overload candidates. Note that the
87 /// values here are chosen to serve as both bitflags and as a rank (lower
88 /// values are preferred by overload resolution).
90 /// Candidate is not a rewritten candidate.
91 CRK_None = 0x0,
92
93 /// Candidate is a rewritten candidate with a different operator name.
95
96 /// Candidate is a rewritten candidate with a reversed order of parameters.
98 };
99
100 /// ImplicitConversionKind - The kind of implicit conversion used to
101 /// convert an argument to a parameter's type. The enumerator values
102 /// match with the table titled 'Conversions' in [over.ics.scs] and are listed
103 /// such that better conversion kinds have smaller values.
105 /// Identity conversion (no conversion)
107
108 /// Lvalue-to-rvalue conversion (C++ [conv.lval])
110
111 /// Array-to-pointer conversion (C++ [conv.array])
113
114 /// Function-to-pointer (C++ [conv.array])
116
117 /// Function pointer conversion (C++17 [conv.fctptr])
119
120 /// Qualification conversions (C++ [conv.qual])
122
123 /// Integral promotions (C++ [conv.prom])
125
126 /// Floating point promotions (C++ [conv.fpprom])
128
129 /// Complex promotions (Clang extension)
131
132 /// Integral conversions (C++ [conv.integral])
134
135 /// Floating point conversions (C++ [conv.double]
137
138 /// Complex conversions (C99 6.3.1.6)
140
141 /// Floating-integral conversions (C++ [conv.fpint])
143
144 /// Pointer conversions (C++ [conv.ptr])
146
147 /// Pointer-to-member conversions (C++ [conv.mem])
149
150 /// Boolean conversions (C++ [conv.bool])
152
153 /// Conversions between compatible types in C99
155
156 /// Derived-to-base (C++ [over.best.ics])
158
159 /// Vector conversions
161
162 /// Arm SVE Vector conversions
164
165 /// RISC-V RVV Vector conversions
167
168 /// A vector splat from an arithmetic type
170
171 /// Complex-real conversions (C99 6.3.1.7)
173
174 /// Block Pointer conversions
176
177 /// Transparent Union Conversions
179
180 /// Objective-C ARC writeback conversion
182
183 /// Zero constant to event (OpenCL1.2 6.12.10)
185
186 /// Zero constant to queue
188
189 /// Conversions allowed in C, but not C++
191
192 /// C-only conversion between pointers with incompatible types
194
195 /// Fixed point type conversions according to N1169.
197
198 /// HLSL vector truncation.
200
201 /// HLSL Matrix truncation.
203
204 /// HLSL non-decaying array rvalue cast.
206
207 // HLSL vector splat from scalar or boolean type.
209
210 /// HLSL matrix splat from scalar or boolean type.
212
213 /// HLSL packed type conversion to and from uint
215
216 /// The number of conversion kinds
218 };
219
220 /// ImplicitConversionRank - The rank of an implicit conversion
221 /// kind. The enumerator values match with Table 9 of (C++
222 /// 13.3.3.1.1) and are listed such that better conversion ranks
223 /// have smaller values.
225 /// Exact Match
227
228 /// HLSL Scalar Widening
230
231 /// Promotion
233
234 /// HLSL Scalar Widening with promotion
236
237 /// Conversion
239
240 /// OpenCL Scalar Widening
242
243 /// HLSL Scalar Widening with conversion
245
246 /// Complex <-> Real conversion
248
249 /// ObjC ARC writeback conversion
251
252 /// Conversion only allowed in the C standard (e.g. void* to char*).
254
255 /// Conversion not allowed by the C standard, but that we accept as an
256 /// extension anyway.
258
259 /// HLSL Matching Dimension Reduction
261
262 /// HLSL Dimension reduction with promotion
264
265 /// HLSL Dimension reduction with conversion
267 };
268
269 ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind);
270
273 ImplicitConversionKind Dimension);
274
275 /// NarrowingKind - The kind of narrowing conversion being performed by a
276 /// standard conversion sequence according to C++11 [dcl.init.list]p7.
278 /// Not a narrowing conversion.
280
281 /// A narrowing conversion by virtue of the source and destination types.
283
284 /// A narrowing conversion, because a constant expression got narrowed.
286
287 /// A narrowing conversion, because a non-constant-expression variable might
288 /// have got narrowed.
290
291 /// Cannot tell whether this is a narrowing conversion because the
292 /// expression is value-dependent.
294 };
295
296 /// StandardConversionSequence - represents a standard conversion
297 /// sequence (C++ 13.3.3.1.1). A standard conversion sequence
298 /// contains between zero and three conversions. If a particular
299 /// conversion is not needed, it will be set to the identity conversion
300 /// (ICK_Identity).
302 public:
303 /// First -- The first conversion can be an lvalue-to-rvalue
304 /// conversion, array-to-pointer conversion, or
305 /// function-to-pointer conversion.
307
308 /// Second - The second conversion can be an integral promotion,
309 /// floating point promotion, integral conversion, floating point
310 /// conversion, floating-integral conversion, pointer conversion,
311 /// pointer-to-member conversion, or boolean conversion.
313
314 /// Dimension - Between the second and third conversion a vector or matrix
315 /// dimension conversion may occur. If this is not ICK_Identity this
316 /// conversion truncates the vector or matrix, or extends a scalar.
318
319 /// Third - The third conversion can be a qualification conversion
320 /// or a function conversion.
322
323 /// Whether this is the deprecated conversion of a
324 /// string literal to a pointer to non-const character data
325 /// (C++ 4.2p2).
326 LLVM_PREFERRED_TYPE(bool)
328
329 /// Whether the qualification conversion involves a change in the
330 /// Objective-C lifetime (for automatic reference counting).
331 LLVM_PREFERRED_TYPE(bool)
333
334 /// IncompatibleObjC - Whether this is an Objective-C conversion
335 /// that we should warn about (if we actually use it).
336 LLVM_PREFERRED_TYPE(bool)
337 unsigned IncompatibleObjC : 1;
338
339 /// ReferenceBinding - True when this is a reference binding
340 /// (C++ [over.ics.ref]).
341 LLVM_PREFERRED_TYPE(bool)
342 unsigned ReferenceBinding : 1;
343
344 /// DirectBinding - True when this is a reference binding that is a
345 /// direct binding (C++ [dcl.init.ref]).
346 LLVM_PREFERRED_TYPE(bool)
347 unsigned DirectBinding : 1;
348
349 /// Whether this is an lvalue reference binding (otherwise, it's
350 /// an rvalue reference binding).
351 LLVM_PREFERRED_TYPE(bool)
352 unsigned IsLvalueReference : 1;
353
354 /// Whether we're binding to a function lvalue.
355 LLVM_PREFERRED_TYPE(bool)
357
358 /// Whether we're binding to an rvalue.
359 LLVM_PREFERRED_TYPE(bool)
360 unsigned BindsToRvalue : 1;
361
362 /// Whether this binds an implicit object argument to a
363 /// non-static member function without a ref-qualifier.
364 LLVM_PREFERRED_TYPE(bool)
366
367 /// Whether this binds a reference to an object with a different
368 /// Objective-C lifetime qualifier.
369 LLVM_PREFERRED_TYPE(bool)
371
372 /// Whether the source expression was originally a single element
373 /// braced-init-list. Such a conversion is not a perfect match,
374 /// as we prefer a std::initializer_list constructor over an exact match
375 /// constructor.
376 LLVM_PREFERRED_TYPE(bool)
377 unsigned FromBracedInitList : 1;
378
379 /// FromType - The type that this conversion is converting
380 /// from. This is an opaque pointer that can be translated into a
381 /// QualType.
383
384 /// ToType - The types that this conversion is converting to in
385 /// each step. This is an opaque pointer that can be translated
386 /// into a QualType.
387 void *ToTypePtrs[3];
388
389 /// CopyConstructor - The copy constructor that is used to perform
390 /// this conversion, when the conversion is actually just the
391 /// initialization of an object via copy constructor. Such
392 /// conversions are either identity conversions or derived-to-base
393 /// conversions.
396
397 void setFromType(QualType T) { FromTypePtr = T.getAsOpaquePtr(); }
398
399 void setToType(unsigned Idx, QualType T) {
400 assert(Idx < 3 && "To type index is out of range");
401 ToTypePtrs[Idx] = T.getAsOpaquePtr();
402 }
403
405 ToTypePtrs[0] = T.getAsOpaquePtr();
406 ToTypePtrs[1] = ToTypePtrs[0];
407 ToTypePtrs[2] = ToTypePtrs[0];
408 }
409
413
414 QualType getToType(unsigned Idx) const {
415 assert(Idx < 3 && "To type index is out of range");
417 }
418
420
421 bool isIdentityConversion() const {
422 return Second == ICK_Identity && Dimension == ICK_Identity &&
424 }
425
426 /// A conversion sequence is perfect if it is an identity conversion and
427 /// the type of the source is the same as the type of the target.
428 bool isPerfect(const ASTContext &C) const {
430 return false;
431
432 // We might prefer a std::initializer_list constructor,
433 // so this sequence cannot be perfect
435 return false;
436
437 // If we are not performing a reference binding, we can skip comparing
438 // the types, which has a noticeable performance impact.
439 if (!ReferenceBinding) {
440#ifndef NDEBUG
441 auto Decay = [&](QualType T) {
442 if (T->isArrayType() || T->isFunctionType())
443 T = C.getDecayedType(T);
444
445 // A function pointer type can be resolved to a member function type,
446 // which is still an identity conversion.
447 if (auto *N = T->getAs<MemberPointerType>();
448 N && N->isMemberFunctionPointer())
449 T = C.getDecayedType(N->getPointeeType());
450
451 return T.getAtomicUnqualifiedType();
452 };
453 // The types might differ if there is an array-to-pointer conversion
454 // an function-to-pointer conversion, or lvalue-to-rvalue conversion.
455 // In some cases, this may happen even if First is not set.
456 assert(C.hasSameUnqualifiedType(Decay(getFromType()),
457 Decay(getToType(2))));
458#endif
459 return true;
460 }
461 if (!C.hasSameType(getFromType(), getToType(2)))
462 return false;
464 return false;
465 return true;
466 }
467
469 NarrowingKind getNarrowingKind(ASTContext &Context, const Expr *Converted,
470 APValue &ConstantValue,
471 QualType &ConstantType,
472 bool IgnoreFloatToIntegralConversion = false,
473 bool AllowRelaxedEval = false) const;
474 bool isPointerConversionToBool() const;
475 bool isPointerConversionToVoidPointer(ASTContext& Context) const;
476 void dump() const;
477 };
478
479 /// UserDefinedConversionSequence - Represents a user-defined
480 /// conversion sequence (C++ 13.3.3.1.2).
482 /// Represents the standard conversion that occurs before
483 /// the actual user-defined conversion.
484 ///
485 /// C++11 13.3.3.1.2p1:
486 /// If the user-defined conversion is specified by a constructor
487 /// (12.3.1), the initial standard conversion sequence converts
488 /// the source type to the type required by the argument of the
489 /// constructor. If the user-defined conversion is specified by
490 /// a conversion function (12.3.2), the initial standard
491 /// conversion sequence converts the source type to the implicit
492 /// object parameter of the conversion function.
494
495 /// EllipsisConversion - When this is true, it means user-defined
496 /// conversion sequence starts with a ... (ellipsis) conversion, instead of
497 /// a standard conversion. In this case, 'Before' field must be ignored.
498 // FIXME. I much rather put this as the first field. But there seems to be
499 // a gcc code gen. bug which causes a crash in a test. Putting it here seems
500 // to work around the crash.
502
503 /// HadMultipleCandidates - When this is true, it means that the
504 /// conversion function was resolved from an overloaded set having
505 /// size greater than 1.
507
508 /// After - Represents the standard conversion that occurs after
509 /// the actual user-defined conversion.
511
512 /// ConversionFunction - The function that will perform the
513 /// user-defined conversion. Null if the conversion is an
514 /// aggregate initialization from an initializer list.
516
517 /// The declaration that we found via name lookup, which might be
518 /// the same as \c ConversionFunction or it might be a using declaration
519 /// that refers to \c ConversionFunction.
521
522 void dump() const;
523 };
524
525 /// Represents an ambiguous user-defined conversion sequence.
529
532 char Buffer[sizeof(ConversionSet)];
533
537
541
542 void setFromType(QualType T) { FromTypePtr = T.getAsOpaquePtr(); }
543 void setToType(QualType T) { ToTypePtr = T.getAsOpaquePtr(); }
544
546 return *reinterpret_cast<ConversionSet*>(Buffer);
547 }
548
549 const ConversionSet &conversions() const {
550 return *reinterpret_cast<const ConversionSet*>(Buffer);
551 }
552
554 conversions().push_back(std::make_pair(Found, D));
555 }
556
557 using iterator = ConversionSet::iterator;
558
559 iterator begin() { return conversions().begin(); }
560 iterator end() { return conversions().end(); }
561
562 using const_iterator = ConversionSet::const_iterator;
563
564 const_iterator begin() const { return conversions().begin(); }
565 const_iterator end() const { return conversions().end(); }
566
567 void construct();
568 void destruct();
570 };
571
572 /// BadConversionSequence - Records information about an invalid
573 /// conversion sequence.
584
585 // This can be null, e.g. for implicit object arguments.
587
589
590 private:
591 // The type we're converting from (an opaque QualType).
592 void *FromTy;
593
594 // The type we're converting to (an opaque QualType).
595 void *ToTy;
596
597 public:
598 void init(FailureKind K, Expr *From, QualType To) {
599 init(K, From->getType(), To);
600 // We may have on-stack OpaqueValueExpr when building an initialization
601 // sequence, and tracking type only is sufficient for diagnostics.
602 if (!isa<OpaqueValueExpr>(From))
603 FromExpr = From;
604 }
605
606 void init(FailureKind K, QualType From, QualType To) {
607 Kind = K;
608 FromExpr = nullptr;
609 setFromType(From);
610 setToType(To);
611 }
612
615
616 void setFromType(QualType T) { FromTy = T.getAsOpaquePtr(); }
617 void setToType(QualType T) { ToTy = T.getAsOpaquePtr(); }
618 };
619
620 /// ImplicitConversionSequence - Represents an implicit conversion
621 /// sequence, which may be a standard conversion sequence
622 /// (C++ 13.3.3.1.1), user-defined conversion sequence (C++ 13.3.3.1.2),
623 /// or an ellipsis conversion sequence (C++ 13.3.3.1.3).
625 public:
626 /// Kind - The kind of implicit conversion sequence. BadConversion
627 /// specifies that there is no conversion from the source type to
628 /// the target type. AmbiguousConversion represents the unique
629 /// ambiguous conversion (C++0x [over.best.ics]p10).
630 /// StaticObjectArgumentConversion represents the conversion rules for
631 /// the synthesized first argument of calls to static member functions
632 /// ([over.best.ics.general]p8).
641
642 private:
643 enum {
645 };
646
647 /// ConversionKind - The kind of implicit conversion sequence.
648 LLVM_PREFERRED_TYPE(Kind)
649 unsigned ConversionKind : 31;
650
651 // Whether the initializer list was of an incomplete array.
652 LLVM_PREFERRED_TYPE(bool)
653 unsigned InitializerListOfIncompleteArray : 1;
654
655 /// When initializing an array or std::initializer_list from an
656 /// initializer-list, this is the array or std::initializer_list type being
657 /// initialized. The remainder of the conversion sequence, including ToType,
658 /// describe the worst conversion of an initializer to an element of the
659 /// array or std::initializer_list. (Note, 'worst' is not well defined.)
660 QualType InitializerListContainerType;
661
662 void setKind(Kind K) {
663 destruct();
664 ConversionKind = K;
665 }
666
667 void destruct() {
668 if (ConversionKind == AmbiguousConversion) Ambiguous.destruct();
669 }
670
671 public:
672 union {
673 /// When ConversionKind == StandardConversion, provides the
674 /// details of the standard conversion sequence.
676
677 /// When ConversionKind == UserDefinedConversion, provides the
678 /// details of the user-defined conversion sequence.
680
681 /// When ConversionKind == AmbiguousConversion, provides the
682 /// details of the ambiguous conversion.
684
685 /// When ConversionKind == BadConversion, provides the details
686 /// of the bad conversion.
688 };
689
691 : ConversionKind(Uninitialized),
692 InitializerListOfIncompleteArray(false) {
693 Standard.setAsIdentityConversion();
694 }
695
697 : ConversionKind(Other.ConversionKind),
698 InitializerListOfIncompleteArray(
699 Other.InitializerListOfIncompleteArray),
700 InitializerListContainerType(Other.InitializerListContainerType) {
701 switch (ConversionKind) {
702 case Uninitialized: break;
703 case StandardConversion: Standard = Other.Standard; break;
705 break;
706 case UserDefinedConversion: UserDefined = Other.UserDefined; break;
707 case AmbiguousConversion: Ambiguous.copyFrom(Other.Ambiguous); break;
708 case EllipsisConversion: break;
709 case BadConversion: Bad = Other.Bad; break;
710 }
711 }
712
715 destruct();
717 return *this;
718 }
719
721 destruct();
722 }
723
724 Kind getKind() const {
725 assert(isInitialized() && "querying uninitialized conversion");
726 return Kind(ConversionKind);
727 }
728
729 /// Return a ranking of the implicit conversion sequence
730 /// kind, where smaller ranks represent better conversion
731 /// sequences.
732 ///
733 /// In particular, this routine gives user-defined conversion
734 /// sequences and ambiguous conversion sequences the same rank,
735 /// per C++ [over.best.ics]p10.
736 unsigned getKindRank() const {
737 switch (getKind()) {
740 return 0;
741
744 return 1;
745
747 return 2;
748
749 case BadConversion:
750 return 3;
751 }
752
753 llvm_unreachable("Invalid ImplicitConversionSequence::Kind!");
754 }
755
756 bool isBad() const { return getKind() == BadConversion; }
757 bool isStandard() const { return getKind() == StandardConversion; }
760 }
761 bool isEllipsis() const { return getKind() == EllipsisConversion; }
762 bool isAmbiguous() const { return getKind() == AmbiguousConversion; }
763 bool isUserDefined() const { return getKind() == UserDefinedConversion; }
764 bool isFailure() const { return isBad() || isAmbiguous(); }
765
766 /// Determines whether this conversion sequence has been
767 /// initialized. Most operations should never need to query
768 /// uninitialized conversions and should assert as above.
769 bool isInitialized() const { return ConversionKind != Uninitialized; }
770
771 /// Sets this sequence as a bad conversion for an explicit argument.
773 Expr *FromExpr, QualType ToType) {
774 setKind(BadConversion);
775 Bad.init(Failure, FromExpr, ToType);
776 }
777
778 /// Sets this sequence as a bad conversion for an implicit argument.
780 QualType FromType, QualType ToType) {
781 setKind(BadConversion);
782 Bad.init(Failure, FromType, ToType);
783 }
784
785 void setStandard() { setKind(StandardConversion); }
787 void setEllipsis() { setKind(EllipsisConversion); }
789
791 if (ConversionKind == AmbiguousConversion) return;
792 ConversionKind = AmbiguousConversion;
793 Ambiguous.construct();
794 }
795
797 setStandard();
798 Standard.setAsIdentityConversion();
799 Standard.setFromType(T);
800 Standard.setAllToTypes(T);
801 }
802
803 /// A conversion sequence is perfect if it is an identity conversion and
804 /// the type of the source is the same as the type of the target.
805 bool isPerfect(const ASTContext &C) const {
806 return isStandard() && Standard.isPerfect(C);
807 }
808
809 // True iff this is a conversion sequence from an initializer list to an
810 // array or std::initializer.
812 return !InitializerListContainerType.isNull();
813 }
815 InitializerListContainerType = T;
816 InitializerListOfIncompleteArray = IA;
817 }
819 return InitializerListOfIncompleteArray;
820 }
823 "not initializer list container");
824 return InitializerListContainerType;
825 }
826
827 /// Form an "implicit" conversion sequence from nullptr_t to bool, for a
828 /// direct-initialization of a bool object from nullptr_t.
830 QualType DestType,
831 bool NeedLValToRVal) {
833 ICS.setStandard();
835 ICS.Standard.setFromType(SourceType);
836 if (NeedLValToRVal)
838 ICS.Standard.setToType(0, SourceType);
840 ICS.Standard.setToType(1, DestType);
841 ICS.Standard.setToType(2, DestType);
842 return ICS;
843 }
844
845 // The result of a comparison between implicit conversion
846 // sequences. Use Sema::CompareImplicitConversionSequences to
847 // actually perform the comparison.
853
855 SourceLocation CaretLoc,
856 const PartialDiagnostic &PDiag) const;
857
858 void dump() const;
859 };
860
866
867 /// This conversion candidate was not considered because it
868 /// duplicates the work of a trivial or derived-to-base
869 /// conversion.
871
872 /// This conversion candidate was not considered because it is
873 /// an illegal instantiation of a constructor temploid: it is
874 /// callable with one argument, we only have one argument, and
875 /// its first parameter type is exactly the type of the class.
876 ///
877 /// Defining such a constructor directly is illegal, and
878 /// template-argument deduction is supposed to ignore such
879 /// instantiations, but we can still get one with the right
880 /// kind of implicit instantiation.
882
883 /// This conversion candidate is not viable because its result
884 /// type is not implicitly convertible to the desired type.
886
887 /// This conversion function template specialization candidate is not
888 /// viable because the final conversion was not an exact match.
890
891 /// (CUDA) This candidate was not viable because the callee
892 /// was not accessible from the caller's target (i.e. host->device,
893 /// global->host, device->host).
895
896 /// This candidate function was not viable because an enable_if
897 /// attribute disabled it.
899
900 /// This candidate constructor or conversion function is explicit but
901 /// the context doesn't permit explicit functions.
903
904 /// This candidate was not viable because its address could not be taken.
906
907 /// This inherited constructor is not viable because it would slice the
908 /// argument.
910
911 /// This candidate was not viable because it is a non-default multiversioned
912 /// function.
914
915 /// This constructor/conversion candidate fail due to an address space
916 /// mismatch between the object being constructed and the overload
917 /// candidate.
919
920 /// This candidate was not viable because its associated constraints were
921 /// not satisfied.
923
924 /// This candidate was not viable because it has internal linkage and is
925 /// from a different module unit than the use.
927 };
928
929 /// A list of implicit conversion sequences for the arguments of an
930 /// OverloadCandidate.
933
934 /// OverloadCandidate - A single candidate in an overload set (C++ 13.3).
935 struct OverloadCandidate {
936 /// Function - The actual function that this candidate
937 /// represents. When NULL, this is a built-in candidate
938 /// (C++ [over.oper]) or a surrogate for a conversion to a
939 /// function pointer or reference (C++ [over.call.object]).
941
942 /// FoundDecl - The original declaration that was looked up /
943 /// invented / otherwise found, together with its access.
944 /// Might be a UsingShadowDecl or a FunctionTemplateDecl.
946
947 /// BuiltinParamTypes - Provides the parameter types of a built-in overload
948 /// candidate. Only valid when Function is NULL.
950
951 /// Surrogate - The conversion function for which this candidate
952 /// is a surrogate, but only if IsSurrogate is true.
954
955 /// The conversion sequences used to convert the function arguments
956 /// to the function parameters. Note that these are indexed by argument,
957 /// so may not match the parameter order of Function.
959
960 /// The FixIt hints which can be used to fix the Bad candidate.
962
963 /// Viable - True to indicate that this overload candidate is viable.
964 LLVM_PREFERRED_TYPE(bool)
966
967 /// Whether this candidate is the best viable function, or tied for being
968 /// the best viable function.
969 ///
970 /// For an ambiguous overload resolution, indicates whether this candidate
971 /// was part of the ambiguity kernel: the minimal non-empty set of viable
972 /// candidates such that all elements of the ambiguity kernel are better
973 /// than all viable candidates not in the ambiguity kernel.
974 LLVM_PREFERRED_TYPE(bool)
975 unsigned Best : 1;
976
977 /// IsSurrogate - True to indicate that this candidate is a
978 /// surrogate for a conversion to a function pointer or reference
979 /// (C++ [over.call.object]).
980 LLVM_PREFERRED_TYPE(bool)
981 unsigned IsSurrogate : 1;
982
983 /// IgnoreObjectArgument - True to indicate that the first
984 /// argument's conversion, which for this function represents the
985 /// implicit object argument, should be ignored. This will be true
986 /// when the candidate is a static member function (where the
987 /// implicit object argument is just a placeholder) or a
988 /// non-static member function when the call doesn't have an
989 /// object argument.
990 LLVM_PREFERRED_TYPE(bool)
992
993 LLVM_PREFERRED_TYPE(bool)
995
996 /// Have we matched any packs on the parameter side, versus any non-packs on
997 /// the argument side, in a context where the opposite matching is also
998 /// allowed?
999 LLVM_PREFERRED_TYPE(bool)
1000 unsigned StrictPackMatch : 1;
1001
1002 /// True if the candidate was found using ADL.
1003 LLVM_PREFERRED_TYPE(CallExpr::ADLCallKind)
1004 unsigned IsADLCandidate : 1;
1005
1006 /// Whether FinalConversion has been set.
1007 LLVM_PREFERRED_TYPE(bool)
1009
1010 /// Whether this is a rewritten candidate, and if so, of what kind?
1011 LLVM_PREFERRED_TYPE(OverloadCandidateRewriteKind)
1012 unsigned RewriteKind : 2;
1013
1014 /// FailureKind - The reason why this candidate is not viable.
1015 /// Actually an OverloadFailureKind.
1016 LLVM_PREFERRED_TYPE(OverloadFailureKind)
1017 unsigned FailureKind : 8;
1018
1019 /// The number of call arguments that were explicitly provided,
1020 /// to be used while performing partial ordering of function templates.
1022
1023 union {
1025
1026 /// FinalConversion - For a conversion function (where Function is
1027 /// a CXXConversionDecl), the standard conversion that occurs
1028 /// after the call to the overload candidate to convert the result
1029 /// of calling the conversion function to the required type.
1031 };
1032
1033 /// Get RewriteKind value in OverloadCandidateRewriteKind type (This
1034 /// function is to workaround the spurious GCC bitfield enum warning)
1038
1039 bool isReversed() const { return getRewriteKind() & CRK_Reversed; }
1040
1041 /// hasAmbiguousConversion - Returns whether this overload
1042 /// candidate requires an ambiguous conversion or not.
1044 for (auto &C : Conversions) {
1045 if (!C.isInitialized()) return false;
1046 if (C.isAmbiguous()) return true;
1047 }
1048 return false;
1049 }
1050
1051 // An overload is a perfect match if the conversion
1052 // sequences for each argument are perfect.
1053 bool isPerfectMatch(const ASTContext &Ctx) const {
1054 if (!Viable)
1055 return false;
1056 for (const auto &C : Conversions) {
1057 if (!C.isInitialized() || !C.isPerfect(Ctx))
1058 return false;
1059 }
1061 return FinalConversion.isPerfect(Ctx);
1062 return true;
1063 }
1064
1065 bool TryToFixBadConversion(unsigned Idx, Sema &S) {
1066 bool CanFix = Fix.tryToFixConversion(
1067 Conversions[Idx].Bad.FromExpr,
1068 Conversions[Idx].Bad.getFromType(),
1069 Conversions[Idx].Bad.getToType(), S);
1070
1071 // If at least one conversion fails, the candidate cannot be fixed.
1072 if (!CanFix)
1073 Fix.clear();
1074
1075 return CanFix;
1076 }
1077
1078 unsigned getNumParams() const {
1079 if (IsSurrogate) {
1080 QualType STy = Surrogate->getConversionType();
1081 while (STy->isPointerOrReferenceType())
1082 STy = STy->getPointeeType();
1083 return STy->castAs<FunctionProtoType>()->getNumParams();
1084 }
1085 if (Function)
1086 return Function->getNumParams();
1087 return ExplicitCallArguments;
1088 }
1089
1091
1092 private:
1094 OverloadCandidate()
1097 IsADLCandidate(llvm::to_underlying(CallExpr::NotADL)),
1099 };
1100
1102
1103 // intrusive linked list support for allocateDeferredCandidate
1105
1107
1108 LLVM_PREFERRED_TYPE(Kind)
1110 LLVM_PREFERRED_TYPE(bool)
1112 LLVM_PREFERRED_TYPE(bool)
1114 LLVM_PREFERRED_TYPE(bool)
1115 unsigned AllowExplicit : 1;
1116 LLVM_PREFERRED_TYPE(bool)
1118 LLVM_PREFERRED_TYPE(bool)
1120 LLVM_PREFERRED_TYPE(bool)
1122 };
1123
1132 static_assert(std::is_trivially_destructible_v<
1134
1145 static_assert(std::is_trivially_destructible_v<
1147
1156
1157 static_assert(std::is_trivially_destructible_v<
1159
1160 /// OverloadCandidateSet - A set of overload candidates, used in C++
1161 /// overload resolution (C++ 13.3).
1163 public:
1165 /// Normal lookup.
1167
1168 /// C++ [over.match.oper]:
1169 /// Lookup of operator function candidates in a call using operator
1170 /// syntax. Candidates that have no parameters of class type will be
1171 /// skipped unless there is a parameter of (reference to) enum type and
1172 /// the corresponding argument is of the same enum type.
1174
1175 /// C++ [over.match.copy]:
1176 /// Copy-initialization of an object of class type by user-defined
1177 /// conversion.
1179
1180 /// C++ [over.match.ctor], [over.match.list]
1181 /// Initialization of an object of class type by constructor,
1182 /// using either a parenthesized or braced list of arguments.
1184
1185 /// C++ [over.match.call.general]
1186 /// Resolve a call through the address of an overload set.
1188
1189 /// When doing overload resolution during code completion,
1190 /// we want to show all viable candidates, including otherwise
1191 /// deferred template candidates.
1193 };
1194
1195 /// Information about operator rewrites to consider when adding operator
1196 /// functions to a candidate set.
1201 bool AllowRewritten)
1203 AllowRewrittenCandidates(AllowRewritten) {}
1204
1205 /// The original operator as written in the source.
1207 /// The source location of the operator.
1209 /// Whether we should include rewritten candidates in the overload set.
1211
1212 /// Would use of this function result in a rewrite using a different
1213 /// operator?
1214 bool isRewrittenOperator(const FunctionDecl *FD) const {
1215 return OriginalOperator &&
1217 }
1218
1219 bool isAcceptableCandidate(const FunctionDecl *FD) const {
1220 if (!OriginalOperator)
1221 return true;
1222
1223 // For an overloaded operator, we can have candidates with a different
1224 // name in our unqualified lookup set. Make sure we only consider the
1225 // ones we're supposed to.
1228 return OO && (OO == OriginalOperator ||
1231 }
1232
1233 /// Determine the kind of rewrite that should be performed for this
1234 /// candidate.
1244 /// Determines whether this operator could be implemented by a function
1245 /// with reversed parameter order.
1251
1252 /// Determine whether reversing parameter order is allowed for operator
1253 /// Op.
1254 bool allowsReversed(OverloadedOperatorKind Op) const;
1255
1256 /// Determine whether we should add a rewritten candidate for \p FD with
1257 /// reversed parameter order.
1258 /// \param OriginalArgs are the original non reversed arguments.
1259 bool shouldAddReversed(Sema &S, ArrayRef<Expr *> OriginalArgs,
1260 FunctionDecl *FD) const;
1261 };
1262
1263 private:
1266
1267 DeferredTemplateOverloadCandidate *FirstDeferredCandidate = nullptr;
1268 unsigned DeferredCandidatesCount : 8 * sizeof(unsigned) - 2;
1269 LLVM_PREFERRED_TYPE(bool)
1270 unsigned HasDeferredTemplateConstructors : 1;
1271 LLVM_PREFERRED_TYPE(bool)
1272 unsigned ResolutionByPerfectCandidateIsDisabled : 1;
1273
1274 // Allocator for ConversionSequenceLists and deferred candidate args.
1275 // We store the first few of these
1276 // inline to avoid allocation for small sets.
1277 llvm::BumpPtrAllocator SlabAllocator;
1278
1279 SourceLocation Loc;
1280 CandidateSetKind Kind;
1281 OperatorRewriteInfo RewriteInfo;
1282
1283 /// Small storage size for ImplicitConversionSequences
1284 /// and the persisted arguments of deferred candidates.
1285 constexpr static unsigned NumInlineBytes =
1286 32 * sizeof(ImplicitConversionSequence);
1287
1288 unsigned NumInlineBytesUsed = 0;
1289 alignas(void *) char InlineSpace[NumInlineBytes];
1290
1291 // Address space of the object being constructed.
1292 LangAS DestAS = LangAS::Default;
1293
1294 /// If we have space, allocates from inline storage. Otherwise, allocates
1295 /// from the slab allocator.
1296 /// FIXME: It would probably be nice to have a SmallBumpPtrAllocator
1297 /// instead.
1298 template <typename T>
1299 T *slabAllocate(unsigned N) {
1300 // It's simpler if this doesn't need to consider alignment.
1301 static_assert(alignof(T) == alignof(void *),
1302 "Only works for pointer-aligned types.");
1303 static_assert(std::is_trivially_destructible_v<T> ||
1304 (std::is_same_v<ImplicitConversionSequence, T>),
1305 "Add destruction logic to OverloadCandidateSet::clear().");
1306
1307 unsigned NBytes = sizeof(T) * N;
1308 if (NBytes > NumInlineBytes - NumInlineBytesUsed)
1309 return SlabAllocator.Allocate<T>(N);
1310 char *FreeSpaceStart = InlineSpace + NumInlineBytesUsed;
1311 assert(uintptr_t(FreeSpaceStart) % alignof(void *) == 0 &&
1312 "Misaligned storage!");
1313
1314 NumInlineBytesUsed += NBytes;
1315 return reinterpret_cast<T *>(FreeSpaceStart);
1316 }
1317
1318 // Because the size of OverloadCandidateSet has a noticeable impact on
1319 // performance, we store each deferred template candidate in the slab
1320 // allocator such that deferred candidates are ultimately a singly-linked
1321 // intrusive linked list. This ends up being much more efficient than a
1322 // SmallVector that is empty in the common case.
1323 template <typename T> T *allocateDeferredCandidate() {
1324 T *C = slabAllocate<T>(1);
1325 if (!FirstDeferredCandidate)
1326 FirstDeferredCandidate = C;
1327 else {
1328 auto *F = FirstDeferredCandidate;
1329 while (F->Next)
1330 F = F->Next;
1331 F->Next = C;
1332 }
1333 DeferredCandidatesCount++;
1334 return C;
1335 }
1336
1337 void destroyCandidates();
1338
1339 public:
1341 OperatorRewriteInfo RewriteInfo = {})
1342 : FirstDeferredCandidate(nullptr), DeferredCandidatesCount(0),
1343 HasDeferredTemplateConstructors(false),
1344 ResolutionByPerfectCandidateIsDisabled(false), Loc(Loc), Kind(CSK),
1345 RewriteInfo(RewriteInfo) {}
1348 ~OverloadCandidateSet() { destroyCandidates(); }
1349
1350 SourceLocation getLocation() const { return Loc; }
1351 CandidateSetKind getKind() const { return Kind; }
1352 OperatorRewriteInfo getRewriteInfo() const { return RewriteInfo; }
1353
1354 /// Whether diagnostics should be deferred.
1355 bool shouldDeferDiags(Sema &S, ArrayRef<Expr *> Args, SourceLocation OpLoc);
1356
1357 // Whether the resolution of template candidates should be deferred
1358 bool shouldDeferTemplateArgumentDeduction(const Sema &S) const;
1359
1360 /// Determine when this overload candidate will be new to the
1361 /// overload set.
1364 uintptr_t Key = reinterpret_cast<uintptr_t>(F->getCanonicalDecl());
1365 Key |= static_cast<uintptr_t>(PO);
1366 return Functions.insert(Key).second;
1367 }
1368
1369 /// Exclude a function from being considered by overload resolution.
1374
1375 /// Clear out all of the candidates.
1376 void clear(CandidateSetKind CSK);
1377
1380
1381 iterator begin() { return Candidates.begin(); }
1382 iterator end() { return Candidates.end(); }
1383
1384 const_iterator begin() const { return Candidates.begin(); }
1385 const_iterator end() const { return Candidates.end(); }
1386
1387 size_t size() const { return Candidates.size() + DeferredCandidatesCount; }
1388
1389 size_t nonDeferredCandidatesCount() const { return Candidates.size(); }
1390
1391 bool empty() const {
1392 return Candidates.empty() && DeferredCandidatesCount == 0;
1393 }
1394
1395 /// Allocate storage for conversion sequences for NumConversions
1396 /// conversions.
1398 allocateConversionSequences(unsigned NumConversions) {
1399 ImplicitConversionSequence *Conversions =
1400 slabAllocate<ImplicitConversionSequence>(NumConversions);
1401
1402 // Construct the new objects.
1403 for (unsigned I = 0; I != NumConversions; ++I)
1404 new (&Conversions[I]) ImplicitConversionSequence();
1405
1406 return ConversionSequenceList(Conversions, NumConversions);
1407 }
1408
1409 /// Provide storage for any Expr* arg that must be preserved
1410 /// until deferred template candidates are deduced.
1411 /// Typically this should be used for reversed operator arguments
1412 /// and any time the argument array is transformed while adding
1413 /// a template candidate.
1415 Expr **Exprs = slabAllocate<Expr *>(N);
1416 return llvm::MutableArrayRef<Expr *>(Exprs, N);
1417 }
1418
1419 template <typename... T>
1422 getPersistentArgsArray(sizeof...(Exprs));
1423 llvm::copy(std::initializer_list<Expr *>{Exprs...}, Arr.data());
1424 return Arr;
1425 }
1426
1427 /// Add a new candidate with NumConversions conversion sequence slots
1428 /// to the overload set.
1429 OverloadCandidate &addCandidate(unsigned NumConversions = 0,
1430 ConversionSequenceList Conversions = {}) {
1431 assert((Conversions.empty() || Conversions.size() == NumConversions) &&
1432 "preallocated conversion sequence has wrong length");
1433
1434 Candidates.push_back(OverloadCandidate());
1435 OverloadCandidate &C = Candidates.back();
1436 C.Conversions = Conversions.empty()
1437 ? allocateConversionSequences(NumConversions)
1438 : Conversions;
1439 return C;
1440 }
1441
1442 void AddDeferredTemplateCandidate(
1443 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
1444 ArrayRef<Expr *> Args, bool SuppressUserConversions,
1445 bool PartialOverloading, bool AllowExplicit,
1446 CallExpr::ADLCallKind IsADLCandidate, OverloadCandidateParamOrder PO,
1447 bool AggregateCandidateDeduction);
1448
1449 void AddDeferredMethodTemplateCandidate(
1450 FunctionTemplateDecl *MethodTmpl, DeclAccessPair FoundDecl,
1451 CXXRecordDecl *ActingContext, QualType ObjectType,
1452 Expr::Classification ObjectClassification, ArrayRef<Expr *> Args,
1453 bool SuppressUserConversions, bool PartialOverloading,
1454 OverloadCandidateParamOrder PO);
1455
1456 void AddDeferredConversionTemplateCandidate(
1457 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
1458 CXXRecordDecl *ActingContext, Expr *From, QualType ToType,
1459 bool AllowObjCConversionOnExplicit, bool AllowExplicit,
1460 bool AllowResultConversion);
1461
1462 void InjectNonDeducedTemplateCandidates(Sema &S);
1463
1465 ResolutionByPerfectCandidateIsDisabled = true;
1466 }
1467
1468 /// Find the best viable function on this overload set, if it exists.
1469 OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc,
1471
1472 SmallVector<OverloadCandidate *, 32> CompleteCandidates(
1475 llvm::function_ref<bool(OverloadCandidate &)> Filter =
1476 [](OverloadCandidate &) { return true; });
1477
1478 void NoteCandidates(
1479 PartialDiagnosticAt PA, Sema &S, OverloadCandidateDisplayKind OCD,
1480 ArrayRef<Expr *> Args, StringRef Opc = "",
1481 SourceLocation Loc = SourceLocation(),
1482 llvm::function_ref<bool(OverloadCandidate &)> Filter =
1483 [](OverloadCandidate &) { return true; });
1484
1485 void NoteCandidates(Sema &S, ArrayRef<Expr *> Args,
1486 ArrayRef<OverloadCandidate *> Cands,
1487 StringRef Opc = "",
1488 SourceLocation OpLoc = SourceLocation());
1489
1490 LangAS getDestAS() { return DestAS; }
1491
1493 assert((Kind == CSK_InitByConstructor ||
1495 "can't set the destination address space when not constructing an "
1496 "object");
1497 DestAS = AS;
1498 }
1499
1500 private:
1501 OverloadingResult ResultForBestCandidate(const iterator &Best);
1502 void CudaExcludeWrongSideCandidates(
1505 BestViableFunctionImpl(Sema &S, SourceLocation Loc,
1507 };
1508
1509 bool isBetterOverloadCandidate(Sema &S, const OverloadCandidate &Cand1,
1510 const OverloadCandidate &Cand2,
1511 SourceLocation Loc,
1513 bool PartialOverloading = false);
1514
1522
1523 // FIXME: Add an AddOverloadCandidate / AddTemplateOverloadCandidate overload
1524 // that takes one of these.
1526 if (isa<UsingDecl>(ND))
1527 return ConstructorInfo{};
1528
1529 // For constructors, the access check is performed against the underlying
1530 // declaration, not the found declaration.
1531 auto *D = ND->getUnderlyingDecl();
1532 ConstructorInfo Info = {DeclAccessPair::make(ND, D->getAccess()), nullptr,
1533 nullptr};
1534 Info.ConstructorTmpl = dyn_cast<FunctionTemplateDecl>(D);
1535 if (Info.ConstructorTmpl)
1537 Info.Constructor = dyn_cast<CXXConstructorDecl>(D);
1538 return Info;
1539 }
1540
1541 // Returns false if signature help is relevant despite number of arguments
1542 // exceeding parameters. Specifically, it returns false when
1543 // PartialOverloading is true and one of the following:
1544 // * Function is variadic
1545 // * Function is template variadic
1546 // * Function is an instantiation of template variadic function
1547 // The last case may seem strange. The idea is that if we added one more
1548 // argument, we'd end up with a function similar to Function. Since, in the
1549 // context of signature help and/or code completion, we do not know what the
1550 // type of the next argument (that the user is typing) will be, this is as
1551 // good candidate as we can get, despite the fact that it takes one less
1552 // parameter.
1553 bool shouldEnforceArgLimit(bool PartialOverloading, FunctionDecl *Function);
1554} // namespace clang
1555
1556#endif // LLVM_CLANG_SEMA_OVERLOAD_H
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],...
Definition APValue.h:158
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:245
Represents a C++ constructor within a class.
Definition DeclCXX.h:2645
Represents a C++ conversion function within a class.
Definition DeclCXX.h:2994
Represents a C++ struct/union/class.
Definition DeclCXX.h:258
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition Expr.h:3012
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.
Definition DeclBase.h:86
AccessSpecifier getAccess() const
Definition DeclBase.h:516
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition DeclBase.h:996
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().
Definition Expr.h:341
This represents one expression.
Definition Expr.h:114
QualType getType() const
Definition Expr.h:146
Represents a function declaration or definition.
Definition Decl.h:2082
Represents a prototype with parameter type info, e.g.
Definition TypeBase.h:5548
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...
Definition Overload.h:624
void dump() const
dump - Print this implicit conversion sequence to standard error.
ImplicitConversionSequence & operator=(const ImplicitConversionSequence &Other)
Definition Overload.h:714
Kind
Kind - The kind of implicit conversion sequence.
Definition Overload.h:633
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...
Definition Overload.h:805
StandardConversionSequence Standard
When ConversionKind == StandardConversion, provides the details of the standard conversion sequence.
Definition Overload.h:675
void setBad(BadConversionSequence::FailureKind Failure, Expr *FromExpr, QualType ToType)
Sets this sequence as a bad conversion for an explicit argument.
Definition Overload.h:772
UserDefinedConversionSequence UserDefined
When ConversionKind == UserDefinedConversion, provides the details of the user-defined conversion seq...
Definition Overload.h:679
ImplicitConversionSequence(const ImplicitConversionSequence &Other)
Definition Overload.h:696
bool isInitialized() const
Determines whether this conversion sequence has been initialized.
Definition Overload.h:769
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 ...
Definition Overload.h:829
AmbiguousConversionSequence Ambiguous
When ConversionKind == AmbiguousConversion, provides the details of the ambiguous conversion.
Definition Overload.h:683
void setInitializerListContainerType(QualType T, bool IA)
Definition Overload.h:814
bool hasInitializerListContainerType() const
Definition Overload.h:811
unsigned getKindRank() const
Return a ranking of the implicit conversion sequence kind, where smaller ranks represent better conve...
Definition Overload.h:736
bool isInitializerListOfIncompleteArray() const
Definition Overload.h:818
BadConversionSequence Bad
When ConversionKind == BadConversion, provides the details of the bad conversion.
Definition Overload.h:687
QualType getInitializerListContainerType() const
Definition Overload.h:821
void setAsIdentityConversion(QualType T)
Definition Overload.h:796
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.
Definition Overload.h:779
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition TypeBase.h:3751
bool isMemberFunctionPointer() const
Returns true if the member type (i.e.
Definition TypeBase.h:3773
This represents a decl that may have a name.
Definition Decl.h:276
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
Definition Decl.h:489
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition Decl.h:342
const_iterator end() const
Definition Overload.h:1385
llvm::MutableArrayRef< Expr * > getPersistentArgsArray(T *...Exprs)
Definition Overload.h:1420
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.
Definition Overload.h:1362
void DisableResolutionByPerfectCandidate()
Definition Overload.h:1464
void setDestAS(LangAS AS)
Definition Overload.h:1492
ConversionSequenceList allocateConversionSequences(unsigned NumConversions)
Allocate storage for conversion sequences for NumConversions conversions.
Definition Overload.h:1398
OverloadCandidateSet(SourceLocation Loc, CandidateSetKind CSK, OperatorRewriteInfo RewriteInfo={})
Definition Overload.h:1340
llvm::MutableArrayRef< Expr * > getPersistentArgsArray(unsigned N)
Provide storage for any Expr* arg that must be preserved until deferred template candidates are deduc...
Definition Overload.h:1414
OperatorRewriteInfo getRewriteInfo() const
Definition Overload.h:1352
@ CSK_AddressOfOverloadSet
C++ [over.match.call.general] Resolve a call through the address of an overload set.
Definition Overload.h:1187
@ CSK_InitByConstructor
C++ [over.match.ctor], [over.match.list] Initialization of an object of class type by constructor,...
Definition Overload.h:1183
@ CSK_InitByUserDefinedConversion
C++ [over.match.copy]: Copy-initialization of an object of class type by user-defined conversion.
Definition Overload.h:1178
@ CSK_Normal
Normal lookup.
Definition Overload.h:1166
@ CSK_Operator
C++ [over.match.oper]: Lookup of operator function candidates in a call using operator syntax.
Definition Overload.h:1173
@ CSK_CodeCompletion
When doing overload resolution during code completion, we want to show all viable candidates,...
Definition Overload.h:1192
SmallVectorImpl< OverloadCandidate >::iterator iterator
Definition Overload.h:1378
OverloadCandidateSet(const OverloadCandidateSet &)=delete
const_iterator begin() const
Definition Overload.h:1384
void exclude(Decl *F)
Exclude a function from being considered by overload resolution.
Definition Overload.h:1370
SourceLocation getLocation() const
Definition Overload.h:1350
OverloadCandidate & addCandidate(unsigned NumConversions=0, ConversionSequenceList Conversions={})
Add a new candidate with NumConversions conversion sequence slots to the overload set.
Definition Overload.h:1429
CandidateSetKind getKind() const
Definition Overload.h:1351
size_t nonDeferredCandidatesCount() const
Definition Overload.h:1389
SmallVectorImpl< OverloadCandidate >::const_iterator const_iterator
Definition Overload.h:1379
A (possibly-)qualified type.
Definition TypeBase.h:938
static QualType getFromOpaquePtr(const void *Ptr)
Definition TypeBase.h:987
Sema - This implements semantic analysis and AST building for C.
Definition Sema.h:862
Encodes a location in the source.
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3....
Definition Overload.h:301
void dump() const
dump - Print this standard conversion sequence to standard error.
DeclAccessPair FoundCopyConstructor
Definition Overload.h:395
void * FromTypePtr
FromType - The type that this conversion is converting from.
Definition Overload.h:382
unsigned BindsToRvalue
Whether we're binding to an rvalue.
Definition Overload.h:360
ImplicitConversionKind Second
Second - The second conversion can be an integral promotion, floating point promotion,...
Definition Overload.h:312
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...
Definition Overload.h:428
ImplicitConversionKind First
First – The first conversion can be an lvalue-to-rvalue conversion, array-to-pointer conversion,...
Definition Overload.h:306
unsigned BindsImplicitObjectArgumentWithoutRefQualifier
Whether this binds an implicit object argument to a non-static member function without a ref-qualifie...
Definition Overload.h:365
unsigned ReferenceBinding
ReferenceBinding - True when this is a reference binding (C++ [over.ics.ref]).
Definition Overload.h:342
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...
Definition Overload.h:327
CXXConstructorDecl * CopyConstructor
CopyConstructor - The copy constructor that is used to perform this conversion, when the conversion i...
Definition Overload.h:394
unsigned IncompatibleObjC
IncompatibleObjC - Whether this is an Objective-C conversion that we should warn about (if we actuall...
Definition Overload.h:337
unsigned ObjCLifetimeConversionBinding
Whether this binds a reference to an object with a different Objective-C lifetime qualifier.
Definition Overload.h:370
ImplicitConversionKind Third
Third - The third conversion can be a qualification conversion or a function conversion.
Definition Overload.h:321
NarrowingKind getNarrowingKind(ASTContext &Context, const Expr *Converted, APValue &ConstantValue, QualType &ConstantType, bool IgnoreFloatToIntegralConversion=false, bool AllowRelaxedEval=false) const
Check if this standard conversion sequence represents a narrowing conversion, according to C++11 [dcl...
unsigned QualificationIncludesObjCLifetime
Whether the qualification conversion involves a change in the Objective-C lifetime (for automatic ref...
Definition Overload.h:332
void setToType(unsigned Idx, QualType T)
Definition Overload.h:399
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.
Definition Overload.h:387
unsigned IsLvalueReference
Whether this is an lvalue reference binding (otherwise, it's an rvalue reference binding).
Definition Overload.h:352
ImplicitConversionKind Dimension
Dimension - Between the second and third conversion a vector or matrix dimension conversion may occur...
Definition Overload.h:317
unsigned BindsToFunctionLvalue
Whether we're binding to a function lvalue.
Definition Overload.h:356
unsigned DirectBinding
DirectBinding - True when this is a reference binding that is a direct binding (C++ [dcl....
Definition Overload.h:347
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...
unsigned FromBracedInitList
Whether the source expression was originally a single element braced-init-list.
Definition Overload.h:377
QualType getToType(unsigned Idx) const
Definition Overload.h:414
const T * castAs() const
Member-template castAs<specific type>.
Definition TypeBase.h:9498
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
Definition Type.cpp:885
bool isPointerOrReferenceType() const
Definition TypeBase.h:8819
Top level wrappers for InstallAPI frontend operations.
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)
Definition Address.h:330
OverloadingResult
OverloadingResult - Capture the result of performing overload resolution.
Definition Overload.h:50
@ OR_Deleted
Succeeded, but refers to a deleted function.
Definition Overload.h:61
@ OR_Success
Overload resolution succeeded.
Definition Overload.h:52
@ OR_Ambiguous
Ambiguous candidates found.
Definition Overload.h:58
@ OR_No_Viable_Function
No viable function found.
Definition Overload.h:55
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...
OverloadFailureKind
Definition Overload.h:861
@ ovl_fail_final_conversion_not_exact
This conversion function template specialization candidate is not viable because the final conversion...
Definition Overload.h:889
@ ovl_fail_enable_if
This candidate function was not viable because an enable_if attribute disabled it.
Definition Overload.h:898
@ ovl_fail_illegal_constructor
This conversion candidate was not considered because it is an illegal instantiation of a constructor ...
Definition Overload.h:881
@ ovl_fail_bad_final_conversion
This conversion candidate is not viable because its result type is not implicitly convertible to the ...
Definition Overload.h:885
@ ovl_fail_module_mismatched
This candidate was not viable because it has internal linkage and is from a different module unit tha...
Definition Overload.h:926
@ ovl_fail_too_few_arguments
Definition Overload.h:863
@ ovl_fail_addr_not_available
This candidate was not viable because its address could not be taken.
Definition Overload.h:905
@ ovl_fail_too_many_arguments
Definition Overload.h:862
@ ovl_non_default_multiversion_function
This candidate was not viable because it is a non-default multiversioned function.
Definition Overload.h:913
@ ovl_fail_constraints_not_satisfied
This candidate was not viable because its associated constraints were not satisfied.
Definition Overload.h:922
@ ovl_fail_bad_conversion
Definition Overload.h:864
@ ovl_fail_bad_target
(CUDA) This candidate was not viable because the callee was not accessible from the caller's target (...
Definition Overload.h:894
@ ovl_fail_bad_deduction
Definition Overload.h:865
@ ovl_fail_inhctor_slice
This inherited constructor is not viable because it would slice the argument.
Definition Overload.h:909
@ ovl_fail_object_addrspace_mismatch
This constructor/conversion candidate fail due to an address space mismatch between the object being ...
Definition Overload.h:918
@ ovl_fail_explicit
This candidate constructor or conversion function is explicit but the context doesn't permit explicit...
Definition Overload.h:902
@ ovl_fail_trivial_conversion
This conversion candidate was not considered because it duplicates the work of a trivial or derived-t...
Definition Overload.h:870
ImplicitConversionRank
ImplicitConversionRank - The rank of an implicit conversion kind.
Definition Overload.h:224
@ ICR_Conversion
Conversion.
Definition Overload.h:238
@ ICR_Writeback_Conversion
ObjC ARC writeback conversion.
Definition Overload.h:250
@ ICR_HLSL_Dimension_Reduction
HLSL Matching Dimension Reduction.
Definition Overload.h:260
@ ICR_HLSL_Dimension_Reduction_Conversion
HLSL Dimension reduction with conversion.
Definition Overload.h:266
@ ICR_HLSL_Scalar_Widening
HLSL Scalar Widening.
Definition Overload.h:229
@ ICR_C_Conversion
Conversion only allowed in the C standard (e.g. void* to char*).
Definition Overload.h:253
@ ICR_OCL_Scalar_Widening
OpenCL Scalar Widening.
Definition Overload.h:241
@ ICR_Complex_Real_Conversion
Complex <-> Real conversion.
Definition Overload.h:247
@ ICR_HLSL_Scalar_Widening_Conversion
HLSL Scalar Widening with conversion.
Definition Overload.h:244
@ ICR_HLSL_Dimension_Reduction_Promotion
HLSL Dimension reduction with promotion.
Definition Overload.h:263
@ ICR_Promotion
Promotion.
Definition Overload.h:232
@ ICR_Exact_Match
Exact Match.
Definition Overload.h:226
@ ICR_C_Conversion_Extension
Conversion not allowed by the C standard, but that we accept as an extension anyway.
Definition Overload.h:257
@ ICR_HLSL_Scalar_Widening_Promotion
HLSL Scalar Widening with promotion.
Definition Overload.h:235
OverloadCandidateDisplayKind
Definition Overload.h:64
@ OCD_AmbiguousCandidates
Requests that only tied-for-best candidates be shown.
Definition Overload.h:73
@ OCD_ViableCandidates
Requests that only viable candidates be shown.
Definition Overload.h:70
@ OCD_AllCandidates
Requests that all candidates be shown.
Definition Overload.h:67
OverloadCandidateParamOrder
The parameter ordering that will be used for the candidate.
Definition Overload.h:84
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.
Definition Overload.h:931
OverloadCandidateRewriteKind
The kinds of rewrite we perform on overload candidates.
Definition Overload.h:89
@ CRK_Reversed
Candidate is a rewritten candidate with a reversed order of parameters.
Definition Overload.h:97
@ CRK_None
Candidate is not a rewritten candidate.
Definition Overload.h:91
@ CRK_DifferentOperator
Candidate is a rewritten candidate with a different operator name.
Definition Overload.h:94
const FunctionProtoType * T
ImplicitConversionKind
ImplicitConversionKind - The kind of implicit conversion used to convert an argument to a parameter's...
Definition Overload.h:104
@ ICK_Complex_Conversion
Complex conversions (C99 6.3.1.6)
Definition Overload.h:139
@ ICK_Floating_Promotion
Floating point promotions (C++ [conv.fpprom])
Definition Overload.h:127
@ ICK_Boolean_Conversion
Boolean conversions (C++ [conv.bool])
Definition Overload.h:151
@ ICK_Integral_Conversion
Integral conversions (C++ [conv.integral])
Definition Overload.h:133
@ ICK_HLSL_Vector_Splat
Definition Overload.h:208
@ ICK_Fixed_Point_Conversion
Fixed point type conversions according to N1169.
Definition Overload.h:196
@ ICK_Vector_Conversion
Vector conversions.
Definition Overload.h:160
@ ICK_Block_Pointer_Conversion
Block Pointer conversions.
Definition Overload.h:175
@ ICK_Pointer_Member
Pointer-to-member conversions (C++ [conv.mem])
Definition Overload.h:148
@ ICK_Floating_Integral
Floating-integral conversions (C++ [conv.fpint])
Definition Overload.h:142
@ ICK_HLSL_Array_RValue
HLSL non-decaying array rvalue cast.
Definition Overload.h:205
@ ICK_SVE_Vector_Conversion
Arm SVE Vector conversions.
Definition Overload.h:163
@ ICK_HLSL_Vector_Truncation
HLSL vector truncation.
Definition Overload.h:199
@ ICK_Incompatible_Pointer_Conversion
C-only conversion between pointers with incompatible types.
Definition Overload.h:193
@ ICK_Array_To_Pointer
Array-to-pointer conversion (C++ [conv.array])
Definition Overload.h:112
@ ICK_RVV_Vector_Conversion
RISC-V RVV Vector conversions.
Definition Overload.h:166
@ ICK_Complex_Promotion
Complex promotions (Clang extension)
Definition Overload.h:130
@ ICK_Num_Conversion_Kinds
The number of conversion kinds.
Definition Overload.h:217
@ ICK_HLSL_Packed_Type_Conversion
HLSL packed type conversion to and from uint.
Definition Overload.h:214
@ ICK_HLSL_Matrix_Splat
HLSL matrix splat from scalar or boolean type.
Definition Overload.h:211
@ ICK_Function_Conversion
Function pointer conversion (C++17 [conv.fctptr])
Definition Overload.h:118
@ ICK_Vector_Splat
A vector splat from an arithmetic type.
Definition Overload.h:169
@ ICK_Zero_Queue_Conversion
Zero constant to queue.
Definition Overload.h:187
@ ICK_Identity
Identity conversion (no conversion)
Definition Overload.h:106
@ ICK_Derived_To_Base
Derived-to-base (C++ [over.best.ics])
Definition Overload.h:157
@ ICK_Lvalue_To_Rvalue
Lvalue-to-rvalue conversion (C++ [conv.lval])
Definition Overload.h:109
@ ICK_Qualification
Qualification conversions (C++ [conv.qual])
Definition Overload.h:121
@ ICK_Pointer_Conversion
Pointer conversions (C++ [conv.ptr])
Definition Overload.h:145
@ ICK_TransparentUnionConversion
Transparent Union Conversions.
Definition Overload.h:178
@ ICK_Integral_Promotion
Integral promotions (C++ [conv.prom])
Definition Overload.h:124
@ ICK_HLSL_Matrix_Truncation
HLSL Matrix truncation.
Definition Overload.h:202
@ ICK_Floating_Conversion
Floating point conversions (C++ [conv.double].
Definition Overload.h:136
@ ICK_Compatible_Conversion
Conversions between compatible types in C99.
Definition Overload.h:154
@ ICK_C_Only_Conversion
Conversions allowed in C, but not C++.
Definition Overload.h:190
@ ICK_Writeback_Conversion
Objective-C ARC writeback conversion.
Definition Overload.h:181
@ ICK_Zero_Event_Conversion
Zero constant to event (OpenCL1.2 6.12.10)
Definition Overload.h:184
@ ICK_Complex_Real
Complex-real conversions (C99 6.3.1.7)
Definition Overload.h:172
@ ICK_Function_To_Pointer
Function-to-pointer (C++ [conv.array])
Definition Overload.h:115
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...
Definition Overload.h:277
@ NK_Not_Narrowing
Not a narrowing conversion.
Definition Overload.h:279
@ NK_Constant_Narrowing
A narrowing conversion, because a constant expression got narrowed.
Definition Overload.h:285
@ NK_Dependent_Narrowing
Cannot tell whether this is a narrowing conversion because the expression is value-dependent.
Definition Overload.h:293
@ NK_Type_Narrowing
A narrowing conversion by virtue of the source and destination types.
Definition Overload.h:282
@ NK_Variable_Narrowing
A narrowing conversion, because a non-constant-expression variable might have got narrowed.
Definition Overload.h:289
ConstructorInfo getConstructorInfo(NamedDecl *ND)
Definition Overload.h:1525
ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind)
GetConversionRank - Retrieve the implicit conversion rank corresponding to the given implicit convers...
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
#define false
Definition stdbool.h:26
Represents an ambiguous user-defined conversion sequence.
Definition Overload.h:526
ConversionSet::const_iterator const_iterator
Definition Overload.h:562
const ConversionSet & conversions() const
Definition Overload.h:549
SmallVector< std::pair< NamedDecl *, FunctionDecl * >, 4 > ConversionSet
Definition Overload.h:527
const_iterator end() const
Definition Overload.h:565
void addConversion(NamedDecl *Found, FunctionDecl *D)
Definition Overload.h:553
char Buffer[sizeof(ConversionSet)]
Definition Overload.h:532
void copyFrom(const AmbiguousConversionSequence &)
ConversionSet::iterator iterator
Definition Overload.h:557
const_iterator begin() const
Definition Overload.h:564
BadConversionSequence - Records information about an invalid conversion sequence.
Definition Overload.h:574
void setToType(QualType T)
Definition Overload.h:617
void setFromType(QualType T)
Definition Overload.h:616
void init(FailureKind K, Expr *From, QualType To)
Definition Overload.h:598
void init(FailureKind K, QualType From, QualType To)
Definition Overload.h:606
QualType getToType() const
Definition Overload.h:614
QualType getFromType() const
Definition Overload.h:613
FunctionTemplateDecl * ConstructorTmpl
Definition Overload.h:1518
CXXConstructorDecl * Constructor
Definition Overload.h:1517
DeclAccessPair FoundDecl
Definition Overload.h:1516
The class facilities generation and storage of conversion FixIts.
A structure used to record information about a failed template argument deduction,...
DeferredTemplateOverloadCandidate * Next
Definition Overload.h:1104
Information about operator rewrites to consider when adding operator functions to a candidate set.
Definition Overload.h:1197
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?
Definition Overload.h:1214
OperatorRewriteInfo(OverloadedOperatorKind Op, SourceLocation OpLoc, bool AllowRewritten)
Definition Overload.h:1200
bool isAcceptableCandidate(const FunctionDecl *FD) const
Definition Overload.h:1219
bool isReversible() const
Determines whether this operator could be implemented by a function with reversed parameter order.
Definition Overload.h:1246
SourceLocation OpLoc
The source location of the operator.
Definition Overload.h:1208
bool AllowRewrittenCandidates
Whether we should include rewritten candidates in the overload set.
Definition Overload.h:1210
OverloadedOperatorKind OriginalOperator
The original operator as written in the source.
Definition Overload.h:1206
OverloadCandidateRewriteKind getRewriteKind(const FunctionDecl *FD, OverloadCandidateParamOrder PO)
Determine the kind of rewrite that should be performed for this candidate.
Definition Overload.h:1236
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
Definition Overload.h:935
unsigned StrictPackMatch
Have we matched any packs on the parameter side, versus any non-packs on the argument side,...
Definition Overload.h:1000
unsigned IgnoreObjectArgument
IgnoreObjectArgument - True to indicate that the first argument's conversion, which for this function...
Definition Overload.h:991
bool TryToFixBadConversion(unsigned Idx, Sema &S)
Definition Overload.h:1065
bool NotValidBecauseConstraintExprHasError() const
bool isReversed() const
Definition Overload.h:1039
unsigned IsADLCandidate
True if the candidate was found using ADL.
Definition Overload.h:1004
unsigned IsSurrogate
IsSurrogate - True to indicate that this candidate is a surrogate for a conversion to a function poin...
Definition Overload.h:981
QualType BuiltinParamTypes[3]
BuiltinParamTypes - Provides the parameter types of a built-in overload candidate.
Definition Overload.h:949
bool hasAmbiguousConversion() const
hasAmbiguousConversion - Returns whether this overload candidate requires an ambiguous conversion or ...
Definition Overload.h:1043
DeclAccessPair FoundDecl
FoundDecl - The original declaration that was looked up / invented / otherwise found,...
Definition Overload.h:945
FunctionDecl * Function
Function - The actual function that this candidate represents.
Definition Overload.h:940
unsigned RewriteKind
Whether this is a rewritten candidate, and if so, of what kind?
Definition Overload.h:1012
ConversionFixItGenerator Fix
The FixIt hints which can be used to fix the Bad candidate.
Definition Overload.h:961
unsigned Best
Whether this candidate is the best viable function, or tied for being the best viable function.
Definition Overload.h:975
StandardConversionSequence FinalConversion
FinalConversion - For a conversion function (where Function is a CXXConversionDecl),...
Definition Overload.h:1030
unsigned getNumParams() const
Definition Overload.h:1078
unsigned HasFinalConversion
Whether FinalConversion has been set.
Definition Overload.h:1008
unsigned TookAddressOfOverload
Definition Overload.h:994
unsigned FailureKind
FailureKind - The reason why this candidate is not viable.
Definition Overload.h:1017
unsigned ExplicitCallArguments
The number of call arguments that were explicitly provided, to be used while performing partial order...
Definition Overload.h:1021
ConversionSequenceList Conversions
The conversion sequences used to convert the function arguments to the function parameters.
Definition Overload.h:958
friend class OverloadCandidateSet
Definition Overload.h:1093
DeductionFailureInfo DeductionFailure
Definition Overload.h:1024
unsigned Viable
Viable - True to indicate that this overload candidate is viable.
Definition Overload.h:965
bool isPerfectMatch(const ASTContext &Ctx) const
Definition Overload.h:1053
CXXConversionDecl * Surrogate
Surrogate - The conversion function for which this candidate is a surrogate, but only if IsSurrogate ...
Definition Overload.h:953
OverloadCandidateRewriteKind getRewriteKind() const
Get RewriteKind value in OverloadCandidateRewriteKind type (This function is to workaround the spurio...
Definition Overload.h:1035
UserDefinedConversionSequence - Represents a user-defined conversion sequence (C++ 13....
Definition Overload.h:481
StandardConversionSequence Before
Represents the standard conversion that occurs before the actual user-defined conversion.
Definition Overload.h:493
FunctionDecl * ConversionFunction
ConversionFunction - The function that will perform the user-defined conversion.
Definition Overload.h:515
bool HadMultipleCandidates
HadMultipleCandidates - When this is true, it means that the conversion function was resolved from an...
Definition Overload.h:506
StandardConversionSequence After
After - Represents the standard conversion that occurs after the actual user-defined conversion.
Definition Overload.h:510
bool EllipsisConversion
EllipsisConversion - When this is true, it means user-defined conversion sequence starts with a ....
Definition Overload.h:501
DeclAccessPair FoundConversionFunction
The declaration that we found via name lookup, which might be the same as ConversionFunction or it mi...
Definition Overload.h:520
void dump() const
dump - Print this user-defined conversion sequence to standard error.