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 FromExpr = From;
601 }
602
603 void init(FailureKind K, QualType From, QualType To) {
604 Kind = K;
605 FromExpr = nullptr;
606 setFromType(From);
607 setToType(To);
608 }
609
612
613 void setFromExpr(Expr *E) {
614 FromExpr = E;
615 setFromType(E->getType());
616 }
617
618 void setFromType(QualType T) { FromTy = T.getAsOpaquePtr(); }
619 void setToType(QualType T) { ToTy = T.getAsOpaquePtr(); }
620 };
621
622 /// ImplicitConversionSequence - Represents an implicit conversion
623 /// sequence, which may be a standard conversion sequence
624 /// (C++ 13.3.3.1.1), user-defined conversion sequence (C++ 13.3.3.1.2),
625 /// or an ellipsis conversion sequence (C++ 13.3.3.1.3).
627 public:
628 /// Kind - The kind of implicit conversion sequence. BadConversion
629 /// specifies that there is no conversion from the source type to
630 /// the target type. AmbiguousConversion represents the unique
631 /// ambiguous conversion (C++0x [over.best.ics]p10).
632 /// StaticObjectArgumentConversion represents the conversion rules for
633 /// the synthesized first argument of calls to static member functions
634 /// ([over.best.ics.general]p8).
643
644 private:
645 enum {
647 };
648
649 /// ConversionKind - The kind of implicit conversion sequence.
650 LLVM_PREFERRED_TYPE(Kind)
651 unsigned ConversionKind : 31;
652
653 // Whether the initializer list was of an incomplete array.
654 LLVM_PREFERRED_TYPE(bool)
655 unsigned InitializerListOfIncompleteArray : 1;
656
657 /// When initializing an array or std::initializer_list from an
658 /// initializer-list, this is the array or std::initializer_list type being
659 /// initialized. The remainder of the conversion sequence, including ToType,
660 /// describe the worst conversion of an initializer to an element of the
661 /// array or std::initializer_list. (Note, 'worst' is not well defined.)
662 QualType InitializerListContainerType;
663
664 void setKind(Kind K) {
665 destruct();
666 ConversionKind = K;
667 }
668
669 void destruct() {
670 if (ConversionKind == AmbiguousConversion) Ambiguous.destruct();
671 }
672
673 public:
674 union {
675 /// When ConversionKind == StandardConversion, provides the
676 /// details of the standard conversion sequence.
678
679 /// When ConversionKind == UserDefinedConversion, provides the
680 /// details of the user-defined conversion sequence.
682
683 /// When ConversionKind == AmbiguousConversion, provides the
684 /// details of the ambiguous conversion.
686
687 /// When ConversionKind == BadConversion, provides the details
688 /// of the bad conversion.
690 };
691
693 : ConversionKind(Uninitialized),
694 InitializerListOfIncompleteArray(false) {
695 Standard.setAsIdentityConversion();
696 }
697
699 : ConversionKind(Other.ConversionKind),
700 InitializerListOfIncompleteArray(
701 Other.InitializerListOfIncompleteArray),
702 InitializerListContainerType(Other.InitializerListContainerType) {
703 switch (ConversionKind) {
704 case Uninitialized: break;
705 case StandardConversion: Standard = Other.Standard; break;
707 break;
708 case UserDefinedConversion: UserDefined = Other.UserDefined; break;
709 case AmbiguousConversion: Ambiguous.copyFrom(Other.Ambiguous); break;
710 case EllipsisConversion: break;
711 case BadConversion: Bad = Other.Bad; break;
712 }
713 }
714
717 destruct();
719 return *this;
720 }
721
723 destruct();
724 }
725
726 Kind getKind() const {
727 assert(isInitialized() && "querying uninitialized conversion");
728 return Kind(ConversionKind);
729 }
730
731 /// Return a ranking of the implicit conversion sequence
732 /// kind, where smaller ranks represent better conversion
733 /// sequences.
734 ///
735 /// In particular, this routine gives user-defined conversion
736 /// sequences and ambiguous conversion sequences the same rank,
737 /// per C++ [over.best.ics]p10.
738 unsigned getKindRank() const {
739 switch (getKind()) {
742 return 0;
743
746 return 1;
747
749 return 2;
750
751 case BadConversion:
752 return 3;
753 }
754
755 llvm_unreachable("Invalid ImplicitConversionSequence::Kind!");
756 }
757
758 bool isBad() const { return getKind() == BadConversion; }
759 bool isStandard() const { return getKind() == StandardConversion; }
762 }
763 bool isEllipsis() const { return getKind() == EllipsisConversion; }
764 bool isAmbiguous() const { return getKind() == AmbiguousConversion; }
765 bool isUserDefined() const { return getKind() == UserDefinedConversion; }
766 bool isFailure() const { return isBad() || isAmbiguous(); }
767
768 /// Determines whether this conversion sequence has been
769 /// initialized. Most operations should never need to query
770 /// uninitialized conversions and should assert as above.
771 bool isInitialized() const { return ConversionKind != Uninitialized; }
772
773 /// Sets this sequence as a bad conversion for an explicit argument.
775 Expr *FromExpr, QualType ToType) {
776 setKind(BadConversion);
777 Bad.init(Failure, FromExpr, ToType);
778 }
779
780 /// Sets this sequence as a bad conversion for an implicit argument.
782 QualType FromType, QualType ToType) {
783 setKind(BadConversion);
784 Bad.init(Failure, FromType, ToType);
785 }
786
787 void setStandard() { setKind(StandardConversion); }
789 void setEllipsis() { setKind(EllipsisConversion); }
791
793 if (ConversionKind == AmbiguousConversion) return;
794 ConversionKind = AmbiguousConversion;
795 Ambiguous.construct();
796 }
797
799 setStandard();
800 Standard.setAsIdentityConversion();
801 Standard.setFromType(T);
802 Standard.setAllToTypes(T);
803 }
804
805 /// A conversion sequence is perfect if it is an identity conversion and
806 /// the type of the source is the same as the type of the target.
807 bool isPerfect(const ASTContext &C) const {
808 return isStandard() && Standard.isPerfect(C);
809 }
810
811 // True iff this is a conversion sequence from an initializer list to an
812 // array or std::initializer.
814 return !InitializerListContainerType.isNull();
815 }
817 InitializerListContainerType = T;
818 InitializerListOfIncompleteArray = IA;
819 }
821 return InitializerListOfIncompleteArray;
822 }
825 "not initializer list container");
826 return InitializerListContainerType;
827 }
828
829 /// Form an "implicit" conversion sequence from nullptr_t to bool, for a
830 /// direct-initialization of a bool object from nullptr_t.
832 QualType DestType,
833 bool NeedLValToRVal) {
835 ICS.setStandard();
837 ICS.Standard.setFromType(SourceType);
838 if (NeedLValToRVal)
840 ICS.Standard.setToType(0, SourceType);
842 ICS.Standard.setToType(1, DestType);
843 ICS.Standard.setToType(2, DestType);
844 return ICS;
845 }
846
847 // The result of a comparison between implicit conversion
848 // sequences. Use Sema::CompareImplicitConversionSequences to
849 // actually perform the comparison.
855
857 SourceLocation CaretLoc,
858 const PartialDiagnostic &PDiag) const;
859
860 void dump() const;
861 };
862
868
869 /// This conversion candidate was not considered because it
870 /// duplicates the work of a trivial or derived-to-base
871 /// conversion.
873
874 /// This conversion candidate was not considered because it is
875 /// an illegal instantiation of a constructor temploid: it is
876 /// callable with one argument, we only have one argument, and
877 /// its first parameter type is exactly the type of the class.
878 ///
879 /// Defining such a constructor directly is illegal, and
880 /// template-argument deduction is supposed to ignore such
881 /// instantiations, but we can still get one with the right
882 /// kind of implicit instantiation.
884
885 /// This conversion candidate is not viable because its result
886 /// type is not implicitly convertible to the desired type.
888
889 /// This conversion function template specialization candidate is not
890 /// viable because the final conversion was not an exact match.
892
893 /// (CUDA) This candidate was not viable because the callee
894 /// was not accessible from the caller's target (i.e. host->device,
895 /// global->host, device->host).
897
898 /// This candidate function was not viable because an enable_if
899 /// attribute disabled it.
901
902 /// This candidate constructor or conversion function is explicit but
903 /// the context doesn't permit explicit functions.
905
906 /// This candidate was not viable because its address could not be taken.
908
909 /// This inherited constructor is not viable because it would slice the
910 /// argument.
912
913 /// This candidate was not viable because it is a non-default multiversioned
914 /// function.
916
917 /// This constructor/conversion candidate fail due to an address space
918 /// mismatch between the object being constructed and the overload
919 /// candidate.
921
922 /// This candidate was not viable because its associated constraints were
923 /// not satisfied.
925
926 /// This candidate was not viable because it has internal linkage and is
927 /// from a different module unit than the use.
929 };
930
931 /// A list of implicit conversion sequences for the arguments of an
932 /// OverloadCandidate.
935
936 /// OverloadCandidate - A single candidate in an overload set (C++ 13.3).
937 struct OverloadCandidate {
938 /// Function - The actual function that this candidate
939 /// represents. When NULL, this is a built-in candidate
940 /// (C++ [over.oper]) or a surrogate for a conversion to a
941 /// function pointer or reference (C++ [over.call.object]).
943
944 /// FoundDecl - The original declaration that was looked up /
945 /// invented / otherwise found, together with its access.
946 /// Might be a UsingShadowDecl or a FunctionTemplateDecl.
948
949 /// BuiltinParamTypes - Provides the parameter types of a built-in overload
950 /// candidate. Only valid when Function is NULL.
952
953 /// Surrogate - The conversion function for which this candidate
954 /// is a surrogate, but only if IsSurrogate is true.
956
957 /// The conversion sequences used to convert the function arguments
958 /// to the function parameters. Note that these are indexed by argument,
959 /// so may not match the parameter order of Function.
961
962 /// The FixIt hints which can be used to fix the Bad candidate.
964
965 /// Viable - True to indicate that this overload candidate is viable.
966 LLVM_PREFERRED_TYPE(bool)
968
969 /// Whether this candidate is the best viable function, or tied for being
970 /// the best viable function.
971 ///
972 /// For an ambiguous overload resolution, indicates whether this candidate
973 /// was part of the ambiguity kernel: the minimal non-empty set of viable
974 /// candidates such that all elements of the ambiguity kernel are better
975 /// than all viable candidates not in the ambiguity kernel.
976 LLVM_PREFERRED_TYPE(bool)
977 unsigned Best : 1;
978
979 /// IsSurrogate - True to indicate that this candidate is a
980 /// surrogate for a conversion to a function pointer or reference
981 /// (C++ [over.call.object]).
982 LLVM_PREFERRED_TYPE(bool)
983 unsigned IsSurrogate : 1;
984
985 /// IgnoreObjectArgument - True to indicate that the first
986 /// argument's conversion, which for this function represents the
987 /// implicit object argument, should be ignored. This will be true
988 /// when the candidate is a static member function (where the
989 /// implicit object argument is just a placeholder) or a
990 /// non-static member function when the call doesn't have an
991 /// object argument.
992 LLVM_PREFERRED_TYPE(bool)
994
995 LLVM_PREFERRED_TYPE(bool)
997
998 /// Have we matched any packs on the parameter side, versus any non-packs on
999 /// the argument side, in a context where the opposite matching is also
1000 /// allowed?
1001 LLVM_PREFERRED_TYPE(bool)
1002 unsigned StrictPackMatch : 1;
1003
1004 /// True if the candidate was found using ADL.
1005 LLVM_PREFERRED_TYPE(CallExpr::ADLCallKind)
1006 unsigned IsADLCandidate : 1;
1007
1008 /// Whether FinalConversion has been set.
1009 LLVM_PREFERRED_TYPE(bool)
1011
1012 /// Whether this is a rewritten candidate, and if so, of what kind?
1013 LLVM_PREFERRED_TYPE(OverloadCandidateRewriteKind)
1014 unsigned RewriteKind : 2;
1015
1016 /// FailureKind - The reason why this candidate is not viable.
1017 /// Actually an OverloadFailureKind.
1018 LLVM_PREFERRED_TYPE(OverloadFailureKind)
1019 unsigned FailureKind : 8;
1020
1021 /// The number of call arguments that were explicitly provided,
1022 /// to be used while performing partial ordering of function templates.
1024
1025 union {
1027
1028 /// FinalConversion - For a conversion function (where Function is
1029 /// a CXXConversionDecl), the standard conversion that occurs
1030 /// after the call to the overload candidate to convert the result
1031 /// of calling the conversion function to the required type.
1033 };
1034
1035 /// Get RewriteKind value in OverloadCandidateRewriteKind type (This
1036 /// function is to workaround the spurious GCC bitfield enum warning)
1040
1041 bool isReversed() const { return getRewriteKind() & CRK_Reversed; }
1042
1043 /// hasAmbiguousConversion - Returns whether this overload
1044 /// candidate requires an ambiguous conversion or not.
1046 for (auto &C : Conversions) {
1047 if (!C.isInitialized()) return false;
1048 if (C.isAmbiguous()) return true;
1049 }
1050 return false;
1051 }
1052
1053 // An overload is a perfect match if the conversion
1054 // sequences for each argument are perfect.
1055 bool isPerfectMatch(const ASTContext &Ctx) const {
1056 if (!Viable)
1057 return false;
1058 for (const auto &C : Conversions) {
1059 if (!C.isInitialized() || !C.isPerfect(Ctx))
1060 return false;
1061 }
1063 return FinalConversion.isPerfect(Ctx);
1064 return true;
1065 }
1066
1067 bool TryToFixBadConversion(unsigned Idx, Sema &S) {
1068 bool CanFix = Fix.tryToFixConversion(
1069 Conversions[Idx].Bad.FromExpr,
1070 Conversions[Idx].Bad.getFromType(),
1071 Conversions[Idx].Bad.getToType(), S);
1072
1073 // If at least one conversion fails, the candidate cannot be fixed.
1074 if (!CanFix)
1075 Fix.clear();
1076
1077 return CanFix;
1078 }
1079
1080 unsigned getNumParams() const {
1081 if (IsSurrogate) {
1082 QualType STy = Surrogate->getConversionType();
1083 while (STy->isPointerOrReferenceType())
1084 STy = STy->getPointeeType();
1085 return STy->castAs<FunctionProtoType>()->getNumParams();
1086 }
1087 if (Function)
1088 return Function->getNumParams();
1089 return ExplicitCallArguments;
1090 }
1091
1093
1094 private:
1096 OverloadCandidate()
1099 IsADLCandidate(llvm::to_underlying(CallExpr::NotADL)),
1101 };
1102
1104
1105 // intrusive linked list support for allocateDeferredCandidate
1107
1109
1110 LLVM_PREFERRED_TYPE(Kind)
1112 LLVM_PREFERRED_TYPE(bool)
1114 LLVM_PREFERRED_TYPE(bool)
1116 LLVM_PREFERRED_TYPE(bool)
1117 unsigned AllowExplicit : 1;
1118 LLVM_PREFERRED_TYPE(bool)
1120 LLVM_PREFERRED_TYPE(bool)
1122 LLVM_PREFERRED_TYPE(bool)
1124 };
1125
1134 static_assert(std::is_trivially_destructible_v<
1136
1147 static_assert(std::is_trivially_destructible_v<
1149
1158
1159 static_assert(std::is_trivially_destructible_v<
1161
1162 /// OverloadCandidateSet - A set of overload candidates, used in C++
1163 /// overload resolution (C++ 13.3).
1165 public:
1167 /// Normal lookup.
1169
1170 /// C++ [over.match.oper]:
1171 /// Lookup of operator function candidates in a call using operator
1172 /// syntax. Candidates that have no parameters of class type will be
1173 /// skipped unless there is a parameter of (reference to) enum type and
1174 /// the corresponding argument is of the same enum type.
1176
1177 /// C++ [over.match.copy]:
1178 /// Copy-initialization of an object of class type by user-defined
1179 /// conversion.
1181
1182 /// C++ [over.match.ctor], [over.match.list]
1183 /// Initialization of an object of class type by constructor,
1184 /// using either a parenthesized or braced list of arguments.
1186
1187 /// C++ [over.match.call.general]
1188 /// Resolve a call through the address of an overload set.
1190
1191 /// When doing overload resolution during code completion,
1192 /// we want to show all viable candidates, including otherwise
1193 /// deferred template candidates.
1195 };
1196
1197 /// Information about operator rewrites to consider when adding operator
1198 /// functions to a candidate set.
1203 bool AllowRewritten)
1205 AllowRewrittenCandidates(AllowRewritten) {}
1206
1207 /// The original operator as written in the source.
1209 /// The source location of the operator.
1211 /// Whether we should include rewritten candidates in the overload set.
1213
1214 /// Would use of this function result in a rewrite using a different
1215 /// operator?
1216 bool isRewrittenOperator(const FunctionDecl *FD) const {
1217 return OriginalOperator &&
1219 }
1220
1221 bool isAcceptableCandidate(const FunctionDecl *FD) const {
1222 if (!OriginalOperator)
1223 return true;
1224
1225 // For an overloaded operator, we can have candidates with a different
1226 // name in our unqualified lookup set. Make sure we only consider the
1227 // ones we're supposed to.
1230 return OO && (OO == OriginalOperator ||
1233 }
1234
1235 /// Determine the kind of rewrite that should be performed for this
1236 /// candidate.
1246 /// Determines whether this operator could be implemented by a function
1247 /// with reversed parameter order.
1253
1254 /// Determine whether reversing parameter order is allowed for operator
1255 /// Op.
1256 bool allowsReversed(OverloadedOperatorKind Op) const;
1257
1258 /// Determine whether we should add a rewritten candidate for \p FD with
1259 /// reversed parameter order.
1260 /// \param OriginalArgs are the original non reversed arguments.
1261 bool shouldAddReversed(Sema &S, ArrayRef<Expr *> OriginalArgs,
1262 FunctionDecl *FD) const;
1263 };
1264
1265 private:
1268
1269 DeferredTemplateOverloadCandidate *FirstDeferredCandidate = nullptr;
1270 unsigned DeferredCandidatesCount : 8 * sizeof(unsigned) - 2;
1271 LLVM_PREFERRED_TYPE(bool)
1272 unsigned HasDeferredTemplateConstructors : 1;
1273 LLVM_PREFERRED_TYPE(bool)
1274 unsigned ResolutionByPerfectCandidateIsDisabled : 1;
1275
1276 // Allocator for ConversionSequenceLists and deferred candidate args.
1277 // We store the first few of these
1278 // inline to avoid allocation for small sets.
1279 llvm::BumpPtrAllocator SlabAllocator;
1280
1281 SourceLocation Loc;
1282 CandidateSetKind Kind;
1283 OperatorRewriteInfo RewriteInfo;
1284
1285 /// Small storage size for ImplicitConversionSequences
1286 /// and the persisted arguments of deferred candidates.
1287 constexpr static unsigned NumInlineBytes =
1288 32 * sizeof(ImplicitConversionSequence);
1289
1290 unsigned NumInlineBytesUsed = 0;
1291 alignas(void *) char InlineSpace[NumInlineBytes];
1292
1293 // Address space of the object being constructed.
1294 LangAS DestAS = LangAS::Default;
1295
1296 /// If we have space, allocates from inline storage. Otherwise, allocates
1297 /// from the slab allocator.
1298 /// FIXME: It would probably be nice to have a SmallBumpPtrAllocator
1299 /// instead.
1300 template <typename T>
1301 T *slabAllocate(unsigned N) {
1302 // It's simpler if this doesn't need to consider alignment.
1303 static_assert(alignof(T) == alignof(void *),
1304 "Only works for pointer-aligned types.");
1305 static_assert(std::is_trivially_destructible_v<T> ||
1306 (std::is_same_v<ImplicitConversionSequence, T>),
1307 "Add destruction logic to OverloadCandidateSet::clear().");
1308
1309 unsigned NBytes = sizeof(T) * N;
1310 if (NBytes > NumInlineBytes - NumInlineBytesUsed)
1311 return SlabAllocator.Allocate<T>(N);
1312 char *FreeSpaceStart = InlineSpace + NumInlineBytesUsed;
1313 assert(uintptr_t(FreeSpaceStart) % alignof(void *) == 0 &&
1314 "Misaligned storage!");
1315
1316 NumInlineBytesUsed += NBytes;
1317 return reinterpret_cast<T *>(FreeSpaceStart);
1318 }
1319
1320 // Because the size of OverloadCandidateSet has a noticeable impact on
1321 // performance, we store each deferred template candidate in the slab
1322 // allocator such that deferred candidates are ultimately a singly-linked
1323 // intrusive linked list. This ends up being much more efficient than a
1324 // SmallVector that is empty in the common case.
1325 template <typename T> T *allocateDeferredCandidate() {
1326 T *C = slabAllocate<T>(1);
1327 if (!FirstDeferredCandidate)
1328 FirstDeferredCandidate = C;
1329 else {
1330 auto *F = FirstDeferredCandidate;
1331 while (F->Next)
1332 F = F->Next;
1333 F->Next = C;
1334 }
1335 DeferredCandidatesCount++;
1336 return C;
1337 }
1338
1339 void destroyCandidates();
1340
1341 public:
1343 OperatorRewriteInfo RewriteInfo = {})
1344 : FirstDeferredCandidate(nullptr), DeferredCandidatesCount(0),
1345 HasDeferredTemplateConstructors(false),
1346 ResolutionByPerfectCandidateIsDisabled(false), Loc(Loc), Kind(CSK),
1347 RewriteInfo(RewriteInfo) {}
1350 ~OverloadCandidateSet() { destroyCandidates(); }
1351
1352 SourceLocation getLocation() const { return Loc; }
1353 CandidateSetKind getKind() const { return Kind; }
1354 OperatorRewriteInfo getRewriteInfo() const { return RewriteInfo; }
1355
1356 /// Whether diagnostics should be deferred.
1357 bool shouldDeferDiags(Sema &S, ArrayRef<Expr *> Args, SourceLocation OpLoc);
1358
1359 // Whether the resolution of template candidates should be deferred
1360 bool shouldDeferTemplateArgumentDeduction(const Sema &S) const;
1361
1362 /// Determine when this overload candidate will be new to the
1363 /// overload set.
1366 uintptr_t Key = reinterpret_cast<uintptr_t>(F->getCanonicalDecl());
1367 Key |= static_cast<uintptr_t>(PO);
1368 return Functions.insert(Key).second;
1369 }
1370
1371 /// Exclude a function from being considered by overload resolution.
1376
1377 /// Clear out all of the candidates.
1378 void clear(CandidateSetKind CSK);
1379
1382
1383 iterator begin() { return Candidates.begin(); }
1384 iterator end() { return Candidates.end(); }
1385
1386 const_iterator begin() const { return Candidates.begin(); }
1387 const_iterator end() const { return Candidates.end(); }
1388
1389 size_t size() const { return Candidates.size() + DeferredCandidatesCount; }
1390
1391 size_t nonDeferredCandidatesCount() const { return Candidates.size(); }
1392
1393 bool empty() const {
1394 return Candidates.empty() && DeferredCandidatesCount == 0;
1395 }
1396
1397 /// Allocate storage for conversion sequences for NumConversions
1398 /// conversions.
1400 allocateConversionSequences(unsigned NumConversions) {
1401 ImplicitConversionSequence *Conversions =
1402 slabAllocate<ImplicitConversionSequence>(NumConversions);
1403
1404 // Construct the new objects.
1405 for (unsigned I = 0; I != NumConversions; ++I)
1406 new (&Conversions[I]) ImplicitConversionSequence();
1407
1408 return ConversionSequenceList(Conversions, NumConversions);
1409 }
1410
1411 /// Provide storage for any Expr* arg that must be preserved
1412 /// until deferred template candidates are deduced.
1413 /// Typically this should be used for reversed operator arguments
1414 /// and any time the argument array is transformed while adding
1415 /// a template candidate.
1417 Expr **Exprs = slabAllocate<Expr *>(N);
1418 return llvm::MutableArrayRef<Expr *>(Exprs, N);
1419 }
1420
1421 template <typename... T>
1424 getPersistentArgsArray(sizeof...(Exprs));
1425 llvm::copy(std::initializer_list<Expr *>{Exprs...}, Arr.data());
1426 return Arr;
1427 }
1428
1429 /// Add a new candidate with NumConversions conversion sequence slots
1430 /// to the overload set.
1431 OverloadCandidate &addCandidate(unsigned NumConversions = 0,
1432 ConversionSequenceList Conversions = {}) {
1433 assert((Conversions.empty() || Conversions.size() == NumConversions) &&
1434 "preallocated conversion sequence has wrong length");
1435
1436 Candidates.push_back(OverloadCandidate());
1437 OverloadCandidate &C = Candidates.back();
1438 C.Conversions = Conversions.empty()
1439 ? allocateConversionSequences(NumConversions)
1440 : Conversions;
1441 return C;
1442 }
1443
1444 void AddDeferredTemplateCandidate(
1445 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
1446 ArrayRef<Expr *> Args, bool SuppressUserConversions,
1447 bool PartialOverloading, bool AllowExplicit,
1448 CallExpr::ADLCallKind IsADLCandidate, OverloadCandidateParamOrder PO,
1449 bool AggregateCandidateDeduction);
1450
1451 void AddDeferredMethodTemplateCandidate(
1452 FunctionTemplateDecl *MethodTmpl, DeclAccessPair FoundDecl,
1453 CXXRecordDecl *ActingContext, QualType ObjectType,
1454 Expr::Classification ObjectClassification, ArrayRef<Expr *> Args,
1455 bool SuppressUserConversions, bool PartialOverloading,
1456 OverloadCandidateParamOrder PO);
1457
1458 void AddDeferredConversionTemplateCandidate(
1459 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
1460 CXXRecordDecl *ActingContext, Expr *From, QualType ToType,
1461 bool AllowObjCConversionOnExplicit, bool AllowExplicit,
1462 bool AllowResultConversion);
1463
1464 void InjectNonDeducedTemplateCandidates(Sema &S);
1465
1467 ResolutionByPerfectCandidateIsDisabled = true;
1468 }
1469
1470 /// Find the best viable function on this overload set, if it exists.
1471 OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc,
1473
1474 SmallVector<OverloadCandidate *, 32> CompleteCandidates(
1477 llvm::function_ref<bool(OverloadCandidate &)> Filter =
1478 [](OverloadCandidate &) { return true; });
1479
1480 void NoteCandidates(
1481 PartialDiagnosticAt PA, Sema &S, OverloadCandidateDisplayKind OCD,
1482 ArrayRef<Expr *> Args, StringRef Opc = "",
1483 SourceLocation Loc = SourceLocation(),
1484 llvm::function_ref<bool(OverloadCandidate &)> Filter =
1485 [](OverloadCandidate &) { return true; });
1486
1487 void NoteCandidates(Sema &S, ArrayRef<Expr *> Args,
1488 ArrayRef<OverloadCandidate *> Cands,
1489 StringRef Opc = "",
1490 SourceLocation OpLoc = SourceLocation());
1491
1492 LangAS getDestAS() { return DestAS; }
1493
1495 assert((Kind == CSK_InitByConstructor ||
1497 "can't set the destination address space when not constructing an "
1498 "object");
1499 DestAS = AS;
1500 }
1501
1502 private:
1503 OverloadingResult ResultForBestCandidate(const iterator &Best);
1504 void CudaExcludeWrongSideCandidates(
1507 BestViableFunctionImpl(Sema &S, SourceLocation Loc,
1509 };
1510
1511 bool isBetterOverloadCandidate(Sema &S, const OverloadCandidate &Cand1,
1512 const OverloadCandidate &Cand2,
1513 SourceLocation Loc,
1515 bool PartialOverloading = false);
1516
1524
1525 // FIXME: Add an AddOverloadCandidate / AddTemplateOverloadCandidate overload
1526 // that takes one of these.
1528 if (isa<UsingDecl>(ND))
1529 return ConstructorInfo{};
1530
1531 // For constructors, the access check is performed against the underlying
1532 // declaration, not the found declaration.
1533 auto *D = ND->getUnderlyingDecl();
1534 ConstructorInfo Info = {DeclAccessPair::make(ND, D->getAccess()), nullptr,
1535 nullptr};
1536 Info.ConstructorTmpl = dyn_cast<FunctionTemplateDecl>(D);
1537 if (Info.ConstructorTmpl)
1539 Info.Constructor = dyn_cast<CXXConstructorDecl>(D);
1540 return Info;
1541 }
1542
1543 // Returns false if signature help is relevant despite number of arguments
1544 // exceeding parameters. Specifically, it returns false when
1545 // PartialOverloading is true and one of the following:
1546 // * Function is variadic
1547 // * Function is template variadic
1548 // * Function is an instantiation of template variadic function
1549 // The last case may seem strange. The idea is that if we added one more
1550 // argument, we'd end up with a function similar to Function. Since, in the
1551 // context of signature help and/or code completion, we do not know what the
1552 // type of the next argument (that the user is typing) will be, this is as
1553 // good candidate as we can get, despite the fact that it takes one less
1554 // parameter.
1555 bool shouldEnforceArgLimit(bool PartialOverloading, FunctionDecl *Function);
1556} // namespace clang
1557
1558#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:124
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:239
Represents a C++ constructor within a class.
Definition DeclCXX.h:2642
Represents a C++ conversion function within a class.
Definition DeclCXX.h:2977
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:2987
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:515
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition DeclBase.h:995
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:340
This represents one expression.
Definition Expr.h:113
QualType getType() const
Definition Expr.h:145
Represents a function declaration or definition.
Definition Decl.h:2059
Represents a prototype with parameter type info, e.g.
Definition TypeBase.h:5416
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:626
void dump() const
dump - Print this implicit conversion sequence to standard error.
ImplicitConversionSequence & operator=(const ImplicitConversionSequence &Other)
Definition Overload.h:716
Kind
Kind - The kind of implicit conversion sequence.
Definition Overload.h:635
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:807
StandardConversionSequence Standard
When ConversionKind == StandardConversion, provides the details of the standard conversion sequence.
Definition Overload.h:677
void setBad(BadConversionSequence::FailureKind Failure, Expr *FromExpr, QualType ToType)
Sets this sequence as a bad conversion for an explicit argument.
Definition Overload.h:774
UserDefinedConversionSequence UserDefined
When ConversionKind == UserDefinedConversion, provides the details of the user-defined conversion seq...
Definition Overload.h:681
ImplicitConversionSequence(const ImplicitConversionSequence &Other)
Definition Overload.h:698
bool isInitialized() const
Determines whether this conversion sequence has been initialized.
Definition Overload.h:771
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:831
AmbiguousConversionSequence Ambiguous
When ConversionKind == AmbiguousConversion, provides the details of the ambiguous conversion.
Definition Overload.h:685
void setInitializerListContainerType(QualType T, bool IA)
Definition Overload.h:816
bool hasInitializerListContainerType() const
Definition Overload.h:813
unsigned getKindRank() const
Return a ranking of the implicit conversion sequence kind, where smaller ranks represent better conve...
Definition Overload.h:738
bool isInitializerListOfIncompleteArray() const
Definition Overload.h:820
BadConversionSequence Bad
When ConversionKind == BadConversion, provides the details of the bad conversion.
Definition Overload.h:689
QualType getInitializerListContainerType() const
Definition Overload.h:823
void setAsIdentityConversion(QualType T)
Definition Overload.h:798
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:781
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:275
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
Definition Decl.h:488
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition Decl.h:341
const_iterator end() const
Definition Overload.h:1387
llvm::MutableArrayRef< Expr * > getPersistentArgsArray(T *...Exprs)
Definition Overload.h:1422
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:1364
void DisableResolutionByPerfectCandidate()
Definition Overload.h:1466
void setDestAS(LangAS AS)
Definition Overload.h:1494
ConversionSequenceList allocateConversionSequences(unsigned NumConversions)
Allocate storage for conversion sequences for NumConversions conversions.
Definition Overload.h:1400
OverloadCandidateSet(SourceLocation Loc, CandidateSetKind CSK, OperatorRewriteInfo RewriteInfo={})
Definition Overload.h:1342
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:1416
OperatorRewriteInfo getRewriteInfo() const
Definition Overload.h:1354
@ CSK_AddressOfOverloadSet
C++ [over.match.call.general] Resolve a call through the address of an overload set.
Definition Overload.h:1189
@ CSK_InitByConstructor
C++ [over.match.ctor], [over.match.list] Initialization of an object of class type by constructor,...
Definition Overload.h:1185
@ CSK_InitByUserDefinedConversion
C++ [over.match.copy]: Copy-initialization of an object of class type by user-defined conversion.
Definition Overload.h:1180
@ CSK_Normal
Normal lookup.
Definition Overload.h:1168
@ CSK_Operator
C++ [over.match.oper]: Lookup of operator function candidates in a call using operator syntax.
Definition Overload.h:1175
@ CSK_CodeCompletion
When doing overload resolution during code completion, we want to show all viable candidates,...
Definition Overload.h:1194
SmallVectorImpl< OverloadCandidate >::iterator iterator
Definition Overload.h:1380
OverloadCandidateSet(const OverloadCandidateSet &)=delete
const_iterator begin() const
Definition Overload.h:1386
void exclude(Decl *F)
Exclude a function from being considered by overload resolution.
Definition Overload.h:1372
SourceLocation getLocation() const
Definition Overload.h:1352
OverloadCandidate & addCandidate(unsigned NumConversions=0, ConversionSequenceList Conversions={})
Add a new candidate with NumConversions conversion sequence slots to the overload set.
Definition Overload.h:1431
CandidateSetKind getKind() const
Definition Overload.h:1353
size_t nonDeferredCandidatesCount() const
Definition Overload.h:1391
SmallVectorImpl< OverloadCandidate >::const_iterator const_iterator
Definition Overload.h:1381
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:863
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:9366
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
Definition Type.cpp:883
bool isPointerOrReferenceType() const
Definition TypeBase.h:8687
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:863
@ ovl_fail_final_conversion_not_exact
This conversion function template specialization candidate is not viable because the final conversion...
Definition Overload.h:891
@ ovl_fail_enable_if
This candidate function was not viable because an enable_if attribute disabled it.
Definition Overload.h:900
@ ovl_fail_illegal_constructor
This conversion candidate was not considered because it is an illegal instantiation of a constructor ...
Definition Overload.h:883
@ ovl_fail_bad_final_conversion
This conversion candidate is not viable because its result type is not implicitly convertible to the ...
Definition Overload.h:887
@ 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:928
@ ovl_fail_too_few_arguments
Definition Overload.h:865
@ ovl_fail_addr_not_available
This candidate was not viable because its address could not be taken.
Definition Overload.h:907
@ ovl_fail_too_many_arguments
Definition Overload.h:864
@ ovl_non_default_multiversion_function
This candidate was not viable because it is a non-default multiversioned function.
Definition Overload.h:915
@ ovl_fail_constraints_not_satisfied
This candidate was not viable because its associated constraints were not satisfied.
Definition Overload.h:924
@ ovl_fail_bad_conversion
Definition Overload.h:866
@ ovl_fail_bad_target
(CUDA) This candidate was not viable because the callee was not accessible from the caller's target (...
Definition Overload.h:896
@ ovl_fail_bad_deduction
Definition Overload.h:867
@ ovl_fail_inhctor_slice
This inherited constructor is not viable because it would slice the argument.
Definition Overload.h:911
@ ovl_fail_object_addrspace_mismatch
This constructor/conversion candidate fail due to an address space mismatch between the object being ...
Definition Overload.h:920
@ ovl_fail_explicit
This candidate constructor or conversion function is explicit but the context doesn't permit explicit...
Definition Overload.h:904
@ ovl_fail_trivial_conversion
This conversion candidate was not considered because it duplicates the work of a trivial or derived-t...
Definition Overload.h:872
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:933
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:1527
ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind)
GetConversionRank - Retrieve the implicit conversion rank corresponding to the given implicit convers...
@ Other
Other implicit parameter.
Definition Decl.h:1775
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:619
void setFromType(QualType T)
Definition Overload.h:618
void init(FailureKind K, Expr *From, QualType To)
Definition Overload.h:598
void init(FailureKind K, QualType From, QualType To)
Definition Overload.h:603
QualType getToType() const
Definition Overload.h:611
QualType getFromType() const
Definition Overload.h:610
FunctionTemplateDecl * ConstructorTmpl
Definition Overload.h:1520
CXXConstructorDecl * Constructor
Definition Overload.h:1519
DeclAccessPair FoundDecl
Definition Overload.h:1518
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:1106
Information about operator rewrites to consider when adding operator functions to a candidate set.
Definition Overload.h:1199
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:1216
OperatorRewriteInfo(OverloadedOperatorKind Op, SourceLocation OpLoc, bool AllowRewritten)
Definition Overload.h:1202
bool isAcceptableCandidate(const FunctionDecl *FD) const
Definition Overload.h:1221
bool isReversible() const
Determines whether this operator could be implemented by a function with reversed parameter order.
Definition Overload.h:1248
SourceLocation OpLoc
The source location of the operator.
Definition Overload.h:1210
bool AllowRewrittenCandidates
Whether we should include rewritten candidates in the overload set.
Definition Overload.h:1212
OverloadedOperatorKind OriginalOperator
The original operator as written in the source.
Definition Overload.h:1208
OverloadCandidateRewriteKind getRewriteKind(const FunctionDecl *FD, OverloadCandidateParamOrder PO)
Determine the kind of rewrite that should be performed for this candidate.
Definition Overload.h:1238
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
Definition Overload.h:937
unsigned StrictPackMatch
Have we matched any packs on the parameter side, versus any non-packs on the argument side,...
Definition Overload.h:1002
unsigned IgnoreObjectArgument
IgnoreObjectArgument - True to indicate that the first argument's conversion, which for this function...
Definition Overload.h:993
bool TryToFixBadConversion(unsigned Idx, Sema &S)
Definition Overload.h:1067
bool NotValidBecauseConstraintExprHasError() const
bool isReversed() const
Definition Overload.h:1041
unsigned IsADLCandidate
True if the candidate was found using ADL.
Definition Overload.h:1006
unsigned IsSurrogate
IsSurrogate - True to indicate that this candidate is a surrogate for a conversion to a function poin...
Definition Overload.h:983
QualType BuiltinParamTypes[3]
BuiltinParamTypes - Provides the parameter types of a built-in overload candidate.
Definition Overload.h:951
bool hasAmbiguousConversion() const
hasAmbiguousConversion - Returns whether this overload candidate requires an ambiguous conversion or ...
Definition Overload.h:1045
DeclAccessPair FoundDecl
FoundDecl - The original declaration that was looked up / invented / otherwise found,...
Definition Overload.h:947
FunctionDecl * Function
Function - The actual function that this candidate represents.
Definition Overload.h:942
unsigned RewriteKind
Whether this is a rewritten candidate, and if so, of what kind?
Definition Overload.h:1014
ConversionFixItGenerator Fix
The FixIt hints which can be used to fix the Bad candidate.
Definition Overload.h:963
unsigned Best
Whether this candidate is the best viable function, or tied for being the best viable function.
Definition Overload.h:977
StandardConversionSequence FinalConversion
FinalConversion - For a conversion function (where Function is a CXXConversionDecl),...
Definition Overload.h:1032
unsigned getNumParams() const
Definition Overload.h:1080
unsigned HasFinalConversion
Whether FinalConversion has been set.
Definition Overload.h:1010
unsigned TookAddressOfOverload
Definition Overload.h:996
unsigned FailureKind
FailureKind - The reason why this candidate is not viable.
Definition Overload.h:1019
unsigned ExplicitCallArguments
The number of call arguments that were explicitly provided, to be used while performing partial order...
Definition Overload.h:1023
ConversionSequenceList Conversions
The conversion sequences used to convert the function arguments to the function parameters.
Definition Overload.h:960
friend class OverloadCandidateSet
Definition Overload.h:1095
DeductionFailureInfo DeductionFailure
Definition Overload.h:1026
unsigned Viable
Viable - True to indicate that this overload candidate is viable.
Definition Overload.h:967
bool isPerfectMatch(const ASTContext &Ctx) const
Definition Overload.h:1055
CXXConversionDecl * Surrogate
Surrogate - The conversion function for which this candidate is a surrogate, but only if IsSurrogate ...
Definition Overload.h:955
OverloadCandidateRewriteKind getRewriteKind() const
Get RewriteKind value in OverloadCandidateRewriteKind type (This function is to workaround the spurio...
Definition Overload.h:1037
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.