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