clang 22.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 /// The number of conversion kinds
212 };
213
214 /// ImplicitConversionRank - The rank of an implicit conversion
215 /// kind. The enumerator values match with Table 9 of (C++
216 /// 13.3.3.1.1) and are listed such that better conversion ranks
217 /// have smaller values.
219 /// Exact Match
221
222 /// HLSL Scalar Widening
224
225 /// Promotion
227
228 /// HLSL Scalar Widening with promotion
230
231 /// Conversion
233
234 /// OpenCL Scalar Widening
236
237 /// HLSL Scalar Widening with conversion
239
240 /// Complex <-> Real conversion
242
243 /// ObjC ARC writeback conversion
245
246 /// Conversion only allowed in the C standard (e.g. void* to char*).
248
249 /// Conversion not allowed by the C standard, but that we accept as an
250 /// extension anyway.
252
253 /// HLSL Matching Dimension Reduction
255
256 /// HLSL Dimension reduction with promotion
258
259 /// HLSL Dimension reduction with conversion
261 };
262
263 ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind);
264
267 ImplicitConversionKind Dimension);
268
269 /// NarrowingKind - The kind of narrowing conversion being performed by a
270 /// standard conversion sequence according to C++11 [dcl.init.list]p7.
272 /// Not a narrowing conversion.
274
275 /// A narrowing conversion by virtue of the source and destination types.
277
278 /// A narrowing conversion, because a constant expression got narrowed.
280
281 /// A narrowing conversion, because a non-constant-expression variable might
282 /// have got narrowed.
284
285 /// Cannot tell whether this is a narrowing conversion because the
286 /// expression is value-dependent.
288 };
289
290 /// StandardConversionSequence - represents a standard conversion
291 /// sequence (C++ 13.3.3.1.1). A standard conversion sequence
292 /// contains between zero and three conversions. If a particular
293 /// conversion is not needed, it will be set to the identity conversion
294 /// (ICK_Identity).
296 public:
297 /// First -- The first conversion can be an lvalue-to-rvalue
298 /// conversion, array-to-pointer conversion, or
299 /// function-to-pointer conversion.
301
302 /// Second - The second conversion can be an integral promotion,
303 /// floating point promotion, integral conversion, floating point
304 /// conversion, floating-integral conversion, pointer conversion,
305 /// pointer-to-member conversion, or boolean conversion.
307
308 /// Dimension - Between the second and third conversion a vector or matrix
309 /// dimension conversion may occur. If this is not ICK_Identity this
310 /// conversion truncates the vector or matrix, or extends a scalar.
312
313 /// Third - The third conversion can be a qualification conversion
314 /// or a function conversion.
316
317 /// Whether this is the deprecated conversion of a
318 /// string literal to a pointer to non-const character data
319 /// (C++ 4.2p2).
320 LLVM_PREFERRED_TYPE(bool)
322
323 /// Whether the qualification conversion involves a change in the
324 /// Objective-C lifetime (for automatic reference counting).
325 LLVM_PREFERRED_TYPE(bool)
327
328 /// IncompatibleObjC - Whether this is an Objective-C conversion
329 /// that we should warn about (if we actually use it).
330 LLVM_PREFERRED_TYPE(bool)
331 unsigned IncompatibleObjC : 1;
332
333 /// ReferenceBinding - True when this is a reference binding
334 /// (C++ [over.ics.ref]).
335 LLVM_PREFERRED_TYPE(bool)
336 unsigned ReferenceBinding : 1;
337
338 /// DirectBinding - True when this is a reference binding that is a
339 /// direct binding (C++ [dcl.init.ref]).
340 LLVM_PREFERRED_TYPE(bool)
341 unsigned DirectBinding : 1;
342
343 /// Whether this is an lvalue reference binding (otherwise, it's
344 /// an rvalue reference binding).
345 LLVM_PREFERRED_TYPE(bool)
346 unsigned IsLvalueReference : 1;
347
348 /// Whether we're binding to a function lvalue.
349 LLVM_PREFERRED_TYPE(bool)
351
352 /// Whether we're binding to an rvalue.
353 LLVM_PREFERRED_TYPE(bool)
354 unsigned BindsToRvalue : 1;
355
356 /// Whether this binds an implicit object argument to a
357 /// non-static member function without a ref-qualifier.
358 LLVM_PREFERRED_TYPE(bool)
360
361 /// Whether this binds a reference to an object with a different
362 /// Objective-C lifetime qualifier.
363 LLVM_PREFERRED_TYPE(bool)
365
366 /// Whether the source expression was originally a single element
367 /// braced-init-list. Such a conversion is not a perfect match,
368 /// as we prefer a std::initializer_list constructor over an exact match
369 /// constructor.
370 LLVM_PREFERRED_TYPE(bool)
371 unsigned FromBracedInitList : 1;
372
373 /// FromType - The type that this conversion is converting
374 /// from. This is an opaque pointer that can be translated into a
375 /// QualType.
377
378 /// ToType - The types that this conversion is converting to in
379 /// each step. This is an opaque pointer that can be translated
380 /// into a QualType.
381 void *ToTypePtrs[3];
382
383 /// CopyConstructor - The copy constructor that is used to perform
384 /// this conversion, when the conversion is actually just the
385 /// initialization of an object via copy constructor. Such
386 /// conversions are either identity conversions or derived-to-base
387 /// conversions.
390
391 void setFromType(QualType T) { FromTypePtr = T.getAsOpaquePtr(); }
392
393 void setToType(unsigned Idx, QualType T) {
394 assert(Idx < 3 && "To type index is out of range");
395 ToTypePtrs[Idx] = T.getAsOpaquePtr();
396 }
397
399 ToTypePtrs[0] = T.getAsOpaquePtr();
400 ToTypePtrs[1] = ToTypePtrs[0];
401 ToTypePtrs[2] = ToTypePtrs[0];
402 }
403
407
408 QualType getToType(unsigned Idx) const {
409 assert(Idx < 3 && "To type index is out of range");
411 }
412
414
415 bool isIdentityConversion() const {
416 return Second == ICK_Identity && Dimension == ICK_Identity &&
418 }
419
420 /// A conversion sequence is perfect if it is an identity conversion and
421 /// the type of the source is the same as the type of the target.
422 bool isPerfect(const ASTContext &C) const {
424 return false;
425
426 // We might prefer a std::initializer_list constructor,
427 // so this sequence cannot be perfect
429 return false;
430
431 // If we are not performing a reference binding, we can skip comparing
432 // the types, which has a noticeable performance impact.
433 if (!ReferenceBinding) {
434#ifndef NDEBUG
435 auto Decay = [&](QualType T) {
436 if (T->isArrayType() || T->isFunctionType())
437 T = C.getDecayedType(T);
438
439 // A function pointer type can be resolved to a member function type,
440 // which is still an identity conversion.
441 if (auto *N = T->getAs<MemberPointerType>();
442 N && N->isMemberFunctionPointer())
443 T = C.getDecayedType(N->getPointeeType());
444 return T;
445 };
446 // The types might differ if there is an array-to-pointer conversion
447 // an function-to-pointer conversion, or lvalue-to-rvalue conversion.
448 // In some cases, this may happen even if First is not set.
449 assert(C.hasSameUnqualifiedType(Decay(getFromType()),
450 Decay(getToType(2))));
451#endif
452 return true;
453 }
454 if (!C.hasSameType(getFromType(), getToType(2)))
455 return false;
457 return false;
458 return true;
459 }
460
463 getNarrowingKind(ASTContext &Context, const Expr *Converted,
464 APValue &ConstantValue, QualType &ConstantType,
465 bool IgnoreFloatToIntegralConversion = false) const;
466 bool isPointerConversionToBool() const;
467 bool isPointerConversionToVoidPointer(ASTContext& Context) const;
468 void dump() const;
469 };
470
471 /// UserDefinedConversionSequence - Represents a user-defined
472 /// conversion sequence (C++ 13.3.3.1.2).
474 /// Represents the standard conversion that occurs before
475 /// the actual user-defined conversion.
476 ///
477 /// C++11 13.3.3.1.2p1:
478 /// If the user-defined conversion is specified by a constructor
479 /// (12.3.1), the initial standard conversion sequence converts
480 /// the source type to the type required by the argument of the
481 /// constructor. If the user-defined conversion is specified by
482 /// a conversion function (12.3.2), the initial standard
483 /// conversion sequence converts the source type to the implicit
484 /// object parameter of the conversion function.
486
487 /// EllipsisConversion - When this is true, it means user-defined
488 /// conversion sequence starts with a ... (ellipsis) conversion, instead of
489 /// a standard conversion. In this case, 'Before' field must be ignored.
490 // FIXME. I much rather put this as the first field. But there seems to be
491 // a gcc code gen. bug which causes a crash in a test. Putting it here seems
492 // to work around the crash.
494
495 /// HadMultipleCandidates - When this is true, it means that the
496 /// conversion function was resolved from an overloaded set having
497 /// size greater than 1.
499
500 /// After - Represents the standard conversion that occurs after
501 /// the actual user-defined conversion.
503
504 /// ConversionFunction - The function that will perform the
505 /// user-defined conversion. Null if the conversion is an
506 /// aggregate initialization from an initializer list.
508
509 /// The declaration that we found via name lookup, which might be
510 /// the same as \c ConversionFunction or it might be a using declaration
511 /// that refers to \c ConversionFunction.
513
514 void dump() const;
515 };
516
517 /// Represents an ambiguous user-defined conversion sequence.
521
524 char Buffer[sizeof(ConversionSet)];
525
529
533
534 void setFromType(QualType T) { FromTypePtr = T.getAsOpaquePtr(); }
535 void setToType(QualType T) { ToTypePtr = T.getAsOpaquePtr(); }
536
538 return *reinterpret_cast<ConversionSet*>(Buffer);
539 }
540
541 const ConversionSet &conversions() const {
542 return *reinterpret_cast<const ConversionSet*>(Buffer);
543 }
544
546 conversions().push_back(std::make_pair(Found, D));
547 }
548
549 using iterator = ConversionSet::iterator;
550
551 iterator begin() { return conversions().begin(); }
552 iterator end() { return conversions().end(); }
553
554 using const_iterator = ConversionSet::const_iterator;
555
556 const_iterator begin() const { return conversions().begin(); }
557 const_iterator end() const { return conversions().end(); }
558
559 void construct();
560 void destruct();
562 };
563
564 /// BadConversionSequence - Records information about an invalid
565 /// conversion sequence.
576
577 // This can be null, e.g. for implicit object arguments.
579
581
582 private:
583 // The type we're converting from (an opaque QualType).
584 void *FromTy;
585
586 // The type we're converting to (an opaque QualType).
587 void *ToTy;
588
589 public:
590 void init(FailureKind K, Expr *From, QualType To) {
591 init(K, From->getType(), To);
592 FromExpr = From;
593 }
594
595 void init(FailureKind K, QualType From, QualType To) {
596 Kind = K;
597 FromExpr = nullptr;
598 setFromType(From);
599 setToType(To);
600 }
601
604
605 void setFromExpr(Expr *E) {
606 FromExpr = E;
607 setFromType(E->getType());
608 }
609
610 void setFromType(QualType T) { FromTy = T.getAsOpaquePtr(); }
611 void setToType(QualType T) { ToTy = T.getAsOpaquePtr(); }
612 };
613
614 /// ImplicitConversionSequence - Represents an implicit conversion
615 /// sequence, which may be a standard conversion sequence
616 /// (C++ 13.3.3.1.1), user-defined conversion sequence (C++ 13.3.3.1.2),
617 /// or an ellipsis conversion sequence (C++ 13.3.3.1.3).
619 public:
620 /// Kind - The kind of implicit conversion sequence. BadConversion
621 /// specifies that there is no conversion from the source type to
622 /// the target type. AmbiguousConversion represents the unique
623 /// ambiguous conversion (C++0x [over.best.ics]p10).
624 /// StaticObjectArgumentConversion represents the conversion rules for
625 /// the synthesized first argument of calls to static member functions
626 /// ([over.best.ics.general]p8).
635
636 private:
637 enum {
639 };
640
641 /// ConversionKind - The kind of implicit conversion sequence.
642 LLVM_PREFERRED_TYPE(Kind)
643 unsigned ConversionKind : 31;
644
645 // Whether the initializer list was of an incomplete array.
646 LLVM_PREFERRED_TYPE(bool)
647 unsigned InitializerListOfIncompleteArray : 1;
648
649 /// When initializing an array or std::initializer_list from an
650 /// initializer-list, this is the array or std::initializer_list type being
651 /// initialized. The remainder of the conversion sequence, including ToType,
652 /// describe the worst conversion of an initializer to an element of the
653 /// array or std::initializer_list. (Note, 'worst' is not well defined.)
654 QualType InitializerListContainerType;
655
656 void setKind(Kind K) {
657 destruct();
658 ConversionKind = K;
659 }
660
661 void destruct() {
662 if (ConversionKind == AmbiguousConversion) Ambiguous.destruct();
663 }
664
665 public:
666 union {
667 /// When ConversionKind == StandardConversion, provides the
668 /// details of the standard conversion sequence.
670
671 /// When ConversionKind == UserDefinedConversion, provides the
672 /// details of the user-defined conversion sequence.
674
675 /// When ConversionKind == AmbiguousConversion, provides the
676 /// details of the ambiguous conversion.
678
679 /// When ConversionKind == BadConversion, provides the details
680 /// of the bad conversion.
682 };
683
685 : ConversionKind(Uninitialized),
686 InitializerListOfIncompleteArray(false) {
687 Standard.setAsIdentityConversion();
688 }
689
691 : ConversionKind(Other.ConversionKind),
692 InitializerListOfIncompleteArray(
693 Other.InitializerListOfIncompleteArray),
694 InitializerListContainerType(Other.InitializerListContainerType) {
695 switch (ConversionKind) {
696 case Uninitialized: break;
697 case StandardConversion: Standard = Other.Standard; break;
699 break;
700 case UserDefinedConversion: UserDefined = Other.UserDefined; break;
701 case AmbiguousConversion: Ambiguous.copyFrom(Other.Ambiguous); break;
702 case EllipsisConversion: break;
703 case BadConversion: Bad = Other.Bad; break;
704 }
705 }
706
709 destruct();
711 return *this;
712 }
713
715 destruct();
716 }
717
718 Kind getKind() const {
719 assert(isInitialized() && "querying uninitialized conversion");
720 return Kind(ConversionKind);
721 }
722
723 /// Return a ranking of the implicit conversion sequence
724 /// kind, where smaller ranks represent better conversion
725 /// sequences.
726 ///
727 /// In particular, this routine gives user-defined conversion
728 /// sequences and ambiguous conversion sequences the same rank,
729 /// per C++ [over.best.ics]p10.
730 unsigned getKindRank() const {
731 switch (getKind()) {
734 return 0;
735
738 return 1;
739
741 return 2;
742
743 case BadConversion:
744 return 3;
745 }
746
747 llvm_unreachable("Invalid ImplicitConversionSequence::Kind!");
748 }
749
750 bool isBad() const { return getKind() == BadConversion; }
751 bool isStandard() const { return getKind() == StandardConversion; }
754 }
755 bool isEllipsis() const { return getKind() == EllipsisConversion; }
756 bool isAmbiguous() const { return getKind() == AmbiguousConversion; }
757 bool isUserDefined() const { return getKind() == UserDefinedConversion; }
758 bool isFailure() const { return isBad() || isAmbiguous(); }
759
760 /// Determines whether this conversion sequence has been
761 /// initialized. Most operations should never need to query
762 /// uninitialized conversions and should assert as above.
763 bool isInitialized() const { return ConversionKind != Uninitialized; }
764
765 /// Sets this sequence as a bad conversion for an explicit argument.
767 Expr *FromExpr, QualType ToType) {
768 setKind(BadConversion);
769 Bad.init(Failure, FromExpr, ToType);
770 }
771
772 /// Sets this sequence as a bad conversion for an implicit argument.
774 QualType FromType, QualType ToType) {
775 setKind(BadConversion);
776 Bad.init(Failure, FromType, ToType);
777 }
778
779 void setStandard() { setKind(StandardConversion); }
781 void setEllipsis() { setKind(EllipsisConversion); }
783
785 if (ConversionKind == AmbiguousConversion) return;
786 ConversionKind = AmbiguousConversion;
787 Ambiguous.construct();
788 }
789
791 setStandard();
792 Standard.setAsIdentityConversion();
793 Standard.setFromType(T);
794 Standard.setAllToTypes(T);
795 }
796
797 /// A conversion sequence is perfect if it is an identity conversion and
798 /// the type of the source is the same as the type of the target.
799 bool isPerfect(const ASTContext &C) const {
800 return isStandard() && Standard.isPerfect(C);
801 }
802
803 // True iff this is a conversion sequence from an initializer list to an
804 // array or std::initializer.
806 return !InitializerListContainerType.isNull();
807 }
809 InitializerListContainerType = T;
810 InitializerListOfIncompleteArray = IA;
811 }
813 return InitializerListOfIncompleteArray;
814 }
817 "not initializer list container");
818 return InitializerListContainerType;
819 }
820
821 /// Form an "implicit" conversion sequence from nullptr_t to bool, for a
822 /// direct-initialization of a bool object from nullptr_t.
824 QualType DestType,
825 bool NeedLValToRVal) {
827 ICS.setStandard();
829 ICS.Standard.setFromType(SourceType);
830 if (NeedLValToRVal)
832 ICS.Standard.setToType(0, SourceType);
834 ICS.Standard.setToType(1, DestType);
835 ICS.Standard.setToType(2, DestType);
836 return ICS;
837 }
838
839 // The result of a comparison between implicit conversion
840 // sequences. Use Sema::CompareImplicitConversionSequences to
841 // actually perform the comparison.
847
849 SourceLocation CaretLoc,
850 const PartialDiagnostic &PDiag) const;
851
852 void dump() const;
853 };
854
860
861 /// This conversion candidate was not considered because it
862 /// duplicates the work of a trivial or derived-to-base
863 /// conversion.
865
866 /// This conversion candidate was not considered because it is
867 /// an illegal instantiation of a constructor temploid: it is
868 /// callable with one argument, we only have one argument, and
869 /// its first parameter type is exactly the type of the class.
870 ///
871 /// Defining such a constructor directly is illegal, and
872 /// template-argument deduction is supposed to ignore such
873 /// instantiations, but we can still get one with the right
874 /// kind of implicit instantiation.
876
877 /// This conversion candidate is not viable because its result
878 /// type is not implicitly convertible to the desired type.
880
881 /// This conversion function template specialization candidate is not
882 /// viable because the final conversion was not an exact match.
884
885 /// (CUDA) This candidate was not viable because the callee
886 /// was not accessible from the caller's target (i.e. host->device,
887 /// global->host, device->host).
889
890 /// This candidate function was not viable because an enable_if
891 /// attribute disabled it.
893
894 /// This candidate constructor or conversion function is explicit but
895 /// the context doesn't permit explicit functions.
897
898 /// This candidate was not viable because its address could not be taken.
900
901 /// This inherited constructor is not viable because it would slice the
902 /// argument.
904
905 /// This candidate was not viable because it is a non-default multiversioned
906 /// function.
908
909 /// This constructor/conversion candidate fail due to an address space
910 /// mismatch between the object being constructed and the overload
911 /// candidate.
913
914 /// This candidate was not viable because its associated constraints were
915 /// not satisfied.
917
918 /// This candidate was not viable because it has internal linkage and is
919 /// from a different module unit than the use.
921 };
922
923 /// A list of implicit conversion sequences for the arguments of an
924 /// OverloadCandidate.
927
928 /// OverloadCandidate - A single candidate in an overload set (C++ 13.3).
929 struct OverloadCandidate {
930 /// Function - The actual function that this candidate
931 /// represents. When NULL, this is a built-in candidate
932 /// (C++ [over.oper]) or a surrogate for a conversion to a
933 /// function pointer or reference (C++ [over.call.object]).
935
936 /// FoundDecl - The original declaration that was looked up /
937 /// invented / otherwise found, together with its access.
938 /// Might be a UsingShadowDecl or a FunctionTemplateDecl.
940
941 /// BuiltinParamTypes - Provides the parameter types of a built-in overload
942 /// candidate. Only valid when Function is NULL.
944
945 /// Surrogate - The conversion function for which this candidate
946 /// is a surrogate, but only if IsSurrogate is true.
948
949 /// The conversion sequences used to convert the function arguments
950 /// to the function parameters. Note that these are indexed by argument,
951 /// so may not match the parameter order of Function.
953
954 /// The FixIt hints which can be used to fix the Bad candidate.
956
957 /// Viable - True to indicate that this overload candidate is viable.
958 LLVM_PREFERRED_TYPE(bool)
960
961 /// Whether this candidate is the best viable function, or tied for being
962 /// the best viable function.
963 ///
964 /// For an ambiguous overload resolution, indicates whether this candidate
965 /// was part of the ambiguity kernel: the minimal non-empty set of viable
966 /// candidates such that all elements of the ambiguity kernel are better
967 /// than all viable candidates not in the ambiguity kernel.
968 LLVM_PREFERRED_TYPE(bool)
969 unsigned Best : 1;
970
971 /// IsSurrogate - True to indicate that this candidate is a
972 /// surrogate for a conversion to a function pointer or reference
973 /// (C++ [over.call.object]).
974 LLVM_PREFERRED_TYPE(bool)
975 unsigned IsSurrogate : 1;
976
977 /// IgnoreObjectArgument - True to indicate that the first
978 /// argument's conversion, which for this function represents the
979 /// implicit object argument, should be ignored. This will be true
980 /// when the candidate is a static member function (where the
981 /// implicit object argument is just a placeholder) or a
982 /// non-static member function when the call doesn't have an
983 /// object argument.
984 LLVM_PREFERRED_TYPE(bool)
986
987 LLVM_PREFERRED_TYPE(bool)
989
990 /// Have we matched any packs on the parameter side, versus any non-packs on
991 /// the argument side, in a context where the opposite matching is also
992 /// allowed?
993 LLVM_PREFERRED_TYPE(bool)
994 unsigned StrictPackMatch : 1;
995
996 /// True if the candidate was found using ADL.
997 LLVM_PREFERRED_TYPE(CallExpr::ADLCallKind)
998 unsigned IsADLCandidate : 1;
999
1000 /// Whether FinalConversion has been set.
1001 LLVM_PREFERRED_TYPE(bool)
1003
1004 /// Whether this is a rewritten candidate, and if so, of what kind?
1005 LLVM_PREFERRED_TYPE(OverloadCandidateRewriteKind)
1006 unsigned RewriteKind : 2;
1007
1008 /// FailureKind - The reason why this candidate is not viable.
1009 /// Actually an OverloadFailureKind.
1010 LLVM_PREFERRED_TYPE(OverloadFailureKind)
1011 unsigned FailureKind : 8;
1012
1013 /// The number of call arguments that were explicitly provided,
1014 /// to be used while performing partial ordering of function templates.
1016
1017 union {
1019
1020 /// FinalConversion - For a conversion function (where Function is
1021 /// a CXXConversionDecl), the standard conversion that occurs
1022 /// after the call to the overload candidate to convert the result
1023 /// of calling the conversion function to the required type.
1025 };
1026
1027 /// Get RewriteKind value in OverloadCandidateRewriteKind type (This
1028 /// function is to workaround the spurious GCC bitfield enum warning)
1032
1033 bool isReversed() const { return getRewriteKind() & CRK_Reversed; }
1034
1035 /// hasAmbiguousConversion - Returns whether this overload
1036 /// candidate requires an ambiguous conversion or not.
1038 for (auto &C : Conversions) {
1039 if (!C.isInitialized()) return false;
1040 if (C.isAmbiguous()) return true;
1041 }
1042 return false;
1043 }
1044
1045 // An overload is a perfect match if the conversion
1046 // sequences for each argument are perfect.
1047 bool isPerfectMatch(const ASTContext &Ctx) const {
1048 if (!Viable)
1049 return false;
1050 for (const auto &C : Conversions) {
1051 if (!C.isInitialized() || !C.isPerfect(Ctx))
1052 return false;
1053 }
1055 return FinalConversion.isPerfect(Ctx);
1056 return true;
1057 }
1058
1059 bool TryToFixBadConversion(unsigned Idx, Sema &S) {
1060 bool CanFix = Fix.tryToFixConversion(
1061 Conversions[Idx].Bad.FromExpr,
1062 Conversions[Idx].Bad.getFromType(),
1063 Conversions[Idx].Bad.getToType(), S);
1064
1065 // If at least one conversion fails, the candidate cannot be fixed.
1066 if (!CanFix)
1067 Fix.clear();
1068
1069 return CanFix;
1070 }
1071
1072 unsigned getNumParams() const {
1073 if (IsSurrogate) {
1074 QualType STy = Surrogate->getConversionType();
1075 while (STy->isPointerOrReferenceType())
1076 STy = STy->getPointeeType();
1077 return STy->castAs<FunctionProtoType>()->getNumParams();
1078 }
1079 if (Function)
1080 return Function->getNumParams();
1081 return ExplicitCallArguments;
1082 }
1083
1085
1086 private:
1088 OverloadCandidate()
1091 IsADLCandidate(llvm::to_underlying(CallExpr::NotADL)),
1093 };
1094
1096
1097 // intrusive linked list support for allocateDeferredCandidate
1099
1101
1102 LLVM_PREFERRED_TYPE(Kind)
1104 LLVM_PREFERRED_TYPE(bool)
1106 LLVM_PREFERRED_TYPE(bool)
1108 LLVM_PREFERRED_TYPE(bool)
1109 unsigned AllowExplicit : 1;
1110 LLVM_PREFERRED_TYPE(bool)
1112 LLVM_PREFERRED_TYPE(bool)
1114 LLVM_PREFERRED_TYPE(bool)
1116 };
1117
1126 static_assert(std::is_trivially_destructible_v<
1128
1139 static_assert(std::is_trivially_destructible_v<
1141
1150
1151 static_assert(std::is_trivially_destructible_v<
1153
1154 /// OverloadCandidateSet - A set of overload candidates, used in C++
1155 /// overload resolution (C++ 13.3).
1157 public:
1159 /// Normal lookup.
1161
1162 /// C++ [over.match.oper]:
1163 /// Lookup of operator function candidates in a call using operator
1164 /// syntax. Candidates that have no parameters of class type will be
1165 /// skipped unless there is a parameter of (reference to) enum type and
1166 /// the corresponding argument is of the same enum type.
1168
1169 /// C++ [over.match.copy]:
1170 /// Copy-initialization of an object of class type by user-defined
1171 /// conversion.
1173
1174 /// C++ [over.match.ctor], [over.match.list]
1175 /// Initialization of an object of class type by constructor,
1176 /// using either a parenthesized or braced list of arguments.
1178
1179 /// C++ [over.match.call.general]
1180 /// Resolve a call through the address of an overload set.
1182
1183 /// When doing overload resolution during code completion,
1184 /// we want to show all viable candidates, including otherwise
1185 /// deferred template candidates.
1187 };
1188
1189 /// Information about operator rewrites to consider when adding operator
1190 /// functions to a candidate set.
1195 bool AllowRewritten)
1197 AllowRewrittenCandidates(AllowRewritten) {}
1198
1199 /// The original operator as written in the source.
1201 /// The source location of the operator.
1203 /// Whether we should include rewritten candidates in the overload set.
1205
1206 /// Would use of this function result in a rewrite using a different
1207 /// operator?
1208 bool isRewrittenOperator(const FunctionDecl *FD) const {
1209 return OriginalOperator &&
1211 }
1212
1213 bool isAcceptableCandidate(const FunctionDecl *FD) const {
1214 if (!OriginalOperator)
1215 return true;
1216
1217 // For an overloaded operator, we can have candidates with a different
1218 // name in our unqualified lookup set. Make sure we only consider the
1219 // ones we're supposed to.
1222 return OO && (OO == OriginalOperator ||
1225 }
1226
1227 /// Determine the kind of rewrite that should be performed for this
1228 /// candidate.
1238 /// Determines whether this operator could be implemented by a function
1239 /// with reversed parameter order.
1245
1246 /// Determine whether reversing parameter order is allowed for operator
1247 /// Op.
1248 bool allowsReversed(OverloadedOperatorKind Op) const;
1249
1250 /// Determine whether we should add a rewritten candidate for \p FD with
1251 /// reversed parameter order.
1252 /// \param OriginalArgs are the original non reversed arguments.
1253 bool shouldAddReversed(Sema &S, ArrayRef<Expr *> OriginalArgs,
1254 FunctionDecl *FD) const;
1255 };
1256
1257 private:
1260
1261 DeferredTemplateOverloadCandidate *FirstDeferredCandidate = nullptr;
1262 unsigned DeferredCandidatesCount : 8 * sizeof(unsigned) - 2;
1263 LLVM_PREFERRED_TYPE(bool)
1264 unsigned HasDeferredTemplateConstructors : 1;
1265 LLVM_PREFERRED_TYPE(bool)
1266 unsigned ResolutionByPerfectCandidateIsDisabled : 1;
1267
1268 // Allocator for ConversionSequenceLists and deferred candidate args.
1269 // We store the first few of these
1270 // inline to avoid allocation for small sets.
1271 llvm::BumpPtrAllocator SlabAllocator;
1272
1273 SourceLocation Loc;
1274 CandidateSetKind Kind;
1275 OperatorRewriteInfo RewriteInfo;
1276
1277 /// Small storage size for ImplicitConversionSequences
1278 /// and the persisted arguments of deferred candidates.
1279 constexpr static unsigned NumInlineBytes =
1280 32 * sizeof(ImplicitConversionSequence);
1281
1282 unsigned NumInlineBytesUsed = 0;
1283 alignas(void *) char InlineSpace[NumInlineBytes];
1284
1285 // Address space of the object being constructed.
1286 LangAS DestAS = LangAS::Default;
1287
1288 /// If we have space, allocates from inline storage. Otherwise, allocates
1289 /// from the slab allocator.
1290 /// FIXME: It would probably be nice to have a SmallBumpPtrAllocator
1291 /// instead.
1292 template <typename T>
1293 T *slabAllocate(unsigned N) {
1294 // It's simpler if this doesn't need to consider alignment.
1295 static_assert(alignof(T) == alignof(void *),
1296 "Only works for pointer-aligned types.");
1297 static_assert(std::is_trivially_destructible_v<T> ||
1298 (std::is_same_v<ImplicitConversionSequence, T>),
1299 "Add destruction logic to OverloadCandidateSet::clear().");
1300
1301 unsigned NBytes = sizeof(T) * N;
1302 if (NBytes > NumInlineBytes - NumInlineBytesUsed)
1303 return SlabAllocator.Allocate<T>(N);
1304 char *FreeSpaceStart = InlineSpace + NumInlineBytesUsed;
1305 assert(uintptr_t(FreeSpaceStart) % alignof(void *) == 0 &&
1306 "Misaligned storage!");
1307
1308 NumInlineBytesUsed += NBytes;
1309 return reinterpret_cast<T *>(FreeSpaceStart);
1310 }
1311
1312 // Because the size of OverloadCandidateSet has a noticeable impact on
1313 // performance, we store each deferred template candidate in the slab
1314 // allocator such that deferred candidates are ultimately a singly-linked
1315 // intrusive linked list. This ends up being much more efficient than a
1316 // SmallVector that is empty in the common case.
1317 template <typename T> T *allocateDeferredCandidate() {
1318 T *C = slabAllocate<T>(1);
1319 if (!FirstDeferredCandidate)
1320 FirstDeferredCandidate = C;
1321 else {
1322 auto *F = FirstDeferredCandidate;
1323 while (F->Next)
1324 F = F->Next;
1325 F->Next = C;
1326 }
1327 DeferredCandidatesCount++;
1328 return C;
1329 }
1330
1331 void destroyCandidates();
1332
1333 public:
1335 OperatorRewriteInfo RewriteInfo = {})
1336 : FirstDeferredCandidate(nullptr), DeferredCandidatesCount(0),
1337 HasDeferredTemplateConstructors(false),
1338 ResolutionByPerfectCandidateIsDisabled(false), Loc(Loc), Kind(CSK),
1339 RewriteInfo(RewriteInfo) {}
1342 ~OverloadCandidateSet() { destroyCandidates(); }
1343
1344 SourceLocation getLocation() const { return Loc; }
1345 CandidateSetKind getKind() const { return Kind; }
1346 OperatorRewriteInfo getRewriteInfo() const { return RewriteInfo; }
1347
1348 /// Whether diagnostics should be deferred.
1349 bool shouldDeferDiags(Sema &S, ArrayRef<Expr *> Args, SourceLocation OpLoc);
1350
1351 // Whether the resolution of template candidates should be deferred
1352 bool shouldDeferTemplateArgumentDeduction(const LangOptions &Opts) const;
1353
1354 /// Determine when this overload candidate will be new to the
1355 /// overload set.
1358 uintptr_t Key = reinterpret_cast<uintptr_t>(F->getCanonicalDecl());
1359 Key |= static_cast<uintptr_t>(PO);
1360 return Functions.insert(Key).second;
1361 }
1362
1363 /// Exclude a function from being considered by overload resolution.
1368
1369 /// Clear out all of the candidates.
1370 void clear(CandidateSetKind CSK);
1371
1373
1374 iterator begin() { return Candidates.begin(); }
1375 iterator end() { return Candidates.end(); }
1376
1377 size_t size() const { return Candidates.size() + DeferredCandidatesCount; }
1378
1379 size_t nonDeferredCandidatesCount() const { return Candidates.size(); }
1380
1381 bool empty() const {
1382 return Candidates.empty() && DeferredCandidatesCount == 0;
1383 }
1384
1385 /// Allocate storage for conversion sequences for NumConversions
1386 /// conversions.
1388 allocateConversionSequences(unsigned NumConversions) {
1389 ImplicitConversionSequence *Conversions =
1390 slabAllocate<ImplicitConversionSequence>(NumConversions);
1391
1392 // Construct the new objects.
1393 for (unsigned I = 0; I != NumConversions; ++I)
1394 new (&Conversions[I]) ImplicitConversionSequence();
1395
1396 return ConversionSequenceList(Conversions, NumConversions);
1397 }
1398
1399 /// Provide storage for any Expr* arg that must be preserved
1400 /// until deferred template candidates are deduced.
1401 /// Typically this should be used for reversed operator arguments
1402 /// and any time the argument array is transformed while adding
1403 /// a template candidate.
1405 Expr **Exprs = slabAllocate<Expr *>(N);
1406 return llvm::MutableArrayRef<Expr *>(Exprs, N);
1407 }
1408
1409 template <typename... T>
1412 getPersistentArgsArray(sizeof...(Exprs));
1413 llvm::copy(std::initializer_list<Expr *>{Exprs...}, Arr.data());
1414 return Arr;
1415 }
1416
1417 /// Add a new candidate with NumConversions conversion sequence slots
1418 /// to the overload set.
1419 OverloadCandidate &addCandidate(unsigned NumConversions = 0,
1420 ConversionSequenceList Conversions = {}) {
1421 assert((Conversions.empty() || Conversions.size() == NumConversions) &&
1422 "preallocated conversion sequence has wrong length");
1423
1424 Candidates.push_back(OverloadCandidate());
1425 OverloadCandidate &C = Candidates.back();
1426 C.Conversions = Conversions.empty()
1427 ? allocateConversionSequences(NumConversions)
1428 : Conversions;
1429 return C;
1430 }
1431
1432 void AddDeferredTemplateCandidate(
1433 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
1434 ArrayRef<Expr *> Args, bool SuppressUserConversions,
1435 bool PartialOverloading, bool AllowExplicit,
1436 CallExpr::ADLCallKind IsADLCandidate, OverloadCandidateParamOrder PO,
1437 bool AggregateCandidateDeduction);
1438
1439 void AddDeferredMethodTemplateCandidate(
1440 FunctionTemplateDecl *MethodTmpl, DeclAccessPair FoundDecl,
1441 CXXRecordDecl *ActingContext, QualType ObjectType,
1442 Expr::Classification ObjectClassification, ArrayRef<Expr *> Args,
1443 bool SuppressUserConversions, bool PartialOverloading,
1444 OverloadCandidateParamOrder PO);
1445
1446 void AddDeferredConversionTemplateCandidate(
1447 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
1448 CXXRecordDecl *ActingContext, Expr *From, QualType ToType,
1449 bool AllowObjCConversionOnExplicit, bool AllowExplicit,
1450 bool AllowResultConversion);
1451
1452 void InjectNonDeducedTemplateCandidates(Sema &S);
1453
1455 ResolutionByPerfectCandidateIsDisabled = true;
1456 }
1457
1458 /// Find the best viable function on this overload set, if it exists.
1459 OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc,
1461
1462 SmallVector<OverloadCandidate *, 32> CompleteCandidates(
1465 llvm::function_ref<bool(OverloadCandidate &)> Filter =
1466 [](OverloadCandidate &) { return true; });
1467
1468 void NoteCandidates(
1469 PartialDiagnosticAt PA, Sema &S, OverloadCandidateDisplayKind OCD,
1470 ArrayRef<Expr *> Args, StringRef Opc = "",
1471 SourceLocation Loc = SourceLocation(),
1472 llvm::function_ref<bool(OverloadCandidate &)> Filter =
1473 [](OverloadCandidate &) { return true; });
1474
1475 void NoteCandidates(Sema &S, ArrayRef<Expr *> Args,
1476 ArrayRef<OverloadCandidate *> Cands,
1477 StringRef Opc = "",
1478 SourceLocation OpLoc = SourceLocation());
1479
1480 LangAS getDestAS() { return DestAS; }
1481
1483 assert((Kind == CSK_InitByConstructor ||
1485 "can't set the destination address space when not constructing an "
1486 "object");
1487 DestAS = AS;
1488 }
1489
1490 private:
1491 OverloadingResult ResultForBestCandidate(const iterator &Best);
1492 void CudaExcludeWrongSideCandidates(
1495 BestViableFunctionImpl(Sema &S, SourceLocation Loc,
1497 };
1498
1499 bool isBetterOverloadCandidate(Sema &S, const OverloadCandidate &Cand1,
1500 const OverloadCandidate &Cand2,
1501 SourceLocation Loc,
1503 bool PartialOverloading = false);
1504
1512
1513 // FIXME: Add an AddOverloadCandidate / AddTemplateOverloadCandidate overload
1514 // that takes one of these.
1516 if (isa<UsingDecl>(ND))
1517 return ConstructorInfo{};
1518
1519 // For constructors, the access check is performed against the underlying
1520 // declaration, not the found declaration.
1521 auto *D = ND->getUnderlyingDecl();
1522 ConstructorInfo Info = {DeclAccessPair::make(ND, D->getAccess()), nullptr,
1523 nullptr};
1524 Info.ConstructorTmpl = dyn_cast<FunctionTemplateDecl>(D);
1525 if (Info.ConstructorTmpl)
1527 Info.Constructor = dyn_cast<CXXConstructorDecl>(D);
1528 return Info;
1529 }
1530
1531 // Returns false if signature help is relevant despite number of arguments
1532 // exceeding parameters. Specifically, it returns false when
1533 // PartialOverloading is true and one of the following:
1534 // * Function is variadic
1535 // * Function is template variadic
1536 // * Function is an instantiation of template variadic function
1537 // The last case may seem strange. The idea is that if we added one more
1538 // argument, we'd end up with a function similar to Function. Since, in the
1539 // context of signature help and/or code completion, we do not know what the
1540 // type of the next argument (that the user is typing) will be, this is as
1541 // good candidate as we can get, despite the fact that it takes one less
1542 // parameter.
1543 bool shouldEnforceArgLimit(bool PartialOverloading, FunctionDecl *Function);
1544
1546 const LangOptions &Opts) const {
1547 return
1548 // For user defined conversion we need to check against different
1549 // combination of CV qualifiers and look at any explicit specifier, so
1550 // always deduce template candidates.
1552 // When doing code completion, we want to see all the
1553 // viable candidates.
1554 && Kind != CSK_CodeCompletion
1555 // CUDA may prefer template candidates even when a non-candidate
1556 // is a perfect match
1557 && !Opts.CUDA;
1558 }
1559
1560} // namespace clang
1561
1562#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:122
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:220
Represents a C++ constructor within a class.
Definition DeclCXX.h:2604
Represents a C++ conversion function within a class.
Definition DeclCXX.h:2943
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:2877
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:507
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition DeclBase.h:978
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:337
This represents one expression.
Definition Expr.h:112
QualType getType() const
Definition Expr.h:144
Represents a function declaration or definition.
Definition Decl.h:2000
Represents a prototype with parameter type info, e.g.
Definition TypeBase.h:5254
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:618
void dump() const
dump - Print this implicit conversion sequence to standard error.
ImplicitConversionSequence & operator=(const ImplicitConversionSequence &Other)
Definition Overload.h:708
Kind
Kind - The kind of implicit conversion sequence.
Definition Overload.h:627
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:799
StandardConversionSequence Standard
When ConversionKind == StandardConversion, provides the details of the standard conversion sequence.
Definition Overload.h:669
void setBad(BadConversionSequence::FailureKind Failure, Expr *FromExpr, QualType ToType)
Sets this sequence as a bad conversion for an explicit argument.
Definition Overload.h:766
UserDefinedConversionSequence UserDefined
When ConversionKind == UserDefinedConversion, provides the details of the user-defined conversion seq...
Definition Overload.h:673
ImplicitConversionSequence(const ImplicitConversionSequence &Other)
Definition Overload.h:690
bool isInitialized() const
Determines whether this conversion sequence has been initialized.
Definition Overload.h:763
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:823
AmbiguousConversionSequence Ambiguous
When ConversionKind == AmbiguousConversion, provides the details of the ambiguous conversion.
Definition Overload.h:677
void setInitializerListContainerType(QualType T, bool IA)
Definition Overload.h:808
bool hasInitializerListContainerType() const
Definition Overload.h:805
unsigned getKindRank() const
Return a ranking of the implicit conversion sequence kind, where smaller ranks represent better conve...
Definition Overload.h:730
bool isInitializerListOfIncompleteArray() const
Definition Overload.h:812
BadConversionSequence Bad
When ConversionKind == BadConversion, provides the details of the bad conversion.
Definition Overload.h:681
QualType getInitializerListContainerType() const
Definition Overload.h:815
void setAsIdentityConversion(QualType T)
Definition Overload.h:790
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:773
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition TypeBase.h:3653
bool isMemberFunctionPointer() const
Returns true if the member type (i.e.
Definition TypeBase.h:3675
This represents a decl that may have a name.
Definition Decl.h:274
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
Definition Decl.h:487
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition Decl.h:340
llvm::MutableArrayRef< Expr * > getPersistentArgsArray(T *...Exprs)
Definition Overload.h:1410
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:1356
void DisableResolutionByPerfectCandidate()
Definition Overload.h:1454
void setDestAS(LangAS AS)
Definition Overload.h:1482
ConversionSequenceList allocateConversionSequences(unsigned NumConversions)
Allocate storage for conversion sequences for NumConversions conversions.
Definition Overload.h:1388
OverloadCandidateSet(SourceLocation Loc, CandidateSetKind CSK, OperatorRewriteInfo RewriteInfo={})
Definition Overload.h:1334
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:1404
OperatorRewriteInfo getRewriteInfo() const
Definition Overload.h:1346
bool shouldDeferTemplateArgumentDeduction(const LangOptions &Opts) const
Definition Overload.h:1545
@ CSK_AddressOfOverloadSet
C++ [over.match.call.general] Resolve a call through the address of an overload set.
Definition Overload.h:1181
@ CSK_InitByConstructor
C++ [over.match.ctor], [over.match.list] Initialization of an object of class type by constructor,...
Definition Overload.h:1177
@ CSK_InitByUserDefinedConversion
C++ [over.match.copy]: Copy-initialization of an object of class type by user-defined conversion.
Definition Overload.h:1172
@ CSK_Normal
Normal lookup.
Definition Overload.h:1160
@ CSK_Operator
C++ [over.match.oper]: Lookup of operator function candidates in a call using operator syntax.
Definition Overload.h:1167
@ CSK_CodeCompletion
When doing overload resolution during code completion, we want to show all viable candidates,...
Definition Overload.h:1186
SmallVectorImpl< OverloadCandidate >::iterator iterator
Definition Overload.h:1372
OverloadCandidateSet(const OverloadCandidateSet &)=delete
void exclude(Decl *F)
Exclude a function from being considered by overload resolution.
Definition Overload.h:1364
SourceLocation getLocation() const
Definition Overload.h:1344
OverloadCandidate & addCandidate(unsigned NumConversions=0, ConversionSequenceList Conversions={})
Add a new candidate with NumConversions conversion sequence slots to the overload set.
Definition Overload.h:1419
CandidateSetKind getKind() const
Definition Overload.h:1345
size_t nonDeferredCandidatesCount() const
Definition Overload.h:1379
A (possibly-)qualified type.
Definition TypeBase.h:937
static QualType getFromOpaquePtr(const void *Ptr)
Definition TypeBase.h:986
Sema - This implements semantic analysis and AST building for C.
Definition Sema.h:854
Encodes a location in the source.
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3....
Definition Overload.h:295
void dump() const
dump - Print this standard conversion sequence to standard error.
DeclAccessPair FoundCopyConstructor
Definition Overload.h:389
void * FromTypePtr
FromType - The type that this conversion is converting from.
Definition Overload.h:376
unsigned BindsToRvalue
Whether we're binding to an rvalue.
Definition Overload.h:354
ImplicitConversionKind Second
Second - The second conversion can be an integral promotion, floating point promotion,...
Definition Overload.h:306
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:422
ImplicitConversionKind First
First – The first conversion can be an lvalue-to-rvalue conversion, array-to-pointer conversion,...
Definition Overload.h:300
unsigned BindsImplicitObjectArgumentWithoutRefQualifier
Whether this binds an implicit object argument to a non-static member function without a ref-qualifie...
Definition Overload.h:359
unsigned ReferenceBinding
ReferenceBinding - True when this is a reference binding (C++ [over.ics.ref]).
Definition Overload.h:336
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:321
CXXConstructorDecl * CopyConstructor
CopyConstructor - The copy constructor that is used to perform this conversion, when the conversion i...
Definition Overload.h:388
unsigned IncompatibleObjC
IncompatibleObjC - Whether this is an Objective-C conversion that we should warn about (if we actuall...
Definition Overload.h:331
unsigned ObjCLifetimeConversionBinding
Whether this binds a reference to an object with a different Objective-C lifetime qualifier.
Definition Overload.h:364
ImplicitConversionKind Third
Third - The third conversion can be a qualification conversion or a function conversion.
Definition Overload.h:315
unsigned QualificationIncludesObjCLifetime
Whether the qualification conversion involves a change in the Objective-C lifetime (for automatic ref...
Definition Overload.h:326
void setToType(unsigned Idx, QualType T)
Definition Overload.h:393
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:381
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).
Definition Overload.h:346
ImplicitConversionKind Dimension
Dimension - Between the second and third conversion a vector or matrix dimension conversion may occur...
Definition Overload.h:311
unsigned BindsToFunctionLvalue
Whether we're binding to a function lvalue.
Definition Overload.h:350
unsigned DirectBinding
DirectBinding - True when this is a reference binding that is a direct binding (C++ [dcl....
Definition Overload.h:341
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:371
QualType getToType(unsigned Idx) const
Definition Overload.h:408
const T * castAs() const
Member-template castAs<specific type>.
Definition TypeBase.h:9158
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
Definition Type.cpp:752
bool isPointerOrReferenceType() const
Definition TypeBase.h:8519
#define bool
Definition gpuintrin.h:32
The JSON file list parser is used to communicate input to InstallAPI.
ImplicitConversionRank GetDimensionConversionRank(ImplicitConversionRank Base, ImplicitConversionKind Dimension)
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
bool isa(CodeGen::Address addr)
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:855
@ ovl_fail_final_conversion_not_exact
This conversion function template specialization candidate is not viable because the final conversion...
Definition Overload.h:883
@ ovl_fail_enable_if
This candidate function was not viable because an enable_if attribute disabled it.
Definition Overload.h:892
@ ovl_fail_illegal_constructor
This conversion candidate was not considered because it is an illegal instantiation of a constructor ...
Definition Overload.h:875
@ ovl_fail_bad_final_conversion
This conversion candidate is not viable because its result type is not implicitly convertible to the ...
Definition Overload.h:879
@ 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:920
@ ovl_fail_too_few_arguments
Definition Overload.h:857
@ ovl_fail_addr_not_available
This candidate was not viable because its address could not be taken.
Definition Overload.h:899
@ ovl_fail_too_many_arguments
Definition Overload.h:856
@ ovl_non_default_multiversion_function
This candidate was not viable because it is a non-default multiversioned function.
Definition Overload.h:907
@ ovl_fail_constraints_not_satisfied
This candidate was not viable because its associated constraints were not satisfied.
Definition Overload.h:916
@ ovl_fail_bad_conversion
Definition Overload.h:858
@ ovl_fail_bad_target
(CUDA) This candidate was not viable because the callee was not accessible from the caller's target (...
Definition Overload.h:888
@ ovl_fail_bad_deduction
Definition Overload.h:859
@ ovl_fail_inhctor_slice
This inherited constructor is not viable because it would slice the argument.
Definition Overload.h:903
@ ovl_fail_object_addrspace_mismatch
This constructor/conversion candidate fail due to an address space mismatch between the object being ...
Definition Overload.h:912
@ ovl_fail_explicit
This candidate constructor or conversion function is explicit but the context doesn't permit explicit...
Definition Overload.h:896
@ ovl_fail_trivial_conversion
This conversion candidate was not considered because it duplicates the work of a trivial or derived-t...
Definition Overload.h:864
ImplicitConversionRank
ImplicitConversionRank - The rank of an implicit conversion kind.
Definition Overload.h:218
@ ICR_Conversion
Conversion.
Definition Overload.h:232
@ ICR_Writeback_Conversion
ObjC ARC writeback conversion.
Definition Overload.h:244
@ ICR_HLSL_Dimension_Reduction
HLSL Matching Dimension Reduction.
Definition Overload.h:254
@ ICR_HLSL_Dimension_Reduction_Conversion
HLSL Dimension reduction with conversion.
Definition Overload.h:260
@ ICR_HLSL_Scalar_Widening
HLSL Scalar Widening.
Definition Overload.h:223
@ ICR_C_Conversion
Conversion only allowed in the C standard (e.g. void* to char*).
Definition Overload.h:247
@ ICR_OCL_Scalar_Widening
OpenCL Scalar Widening.
Definition Overload.h:235
@ ICR_Complex_Real_Conversion
Complex <-> Real conversion.
Definition Overload.h:241
@ ICR_HLSL_Scalar_Widening_Conversion
HLSL Scalar Widening with conversion.
Definition Overload.h:238
@ ICR_HLSL_Dimension_Reduction_Promotion
HLSL Dimension reduction with promotion.
Definition Overload.h:257
@ ICR_Promotion
Promotion.
Definition Overload.h:226
@ ICR_Exact_Match
Exact Match.
Definition Overload.h:220
@ ICR_C_Conversion_Extension
Conversion not allowed by the C standard, but that we accept as an extension anyway.
Definition Overload.h:251
@ ICR_HLSL_Scalar_Widening_Promotion
HLSL Scalar Widening with promotion.
Definition Overload.h:229
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:925
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: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:271
@ NK_Not_Narrowing
Not a narrowing conversion.
Definition Overload.h:273
@ NK_Constant_Narrowing
A narrowing conversion, because a constant expression got narrowed.
Definition Overload.h:279
@ NK_Dependent_Narrowing
Cannot tell whether this is a narrowing conversion because the expression is value-dependent.
Definition Overload.h:287
@ NK_Type_Narrowing
A narrowing conversion by virtue of the source and destination types.
Definition Overload.h:276
@ NK_Variable_Narrowing
A narrowing conversion, because a non-constant-expression variable might have got narrowed.
Definition Overload.h:283
ConstructorInfo getConstructorInfo(NamedDecl *ND)
Definition Overload.h:1515
ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind)
GetConversionRank - Retrieve the implicit conversion rank corresponding to the given implicit convers...
@ Other
Other implicit parameter.
Definition Decl.h:1746
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:518
ConversionSet::const_iterator const_iterator
Definition Overload.h:554
const ConversionSet & conversions() const
Definition Overload.h:541
SmallVector< std::pair< NamedDecl *, FunctionDecl * >, 4 > ConversionSet
Definition Overload.h:519
const_iterator end() const
Definition Overload.h:557
void addConversion(NamedDecl *Found, FunctionDecl *D)
Definition Overload.h:545
char Buffer[sizeof(ConversionSet)]
Definition Overload.h:524
void copyFrom(const AmbiguousConversionSequence &)
ConversionSet::iterator iterator
Definition Overload.h:549
const_iterator begin() const
Definition Overload.h:556
BadConversionSequence - Records information about an invalid conversion sequence.
Definition Overload.h:566
void setToType(QualType T)
Definition Overload.h:611
void setFromType(QualType T)
Definition Overload.h:610
void init(FailureKind K, Expr *From, QualType To)
Definition Overload.h:590
void init(FailureKind K, QualType From, QualType To)
Definition Overload.h:595
QualType getToType() const
Definition Overload.h:603
QualType getFromType() const
Definition Overload.h:602
FunctionTemplateDecl * ConstructorTmpl
Definition Overload.h:1508
CXXConstructorDecl * Constructor
Definition Overload.h:1507
DeclAccessPair FoundDecl
Definition Overload.h:1506
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:1098
Information about operator rewrites to consider when adding operator functions to a candidate set.
Definition Overload.h:1191
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:1208
OperatorRewriteInfo(OverloadedOperatorKind Op, SourceLocation OpLoc, bool AllowRewritten)
Definition Overload.h:1194
bool isAcceptableCandidate(const FunctionDecl *FD) const
Definition Overload.h:1213
bool isReversible() const
Determines whether this operator could be implemented by a function with reversed parameter order.
Definition Overload.h:1240
SourceLocation OpLoc
The source location of the operator.
Definition Overload.h:1202
bool AllowRewrittenCandidates
Whether we should include rewritten candidates in the overload set.
Definition Overload.h:1204
OverloadedOperatorKind OriginalOperator
The original operator as written in the source.
Definition Overload.h:1200
OverloadCandidateRewriteKind getRewriteKind(const FunctionDecl *FD, OverloadCandidateParamOrder PO)
Determine the kind of rewrite that should be performed for this candidate.
Definition Overload.h:1230
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
Definition Overload.h:929
unsigned StrictPackMatch
Have we matched any packs on the parameter side, versus any non-packs on the argument side,...
Definition Overload.h:994
unsigned IgnoreObjectArgument
IgnoreObjectArgument - True to indicate that the first argument's conversion, which for this function...
Definition Overload.h:985
bool TryToFixBadConversion(unsigned Idx, Sema &S)
Definition Overload.h:1059
bool NotValidBecauseConstraintExprHasError() const
bool isReversed() const
Definition Overload.h:1033
unsigned IsADLCandidate
True if the candidate was found using ADL.
Definition Overload.h:998
unsigned IsSurrogate
IsSurrogate - True to indicate that this candidate is a surrogate for a conversion to a function poin...
Definition Overload.h:975
QualType BuiltinParamTypes[3]
BuiltinParamTypes - Provides the parameter types of a built-in overload candidate.
Definition Overload.h:943
bool hasAmbiguousConversion() const
hasAmbiguousConversion - Returns whether this overload candidate requires an ambiguous conversion or ...
Definition Overload.h:1037
DeclAccessPair FoundDecl
FoundDecl - The original declaration that was looked up / invented / otherwise found,...
Definition Overload.h:939
FunctionDecl * Function
Function - The actual function that this candidate represents.
Definition Overload.h:934
unsigned RewriteKind
Whether this is a rewritten candidate, and if so, of what kind?
Definition Overload.h:1006
ConversionFixItGenerator Fix
The FixIt hints which can be used to fix the Bad candidate.
Definition Overload.h:955
unsigned Best
Whether this candidate is the best viable function, or tied for being the best viable function.
Definition Overload.h:969
StandardConversionSequence FinalConversion
FinalConversion - For a conversion function (where Function is a CXXConversionDecl),...
Definition Overload.h:1024
unsigned getNumParams() const
Definition Overload.h:1072
unsigned HasFinalConversion
Whether FinalConversion has been set.
Definition Overload.h:1002
unsigned TookAddressOfOverload
Definition Overload.h:988
unsigned FailureKind
FailureKind - The reason why this candidate is not viable.
Definition Overload.h:1011
unsigned ExplicitCallArguments
The number of call arguments that were explicitly provided, to be used while performing partial order...
Definition Overload.h:1015
ConversionSequenceList Conversions
The conversion sequences used to convert the function arguments to the function parameters.
Definition Overload.h:952
friend class OverloadCandidateSet
Definition Overload.h:1087
DeductionFailureInfo DeductionFailure
Definition Overload.h:1018
unsigned Viable
Viable - True to indicate that this overload candidate is viable.
Definition Overload.h:959
bool isPerfectMatch(const ASTContext &Ctx) const
Definition Overload.h:1047
CXXConversionDecl * Surrogate
Surrogate - The conversion function for which this candidate is a surrogate, but only if IsSurrogate ...
Definition Overload.h:947
OverloadCandidateRewriteKind getRewriteKind() const
Get RewriteKind value in OverloadCandidateRewriteKind type (This function is to workaround the spurio...
Definition Overload.h:1029
UserDefinedConversionSequence - Represents a user-defined conversion sequence (C++ 13....
Definition Overload.h:473
StandardConversionSequence Before
Represents the standard conversion that occurs before the actual user-defined conversion.
Definition Overload.h:485
FunctionDecl * ConversionFunction
ConversionFunction - The function that will perform the user-defined conversion.
Definition Overload.h:507
bool HadMultipleCandidates
HadMultipleCandidates - When this is true, it means that the conversion function was resolved from an...
Definition Overload.h:498
StandardConversionSequence After
After - Represents the standard conversion that occurs after the actual user-defined conversion.
Definition Overload.h:502
bool EllipsisConversion
EllipsisConversion - When this is true, it means user-defined conversion sequence starts with a ....
Definition Overload.h:493
DeclAccessPair FoundConversionFunction
The declaration that we found via name lookup, which might be the same as ConversionFunction or it mi...
Definition Overload.h:512
void dump() const
dump - Print this user-defined conversion sequence to standard error.