clang  14.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"
21 #include "clang/AST/DeclTemplate.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/None.h"
30 #include "llvm/ADT/STLExtras.h"
31 #include "llvm/ADT/SmallPtrSet.h"
32 #include "llvm/ADT/SmallVector.h"
33 #include "llvm/ADT/StringRef.h"
34 #include "llvm/Support/AlignOf.h"
35 #include "llvm/Support/Allocator.h"
36 #include "llvm/Support/Casting.h"
37 #include "llvm/Support/ErrorHandling.h"
38 #include <cassert>
39 #include <cstddef>
40 #include <cstdint>
41 #include <utility>
42 
43 namespace clang {
44 
45 class APValue;
46 class ASTContext;
47 class Sema;
48 
49  /// OverloadingResult - Capture the result of performing overload
50  /// resolution.
52  /// Overload resolution succeeded.
54 
55  /// No viable function found.
57 
58  /// Ambiguous candidates found.
60 
61  /// Succeeded, but refers to a deleted function.
63  };
64 
66  /// Requests that all candidates be shown. Viable candidates will
67  /// be printed first.
69 
70  /// Requests that only viable candidates be shown.
72 
73  /// Requests that only tied-for-best candidates be shown.
75  };
76 
77  /// The parameter ordering that will be used for the candidate. This is
78  /// used to represent C++20 binary operator rewrites that reverse the order
79  /// of the arguments. If the parameter ordering is Reversed, the Args list is
80  /// reversed (but obviously the ParamDecls for the function are not).
81  ///
82  /// After forming an OverloadCandidate with reversed parameters, the list
83  /// of conversions will (as always) be indexed by argument, so will be
84  /// in reverse parameter order.
86 
87  /// The kinds of rewrite we perform on overload candidates. Note that the
88  /// values here are chosen to serve as both bitflags and as a rank (lower
89  /// values are preferred by overload resolution).
90  enum OverloadCandidateRewriteKind : unsigned {
91  /// Candidate is not a rewritten candidate.
92  CRK_None = 0x0,
93 
94  /// Candidate is a rewritten candidate with a different operator name.
96 
97  /// Candidate is a rewritten candidate with a reversed order of parameters.
98  CRK_Reversed = 0x2,
99  };
100 
101  /// ImplicitConversionKind - The kind of implicit conversion used to
102  /// convert an argument to a parameter's type. The enumerator values
103  /// match with the table titled 'Conversions' in [over.ics.scs] and are listed
104  /// such that better conversion kinds have smaller values.
106  /// Identity conversion (no conversion)
108 
109  /// Lvalue-to-rvalue conversion (C++ [conv.lval])
111 
112  /// Array-to-pointer conversion (C++ [conv.array])
114 
115  /// Function-to-pointer (C++ [conv.array])
117 
118  /// Function pointer conversion (C++17 [conv.fctptr])
120 
121  /// Qualification conversions (C++ [conv.qual])
123 
124  /// Integral promotions (C++ [conv.prom])
126 
127  /// Floating point promotions (C++ [conv.fpprom])
129 
130  /// Complex promotions (Clang extension)
132 
133  /// Integral conversions (C++ [conv.integral])
135 
136  /// Floating point conversions (C++ [conv.double]
138 
139  /// Complex conversions (C99 6.3.1.6)
141 
142  /// Floating-integral conversions (C++ [conv.fpint])
144 
145  /// Pointer conversions (C++ [conv.ptr])
147 
148  /// Pointer-to-member conversions (C++ [conv.mem])
150 
151  /// Boolean conversions (C++ [conv.bool])
153 
154  /// Conversions between compatible types in C99
156 
157  /// Derived-to-base (C++ [over.best.ics])
159 
160  /// Vector conversions
162 
163  /// Arm SVE Vector conversions
165 
166  /// A vector splat from an arithmetic type
168 
169  /// Complex-real conversions (C99 6.3.1.7)
171 
172  /// Block Pointer conversions
174 
175  /// Transparent Union Conversions
177 
178  /// Objective-C ARC writeback conversion
180 
181  /// Zero constant to event (OpenCL1.2 6.12.10)
183 
184  /// Zero constant to queue
186 
187  /// Conversions allowed in C, but not C++
189 
190  /// C-only conversion between pointers with incompatible types
192 
193  /// The number of conversion kinds
195  };
196 
197  /// ImplicitConversionRank - The rank of an implicit conversion
198  /// kind. The enumerator values match with Table 9 of (C++
199  /// 13.3.3.1.1) and are listed such that better conversion ranks
200  /// have smaller values.
202  /// Exact Match
204 
205  /// Promotion
207 
208  /// Conversion
210 
211  /// OpenCL Scalar Widening
213 
214  /// Complex <-> Real conversion
216 
217  /// ObjC ARC writeback conversion
219 
220  /// Conversion only allowed in the C standard (e.g. void* to char*).
222 
223  /// Conversion not allowed by the C standard, but that we accept as an
224  /// extension anyway.
226  };
227 
229 
230  /// NarrowingKind - The kind of narrowing conversion being performed by a
231  /// standard conversion sequence according to C++11 [dcl.init.list]p7.
233  /// Not a narrowing conversion.
235 
236  /// A narrowing conversion by virtue of the source and destination types.
238 
239  /// A narrowing conversion, because a constant expression got narrowed.
241 
242  /// A narrowing conversion, because a non-constant-expression variable might
243  /// have got narrowed.
245 
246  /// Cannot tell whether this is a narrowing conversion because the
247  /// expression is value-dependent.
249  };
250 
251  /// StandardConversionSequence - represents a standard conversion
252  /// sequence (C++ 13.3.3.1.1). A standard conversion sequence
253  /// contains between zero and three conversions. If a particular
254  /// conversion is not needed, it will be set to the identity conversion
255  /// (ICK_Identity). Note that the three conversions are
256  /// specified as separate members (rather than in an array) so that
257  /// we can keep the size of a standard conversion sequence to a
258  /// single word.
260  public:
261  /// First -- The first conversion can be an lvalue-to-rvalue
262  /// conversion, array-to-pointer conversion, or
263  /// function-to-pointer conversion.
265 
266  /// Second - The second conversion can be an integral promotion,
267  /// floating point promotion, integral conversion, floating point
268  /// conversion, floating-integral conversion, pointer conversion,
269  /// pointer-to-member conversion, or boolean conversion.
271 
272  /// Third - The third conversion can be a qualification conversion
273  /// or a function conversion.
275 
276  /// Whether this is the deprecated conversion of a
277  /// string literal to a pointer to non-const character data
278  /// (C++ 4.2p2).
280 
281  /// Whether the qualification conversion involves a change in the
282  /// Objective-C lifetime (for automatic reference counting).
284 
285  /// IncompatibleObjC - Whether this is an Objective-C conversion
286  /// that we should warn about (if we actually use it).
287  unsigned IncompatibleObjC : 1;
288 
289  /// ReferenceBinding - True when this is a reference binding
290  /// (C++ [over.ics.ref]).
291  unsigned ReferenceBinding : 1;
292 
293  /// DirectBinding - True when this is a reference binding that is a
294  /// direct binding (C++ [dcl.init.ref]).
295  unsigned DirectBinding : 1;
296 
297  /// Whether this is an lvalue reference binding (otherwise, it's
298  /// an rvalue reference binding).
299  unsigned IsLvalueReference : 1;
300 
301  /// Whether we're binding to a function lvalue.
302  unsigned BindsToFunctionLvalue : 1;
303 
304  /// Whether we're binding to an rvalue.
305  unsigned BindsToRvalue : 1;
306 
307  /// Whether this binds an implicit object argument to a
308  /// non-static member function without a ref-qualifier.
310 
311  /// Whether this binds a reference to an object with a different
312  /// Objective-C lifetime qualifier.
314 
315  /// FromType - The type that this conversion is converting
316  /// from. This is an opaque pointer that can be translated into a
317  /// QualType.
318  void *FromTypePtr;
319 
320  /// ToType - The types that this conversion is converting to in
321  /// each step. This is an opaque pointer that can be translated
322  /// into a QualType.
323  void *ToTypePtrs[3];
324 
325  /// CopyConstructor - The copy constructor that is used to perform
326  /// this conversion, when the conversion is actually just the
327  /// initialization of an object via copy constructor. Such
328  /// conversions are either identity conversions or derived-to-base
329  /// conversions.
332 
334 
335  void setToType(unsigned Idx, QualType T) {
336  assert(Idx < 3 && "To type index is out of range");
337  ToTypePtrs[Idx] = T.getAsOpaquePtr();
338  }
339 
341  ToTypePtrs[0] = T.getAsOpaquePtr();
342  ToTypePtrs[1] = ToTypePtrs[0];
343  ToTypePtrs[2] = ToTypePtrs[0];
344  }
345 
348  }
349 
350  QualType getToType(unsigned Idx) const {
351  assert(Idx < 3 && "To type index is out of range");
353  }
354 
356 
357  bool isIdentityConversion() const {
358  return Second == ICK_Identity && Third == ICK_Identity;
359  }
360 
363  getNarrowingKind(ASTContext &Context, const Expr *Converted,
364  APValue &ConstantValue, QualType &ConstantType,
365  bool IgnoreFloatToIntegralConversion = false) const;
366  bool isPointerConversionToBool() const;
367  bool isPointerConversionToVoidPointer(ASTContext& Context) const;
368  void dump() const;
369  };
370 
371  /// UserDefinedConversionSequence - Represents a user-defined
372  /// conversion sequence (C++ 13.3.3.1.2).
374  /// Represents the standard conversion that occurs before
375  /// the actual user-defined conversion.
376  ///
377  /// C++11 13.3.3.1.2p1:
378  /// If the user-defined conversion is specified by a constructor
379  /// (12.3.1), the initial standard conversion sequence converts
380  /// the source type to the type required by the argument of the
381  /// constructor. If the user-defined conversion is specified by
382  /// a conversion function (12.3.2), the initial standard
383  /// conversion sequence converts the source type to the implicit
384  /// object parameter of the conversion function.
386 
387  /// EllipsisConversion - When this is true, it means user-defined
388  /// conversion sequence starts with a ... (ellipsis) conversion, instead of
389  /// a standard conversion. In this case, 'Before' field must be ignored.
390  // FIXME. I much rather put this as the first field. But there seems to be
391  // a gcc code gen. bug which causes a crash in a test. Putting it here seems
392  // to work around the crash.
394 
395  /// HadMultipleCandidates - When this is true, it means that the
396  /// conversion function was resolved from an overloaded set having
397  /// size greater than 1.
399 
400  /// After - Represents the standard conversion that occurs after
401  /// the actual user-defined conversion.
403 
404  /// ConversionFunction - The function that will perform the
405  /// user-defined conversion. Null if the conversion is an
406  /// aggregate initialization from an initializer list.
408 
409  /// The declaration that we found via name lookup, which might be
410  /// the same as \c ConversionFunction or it might be a using declaration
411  /// that refers to \c ConversionFunction.
413 
414  void dump() const;
415  };
416 
417  /// Represents an ambiguous user-defined conversion sequence.
419  using ConversionSet =
421 
422  void *FromTypePtr;
423  void *ToTypePtr;
424  char Buffer[sizeof(ConversionSet)];
425 
428  }
429 
430  QualType getToType() const {
432  }
433 
436 
438  return *reinterpret_cast<ConversionSet*>(Buffer);
439  }
440 
441  const ConversionSet &conversions() const {
442  return *reinterpret_cast<const ConversionSet*>(Buffer);
443  }
444 
446  conversions().push_back(std::make_pair(Found, D));
447  }
448 
449  using iterator = ConversionSet::iterator;
450 
451  iterator begin() { return conversions().begin(); }
452  iterator end() { return conversions().end(); }
453 
454  using const_iterator = ConversionSet::const_iterator;
455 
456  const_iterator begin() const { return conversions().begin(); }
457  const_iterator end() const { return conversions().end(); }
458 
459  void construct();
460  void destruct();
462  };
463 
464  /// BadConversionSequence - Records information about an invalid
465  /// conversion sequence.
467  enum FailureKind {
475  };
476 
477  // This can be null, e.g. for implicit object arguments.
479 
481 
482  private:
483  // The type we're converting from (an opaque QualType).
484  void *FromTy;
485 
486  // The type we're converting to (an opaque QualType).
487  void *ToTy;
488 
489  public:
490  void init(FailureKind K, Expr *From, QualType To) {
491  init(K, From->getType(), To);
492  FromExpr = From;
493  }
494 
495  void init(FailureKind K, QualType From, QualType To) {
496  Kind = K;
497  FromExpr = nullptr;
498  setFromType(From);
499  setToType(To);
500  }
501 
502  QualType getFromType() const { return QualType::getFromOpaquePtr(FromTy); }
504 
505  void setFromExpr(Expr *E) {
506  FromExpr = E;
507  setFromType(E->getType());
508  }
509 
510  void setFromType(QualType T) { FromTy = T.getAsOpaquePtr(); }
511  void setToType(QualType T) { ToTy = T.getAsOpaquePtr(); }
512  };
513 
514  /// ImplicitConversionSequence - Represents an implicit conversion
515  /// sequence, which may be a standard conversion sequence
516  /// (C++ 13.3.3.1.1), user-defined conversion sequence (C++ 13.3.3.1.2),
517  /// or an ellipsis conversion sequence (C++ 13.3.3.1.3).
519  public:
520  /// Kind - The kind of implicit conversion sequence. BadConversion
521  /// specifies that there is no conversion from the source type to
522  /// the target type. AmbiguousConversion represents the unique
523  /// ambiguous conversion (C++0x [over.best.ics]p10).
524  enum Kind {
530  };
531 
532  private:
533  enum {
534  Uninitialized = BadConversion + 1
535  };
536 
537  /// ConversionKind - The kind of implicit conversion sequence.
538  unsigned ConversionKind : 31;
539 
540  // Whether the initializer list was of an incomplete array.
541  unsigned InitializerListOfIncompleteArray : 1;
542 
543  /// When initializing an array or std::initializer_list from an
544  /// initializer-list, this is the array or std::initializer_list type being
545  /// initialized. The remainder of the conversion sequence, including ToType,
546  /// describe the worst conversion of an initializer to an element of the
547  /// array or std::initializer_list. (Note, 'worst' is not well defined.)
548  QualType InitializerListContainerType;
549 
550  void setKind(Kind K) {
551  destruct();
552  ConversionKind = K;
553  }
554 
555  void destruct() {
556  if (ConversionKind == AmbiguousConversion) Ambiguous.destruct();
557  }
558 
559  public:
560  union {
561  /// When ConversionKind == StandardConversion, provides the
562  /// details of the standard conversion sequence.
564 
565  /// When ConversionKind == UserDefinedConversion, provides the
566  /// details of the user-defined conversion sequence.
568 
569  /// When ConversionKind == AmbiguousConversion, provides the
570  /// details of the ambiguous conversion.
572 
573  /// When ConversionKind == BadConversion, provides the details
574  /// of the bad conversion.
576  };
577 
579  : ConversionKind(Uninitialized),
580  InitializerListOfIncompleteArray(false),
581  InitializerListContainerType() {
583  }
584 
586  : ConversionKind(Other.ConversionKind),
587  InitializerListOfIncompleteArray(
588  Other.InitializerListOfIncompleteArray),
589  InitializerListContainerType(Other.InitializerListContainerType) {
590  switch (ConversionKind) {
591  case Uninitialized: break;
592  case StandardConversion: Standard = Other.Standard; break;
593  case UserDefinedConversion: UserDefined = Other.UserDefined; break;
594  case AmbiguousConversion: Ambiguous.copyFrom(Other.Ambiguous); break;
595  case EllipsisConversion: break;
596  case BadConversion: Bad = Other.Bad; break;
597  }
598  }
599 
602  destruct();
603  new (this) ImplicitConversionSequence(Other);
604  return *this;
605  }
606 
608  destruct();
609  }
610 
611  Kind getKind() const {
612  assert(isInitialized() && "querying uninitialized conversion");
613  return Kind(ConversionKind);
614  }
615 
616  /// Return a ranking of the implicit conversion sequence
617  /// kind, where smaller ranks represent better conversion
618  /// sequences.
619  ///
620  /// In particular, this routine gives user-defined conversion
621  /// sequences and ambiguous conversion sequences the same rank,
622  /// per C++ [over.best.ics]p10.
623  unsigned getKindRank() const {
624  switch (getKind()) {
625  case StandardConversion:
626  return 0;
627 
629  case AmbiguousConversion:
630  return 1;
631 
632  case EllipsisConversion:
633  return 2;
634 
635  case BadConversion:
636  return 3;
637  }
638 
639  llvm_unreachable("Invalid ImplicitConversionSequence::Kind!");
640  }
641 
642  bool isBad() const { return getKind() == BadConversion; }
643  bool isStandard() const { return getKind() == StandardConversion; }
644  bool isEllipsis() const { return getKind() == EllipsisConversion; }
645  bool isAmbiguous() const { return getKind() == AmbiguousConversion; }
646  bool isUserDefined() const { return getKind() == UserDefinedConversion; }
647  bool isFailure() const { return isBad() || isAmbiguous(); }
648 
649  /// Determines whether this conversion sequence has been
650  /// initialized. Most operations should never need to query
651  /// uninitialized conversions and should assert as above.
652  bool isInitialized() const { return ConversionKind != Uninitialized; }
653 
654  /// Sets this sequence as a bad conversion for an explicit argument.
656  Expr *FromExpr, QualType ToType) {
657  setKind(BadConversion);
658  Bad.init(Failure, FromExpr, ToType);
659  }
660 
661  /// Sets this sequence as a bad conversion for an implicit argument.
663  QualType FromType, QualType ToType) {
664  setKind(BadConversion);
665  Bad.init(Failure, FromType, ToType);
666  }
667 
668  void setStandard() { setKind(StandardConversion); }
669  void setEllipsis() { setKind(EllipsisConversion); }
671 
672  void setAmbiguous() {
673  if (ConversionKind == AmbiguousConversion) return;
674  ConversionKind = AmbiguousConversion;
676  }
677 
679  setStandard();
683  }
684 
685  // True iff this is a conversion sequence from an initializer list to an
686  // array or std::initializer.
688  return !InitializerListContainerType.isNull();
689  }
691  InitializerListContainerType = T;
692  InitializerListOfIncompleteArray = IA;
693  }
695  return InitializerListOfIncompleteArray;
696  }
699  "not initializer list container");
700  return InitializerListContainerType;
701  }
702 
703  /// Form an "implicit" conversion sequence from nullptr_t to bool, for a
704  /// direct-initialization of a bool object from nullptr_t.
706  QualType DestType,
707  bool NeedLValToRVal) {
709  ICS.setStandard();
711  ICS.Standard.setFromType(SourceType);
712  if (NeedLValToRVal)
714  ICS.Standard.setToType(0, SourceType);
716  ICS.Standard.setToType(1, DestType);
717  ICS.Standard.setToType(2, DestType);
718  return ICS;
719  }
720 
721  // The result of a comparison between implicit conversion
722  // sequences. Use Sema::CompareImplicitConversionSequences to
723  // actually perform the comparison.
724  enum CompareKind {
725  Better = -1,
727  Worse = 1
728  };
729 
731  SourceLocation CaretLoc,
732  const PartialDiagnostic &PDiag) const;
733 
734  void dump() const;
735  };
736 
742 
743  /// This conversion candidate was not considered because it
744  /// duplicates the work of a trivial or derived-to-base
745  /// conversion.
747 
748  /// This conversion candidate was not considered because it is
749  /// an illegal instantiation of a constructor temploid: it is
750  /// callable with one argument, we only have one argument, and
751  /// its first parameter type is exactly the type of the class.
752  ///
753  /// Defining such a constructor directly is illegal, and
754  /// template-argument deduction is supposed to ignore such
755  /// instantiations, but we can still get one with the right
756  /// kind of implicit instantiation.
758 
759  /// This conversion candidate is not viable because its result
760  /// type is not implicitly convertible to the desired type.
762 
763  /// This conversion function template specialization candidate is not
764  /// viable because the final conversion was not an exact match.
766 
767  /// (CUDA) This candidate was not viable because the callee
768  /// was not accessible from the caller's target (i.e. host->device,
769  /// global->host, device->host).
771 
772  /// This candidate function was not viable because an enable_if
773  /// attribute disabled it.
775 
776  /// This candidate constructor or conversion function is explicit but
777  /// the context doesn't permit explicit functions.
779 
780  /// This candidate was not viable because its address could not be taken.
782 
783  /// This inherited constructor is not viable because it would slice the
784  /// argument.
786 
787  /// This candidate was not viable because it is a non-default multiversioned
788  /// function.
790 
791  /// This constructor/conversion candidate fail due to an address space
792  /// mismatch between the object being constructed and the overload
793  /// candidate.
795 
796  /// This candidate was not viable because its associated constraints were
797  /// not satisfied.
799  };
800 
801  /// A list of implicit conversion sequences for the arguments of an
802  /// OverloadCandidate.
803  using ConversionSequenceList =
805 
806  /// OverloadCandidate - A single candidate in an overload set (C++ 13.3).
808  /// Function - The actual function that this candidate
809  /// represents. When NULL, this is a built-in candidate
810  /// (C++ [over.oper]) or a surrogate for a conversion to a
811  /// function pointer or reference (C++ [over.call.object]).
813 
814  /// FoundDecl - The original declaration that was looked up /
815  /// invented / otherwise found, together with its access.
816  /// Might be a UsingShadowDecl or a FunctionTemplateDecl.
818 
819  /// BuiltinParamTypes - Provides the parameter types of a built-in overload
820  /// candidate. Only valid when Function is NULL.
822 
823  /// Surrogate - The conversion function for which this candidate
824  /// is a surrogate, but only if IsSurrogate is true.
826 
827  /// The conversion sequences used to convert the function arguments
828  /// to the function parameters. Note that these are indexed by argument,
829  /// so may not match the parameter order of Function.
831 
832  /// The FixIt hints which can be used to fix the Bad candidate.
834 
835  /// Viable - True to indicate that this overload candidate is viable.
836  bool Viable : 1;
837 
838  /// Whether this candidate is the best viable function, or tied for being
839  /// the best viable function.
840  ///
841  /// For an ambiguous overload resolution, indicates whether this candidate
842  /// was part of the ambiguity kernel: the minimal non-empty set of viable
843  /// candidates such that all elements of the ambiguity kernel are better
844  /// than all viable candidates not in the ambiguity kernel.
845  bool Best : 1;
846 
847  /// IsSurrogate - True to indicate that this candidate is a
848  /// surrogate for a conversion to a function pointer or reference
849  /// (C++ [over.call.object]).
850  bool IsSurrogate : 1;
851 
852  /// IgnoreObjectArgument - True to indicate that the first
853  /// argument's conversion, which for this function represents the
854  /// implicit object argument, should be ignored. This will be true
855  /// when the candidate is a static member function (where the
856  /// implicit object argument is just a placeholder) or a
857  /// non-static member function when the call doesn't have an
858  /// object argument.
860 
861  /// True if the candidate was found using ADL.
863 
864  /// Whether this is a rewritten candidate, and if so, of what kind?
865  unsigned RewriteKind : 2;
866 
867  /// FailureKind - The reason why this candidate is not viable.
868  /// Actually an OverloadFailureKind.
869  unsigned char FailureKind;
870 
871  /// The number of call arguments that were explicitly provided,
872  /// to be used while performing partial ordering of function templates.
874 
875  union {
877 
878  /// FinalConversion - For a conversion function (where Function is
879  /// a CXXConversionDecl), the standard conversion that occurs
880  /// after the call to the overload candidate to convert the result
881  /// of calling the conversion function to the required type.
883  };
884 
885  /// Get RewriteKind value in OverloadCandidateRewriteKind type (This
886  /// function is to workaround the spurious GCC bitfield enum warning)
888  return static_cast<OverloadCandidateRewriteKind>(RewriteKind);
889  }
890 
891  bool isReversed() const { return getRewriteKind() & CRK_Reversed; }
892 
893  /// hasAmbiguousConversion - Returns whether this overload
894  /// candidate requires an ambiguous conversion or not.
895  bool hasAmbiguousConversion() const {
896  for (auto &C : Conversions) {
897  if (!C.isInitialized()) return false;
898  if (C.isAmbiguous()) return true;
899  }
900  return false;
901  }
902 
903  bool TryToFixBadConversion(unsigned Idx, Sema &S) {
904  bool CanFix = Fix.tryToFixConversion(
905  Conversions[Idx].Bad.FromExpr,
906  Conversions[Idx].Bad.getFromType(),
907  Conversions[Idx].Bad.getToType(), S);
908 
909  // If at least one conversion fails, the candidate cannot be fixed.
910  if (!CanFix)
911  Fix.clear();
912 
913  return CanFix;
914  }
915 
916  unsigned getNumParams() const {
917  if (IsSurrogate) {
919  while (STy->isPointerType() || STy->isReferenceType())
920  STy = STy->getPointeeType();
921  return STy->castAs<FunctionProtoType>()->getNumParams();
922  }
923  if (Function)
924  return Function->getNumParams();
925  return ExplicitCallArguments;
926  }
927 
928  private:
929  friend class OverloadCandidateSet;
932  };
933 
934  /// OverloadCandidateSet - A set of overload candidates, used in C++
935  /// overload resolution (C++ 13.3).
937  public:
939  /// Normal lookup.
941 
942  /// C++ [over.match.oper]:
943  /// Lookup of operator function candidates in a call using operator
944  /// syntax. Candidates that have no parameters of class type will be
945  /// skipped unless there is a parameter of (reference to) enum type and
946  /// the corresponding argument is of the same enum type.
948 
949  /// C++ [over.match.copy]:
950  /// Copy-initialization of an object of class type by user-defined
951  /// conversion.
953 
954  /// C++ [over.match.ctor], [over.match.list]
955  /// Initialization of an object of class type by constructor,
956  /// using either a parenthesized or braced list of arguments.
958  };
959 
960  /// Information about operator rewrites to consider when adding operator
961  /// functions to a candidate set.
966  : OriginalOperator(Op), AllowRewrittenCandidates(AllowRewritten) {}
967 
968  /// The original operator as written in the source.
970  /// Whether we should include rewritten candidates in the overload set.
972 
973  /// Would use of this function result in a rewrite using a different
974  /// operator?
976  return OriginalOperator &&
978  }
979 
981  if (!OriginalOperator)
982  return true;
983 
984  // For an overloaded operator, we can have candidates with a different
985  // name in our unqualified lookup set. Make sure we only consider the
986  // ones we're supposed to.
989  return OO && (OO == OriginalOperator ||
992  }
993 
994  /// Determine the kind of rewrite that should be performed for this
995  /// candidate.
999  if (isRewrittenOperator(FD))
1003  return CRK;
1004  }
1005 
1006  /// Determines whether this operator could be implemented by a function
1007  /// with reversed parameter order.
1008  bool isReversible() {
1012  }
1013 
1014  /// Determine whether we should consider looking for and adding reversed
1015  /// candidates for operator Op.
1017 
1018  /// Determine whether we should add a rewritten candidate for \p FD with
1019  /// reversed parameter order.
1020  bool shouldAddReversed(ASTContext &Ctx, const FunctionDecl *FD);
1021  };
1022 
1023  private:
1026 
1027  // Allocator for ConversionSequenceLists. We store the first few of these
1028  // inline to avoid allocation for small sets.
1029  llvm::BumpPtrAllocator SlabAllocator;
1030 
1031  SourceLocation Loc;
1032  CandidateSetKind Kind;
1033  OperatorRewriteInfo RewriteInfo;
1034 
1035  constexpr static unsigned NumInlineBytes =
1036  24 * sizeof(ImplicitConversionSequence);
1037  unsigned NumInlineBytesUsed = 0;
1038  alignas(void *) char InlineSpace[NumInlineBytes];
1039 
1040  // Address space of the object being constructed.
1041  LangAS DestAS = LangAS::Default;
1042 
1043  /// If we have space, allocates from inline storage. Otherwise, allocates
1044  /// from the slab allocator.
1045  /// FIXME: It would probably be nice to have a SmallBumpPtrAllocator
1046  /// instead.
1047  /// FIXME: Now that this only allocates ImplicitConversionSequences, do we
1048  /// want to un-generalize this?
1049  template <typename T>
1050  T *slabAllocate(unsigned N) {
1051  // It's simpler if this doesn't need to consider alignment.
1052  static_assert(alignof(T) == alignof(void *),
1053  "Only works for pointer-aligned types.");
1054  static_assert(std::is_trivial<T>::value ||
1055  std::is_same<ImplicitConversionSequence, T>::value,
1056  "Add destruction logic to OverloadCandidateSet::clear().");
1057 
1058  unsigned NBytes = sizeof(T) * N;
1059  if (NBytes > NumInlineBytes - NumInlineBytesUsed)
1060  return SlabAllocator.Allocate<T>(N);
1061  char *FreeSpaceStart = InlineSpace + NumInlineBytesUsed;
1062  assert(uintptr_t(FreeSpaceStart) % alignof(void *) == 0 &&
1063  "Misaligned storage!");
1064 
1065  NumInlineBytesUsed += NBytes;
1066  return reinterpret_cast<T *>(FreeSpaceStart);
1067  }
1068 
1069  void destroyCandidates();
1070 
1071  public:
1073  OperatorRewriteInfo RewriteInfo = {})
1074  : Loc(Loc), Kind(CSK), RewriteInfo(RewriteInfo) {}
1075  OverloadCandidateSet(const OverloadCandidateSet &) = delete;
1077  ~OverloadCandidateSet() { destroyCandidates(); }
1078 
1079  SourceLocation getLocation() const { return Loc; }
1080  CandidateSetKind getKind() const { return Kind; }
1081  OperatorRewriteInfo getRewriteInfo() const { return RewriteInfo; }
1082 
1083  /// Whether diagnostics should be deferred.
1084  bool shouldDeferDiags(Sema &S, ArrayRef<Expr *> Args, SourceLocation OpLoc);
1085 
1086  /// Determine when this overload candidate will be new to the
1087  /// overload set.
1090  uintptr_t Key = reinterpret_cast<uintptr_t>(F->getCanonicalDecl());
1091  Key |= static_cast<uintptr_t>(PO);
1092  return Functions.insert(Key).second;
1093  }
1094 
1095  /// Exclude a function from being considered by overload resolution.
1096  void exclude(Decl *F) {
1099  }
1100 
1101  /// Clear out all of the candidates.
1102  void clear(CandidateSetKind CSK);
1103 
1105 
1106  iterator begin() { return Candidates.begin(); }
1107  iterator end() { return Candidates.end(); }
1108 
1109  size_t size() const { return Candidates.size(); }
1110  bool empty() const { return Candidates.empty(); }
1111 
1112  /// Allocate storage for conversion sequences for NumConversions
1113  /// conversions.
1115  allocateConversionSequences(unsigned NumConversions) {
1116  ImplicitConversionSequence *Conversions =
1117  slabAllocate<ImplicitConversionSequence>(NumConversions);
1118 
1119  // Construct the new objects.
1120  for (unsigned I = 0; I != NumConversions; ++I)
1121  new (&Conversions[I]) ImplicitConversionSequence();
1122 
1123  return ConversionSequenceList(Conversions, NumConversions);
1124  }
1125 
1126  /// Add a new candidate with NumConversions conversion sequence slots
1127  /// to the overload set.
1128  OverloadCandidate &addCandidate(unsigned NumConversions = 0,
1129  ConversionSequenceList Conversions = None) {
1130  assert((Conversions.empty() || Conversions.size() == NumConversions) &&
1131  "preallocated conversion sequence has wrong length");
1132 
1133  Candidates.push_back(OverloadCandidate());
1134  OverloadCandidate &C = Candidates.back();
1135  C.Conversions = Conversions.empty()
1136  ? allocateConversionSequences(NumConversions)
1137  : Conversions;
1138  return C;
1139  }
1140 
1141  /// Find the best viable function on this overload set, if it exists.
1144 
1147  SourceLocation OpLoc = SourceLocation(),
1148  llvm::function_ref<bool(OverloadCandidate &)> Filter =
1149  [](OverloadCandidate &) { return true; });
1150 
1151  void NoteCandidates(
1153  ArrayRef<Expr *> Args, StringRef Opc = "",
1154  SourceLocation Loc = SourceLocation(),
1155  llvm::function_ref<bool(OverloadCandidate &)> Filter =
1156  [](OverloadCandidate &) { return true; });
1157 
1158  void NoteCandidates(Sema &S, ArrayRef<Expr *> Args,
1159  ArrayRef<OverloadCandidate *> Cands,
1160  StringRef Opc = "",
1161  SourceLocation OpLoc = SourceLocation());
1162 
1163  LangAS getDestAS() { return DestAS; }
1164 
1165  void setDestAS(LangAS AS) {
1166  assert((Kind == CSK_InitByConstructor ||
1168  "can't set the destination address space when not constructing an "
1169  "object");
1170  DestAS = AS;
1171  }
1172 
1173  };
1174 
1175  bool isBetterOverloadCandidate(Sema &S,
1176  const OverloadCandidate &Cand1,
1177  const OverloadCandidate &Cand2,
1178  SourceLocation Loc,
1180 
1185 
1186  explicit operator bool() const { return Constructor; }
1187  };
1188 
1189  // FIXME: Add an AddOverloadCandidate / AddTemplateOverloadCandidate overload
1190  // that takes one of these.
1192  if (isa<UsingDecl>(ND))
1193  return ConstructorInfo{};
1194 
1195  // For constructors, the access check is performed against the underlying
1196  // declaration, not the found declaration.
1197  auto *D = ND->getUnderlyingDecl();
1198  ConstructorInfo Info = {DeclAccessPair::make(ND, D->getAccess()), nullptr,
1199  nullptr};
1200  Info.ConstructorTmpl = dyn_cast<FunctionTemplateDecl>(D);
1201  if (Info.ConstructorTmpl)
1202  D = Info.ConstructorTmpl->getTemplatedDecl();
1203  Info.Constructor = dyn_cast<CXXConstructorDecl>(D);
1204  return Info;
1205  }
1206 
1207 } // namespace clang
1208 
1209 #endif // LLVM_CLANG_SEMA_OVERLOAD_H
clang::BadConversionSequence::FailureKind
FailureKind
Definition: Overload.h:467
clang::AmbiguousConversionSequence::begin
const_iterator begin() const
Definition: Overload.h:456
clang::ovl_fail_final_conversion_not_exact
@ ovl_fail_final_conversion_not_exact
This conversion function template specialization candidate is not viable because the final conversion...
Definition: Overload.h:765
clang::ICK_Compatible_Conversion
@ ICK_Compatible_Conversion
Conversions between compatible types in C99.
Definition: Overload.h:155
clang::OverloadCandidateSet::OperatorRewriteInfo::isReversible
bool isReversible()
Determines whether this operator could be implemented by a function with reversed parameter order.
Definition: Overload.h:1008
clang::CXXConstructorDecl
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2401
clang::UserDefinedConversionSequence::Before
StandardConversionSequence Before
Represents the standard conversion that occurs before the actual user-defined conversion.
Definition: Overload.h:385
clang::ICK_Lvalue_To_Rvalue
@ ICK_Lvalue_To_Rvalue
Lvalue-to-rvalue conversion (C++ [conv.lval])
Definition: Overload.h:110
clang::FunctionDecl::getNumParams
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
Definition: Decl.cpp:3380
clang::OverloadCandidateSet::OverloadCandidateSet
OverloadCandidateSet(SourceLocation Loc, CandidateSetKind CSK, OperatorRewriteInfo RewriteInfo={})
Definition: Overload.h:1072
clang::ovl_fail_inhctor_slice
@ ovl_fail_inhctor_slice
This inherited constructor is not viable because it would slice the argument.
Definition: Overload.h:785
clang::StandardConversionSequence::CopyConstructor
CXXConstructorDecl * CopyConstructor
CopyConstructor - The copy constructor that is used to perform this conversion, when the conversion i...
Definition: Overload.h:330
clang::OverloadCandidate::FailureKind
unsigned char FailureKind
FailureKind - The reason why this candidate is not viable.
Definition: Overload.h:869
clang::OverloadCandidateSet::shouldDeferDiags
bool shouldDeferDiags(Sema &S, ArrayRef< Expr * > Args, SourceLocation OpLoc)
Whether diagnostics should be deferred.
Definition: SemaOverload.cpp:11699
DeclAccessPair.h
clang::CXXConversionDecl
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2731
clang::ICK_TransparentUnionConversion
@ ICK_TransparentUnionConversion
Transparent Union Conversions.
Definition: Overload.h:176
clang::OverloadCandidateSet::addCandidate
OverloadCandidate & addCandidate(unsigned NumConversions=0, ConversionSequenceList Conversions=None)
Add a new candidate with NumConversions conversion sequence slots to the overload set.
Definition: Overload.h:1128
clang::ICK_Identity
@ ICK_Identity
Identity conversion (no conversion)
Definition: Overload.h:107
clang::OverloadCandidateParamOrder
OverloadCandidateParamOrder
The parameter ordering that will be used for the candidate.
Definition: Overload.h:85
clang::OverloadCandidateSet::CSK_Normal
@ CSK_Normal
Normal lookup.
Definition: Overload.h:940
clang::StandardConversionSequence::First
ImplicitConversionKind First
First – The first conversion can be an lvalue-to-rvalue conversion, array-to-pointer conversion,...
Definition: Overload.h:264
clang::ICR_Complex_Real_Conversion
@ ICR_Complex_Real_Conversion
Complex <-> Real conversion.
Definition: Overload.h:215
clang::OverloadCandidate::ExplicitCallArguments
unsigned ExplicitCallArguments
The number of call arguments that were explicitly provided, to be used while performing partial order...
Definition: Overload.h:873
clang::BadConversionSequence::setToType
void setToType(QualType T)
Definition: Overload.h:511
clang::ImplicitConversionSequence::ImplicitConversionSequence
ImplicitConversionSequence()
Definition: Overload.h:578
clang::OverloadCandidateSet::clear
void clear(CandidateSetKind CSK)
Clear out all of the candidates.
Definition: SemaOverload.cpp:916
clang::ImplicitConversionSequence::getNullptrToBool
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:705
clang::ICK_Derived_To_Base
@ ICK_Derived_To_Base
Derived-to-base (C++ [over.best.ics])
Definition: Overload.h:158
llvm::SmallVector
Definition: LLVM.h:38
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:88
clang::ICK_SVE_Vector_Conversion
@ ICK_SVE_Vector_Conversion
Arm SVE Vector conversions.
Definition: Overload.h:164
clang::ImplicitConversionSequence::UserDefined
UserDefinedConversionSequence UserDefined
When ConversionKind == UserDefinedConversion, provides the details of the user-defined conversion seq...
Definition: Overload.h:567
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:249
clang::ovl_fail_constraints_not_satisfied
@ ovl_fail_constraints_not_satisfied
This candidate was not viable because its associated constraints were not satisfied.
Definition: Overload.h:798
clang::OR_Success
@ OR_Success
Overload resolution succeeded.
Definition: Overload.h:53
clang::StandardConversionSequence::QualificationIncludesObjCLifetime
unsigned QualificationIncludesObjCLifetime
Whether the qualification conversion involves a change in the Objective-C lifetime (for automatic ref...
Definition: Overload.h:283
clang::NamedDecl::getUnderlyingDecl
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
Definition: Decl.h:459
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:673
clang::OverloadCandidate::IsSurrogate
bool IsSurrogate
IsSurrogate - True to indicate that this candidate is a surrogate for a conversion to a function poin...
Definition: Overload.h:850
clang::OverloadCandidate::IgnoreObjectArgument
bool IgnoreObjectArgument
IgnoreObjectArgument - True to indicate that the first argument's conversion, which for this function...
Definition: Overload.h:859
clang::AmbiguousConversionSequence::begin
iterator begin()
Definition: Overload.h:451
clang::ICR_C_Conversion
@ ICR_C_Conversion
Conversion only allowed in the C standard (e.g. void* to char*).
Definition: Overload.h:221
clang::tooling::Filter
llvm::cl::opt< std::string > Filter
clang::ImplicitConversionSequence::isUserDefined
bool isUserDefined() const
Definition: Overload.h:646
clang::ImplicitConversionSequence::AmbiguousConversion
@ AmbiguousConversion
Definition: Overload.h:527
clang::OverloadCandidateSet::allocateConversionSequences
ConversionSequenceList allocateConversionSequences(unsigned NumConversions)
Allocate storage for conversion sequences for NumConversions conversions.
Definition: Overload.h:1115
clang::BadConversionSequence::rvalue_ref_to_lvalue
@ rvalue_ref_to_lvalue
Definition: Overload.h:472
clang::OverloadCandidateSet::isNewCandidate
bool isNewCandidate(Decl *F, OverloadCandidateParamOrder PO=OverloadCandidateParamOrder::Normal)
Determine when this overload candidate will be new to the overload set.
Definition: Overload.h:1088
DeclCXX.h
clang::UserDefinedConversionSequence::EllipsisConversion
bool EllipsisConversion
EllipsisConversion - When this is true, it means user-defined conversion sequence starts with a ....
Definition: Overload.h:393
clang::ImplicitConversionSequence::getKind
Kind getKind() const
Definition: Overload.h:611
clang::StandardConversionSequence::setAllToTypes
void setAllToTypes(QualType T)
Definition: Overload.h:340
clang::ConstructorInfo::ConstructorTmpl
FunctionTemplateDecl * ConstructorTmpl
Definition: Overload.h:1184
clang::ConversionFixItGenerator
The class facilities generation and storage of conversion FixIts.
Definition: SemaFixItUtils.h:32
clang::OverloadCandidateSet::CompleteCandidates
SmallVector< OverloadCandidate *, 32 > CompleteCandidates(Sema &S, OverloadCandidateDisplayKind OCD, ArrayRef< Expr * > Args, SourceLocation OpLoc=SourceLocation(), llvm::function_ref< bool(OverloadCandidate &)> Filter=[](OverloadCandidate &) { return true;})
Definition: SemaOverload.cpp:11656
clang::BadConversionSequence::setFromExpr
void setFromExpr(Expr *E)
Definition: Overload.h:505
clang::ICK_Array_To_Pointer
@ ICK_Array_To_Pointer
Array-to-pointer conversion (C++ [conv.array])
Definition: Overload.h:113
clang::StandardConversionSequence::setToType
void setToType(unsigned Idx, QualType T)
Definition: Overload.h:335
clang::AmbiguousConversionSequence::getToType
QualType getToType() const
Definition: Overload.h:430
clang::ImplicitConversionSequence::Bad
BadConversionSequence Bad
When ConversionKind == BadConversion, provides the details of the bad conversion.
Definition: Overload.h:575
llvm::SmallPtrSet< uintptr_t, 16 >
clang::ICR_C_Conversion_Extension
@ ICR_C_Conversion_Extension
Conversion not allowed by the C standard, but that we accept as an extension anyway.
Definition: Overload.h:225
clang::NK_Type_Narrowing
@ NK_Type_Narrowing
A narrowing conversion by virtue of the source and destination types.
Definition: Overload.h:237
clang::ImplicitConversionSequence::isFailure
bool isFailure() const
Definition: Overload.h:647
clang::AmbiguousConversionSequence::conversions
ConversionSet & conversions()
Definition: Overload.h:437
clang::StandardConversionSequence::BindsImplicitObjectArgumentWithoutRefQualifier
unsigned BindsImplicitObjectArgumentWithoutRefQualifier
Whether this binds an implicit object argument to a non-static member function without a ref-qualifie...
Definition: Overload.h:309
clang::ImplicitConversionSequence::ImplicitConversionSequence
ImplicitConversionSequence(const ImplicitConversionSequence &Other)
Definition: Overload.h:585
clang::ImplicitConversionSequence::Kind
Kind
Kind - The kind of implicit conversion sequence.
Definition: Overload.h:524
clang::OverloadCandidate::DeductionFailure
DeductionFailureInfo DeductionFailure
Definition: Overload.h:876
clang::UserDefinedConversionSequence::dump
void dump() const
dump - Print this user-defined conversion sequence to standard error.
Definition: SemaOverload.cpp:524
clang::OverloadCandidate::IsADLCandidate
CallExpr::ADLCallKind IsADLCandidate
True if the candidate was found using ADL.
Definition: Overload.h:862
clang::ICK_Integral_Promotion
@ ICK_Integral_Promotion
Integral promotions (C++ [conv.prom])
Definition: Overload.h:125
clang::getRewrittenOverloadedOperator
OverloadedOperatorKind getRewrittenOverloadedOperator(OverloadedOperatorKind Kind)
Get the other overloaded operator that the given operator can be rewritten into, if any such operator...
Definition: OperatorKinds.h:36
clang::OverloadCandidateSet::CSK_InitByUserDefinedConversion
@ CSK_InitByUserDefinedConversion
C++ [over.match.copy]: Copy-initialization of an object of class type by user-defined conversion.
Definition: Overload.h:952
clang::ConstructorInfo::FoundDecl
DeclAccessPair FoundDecl
Definition: Overload.h:1182
clang::OverloadCandidateSet::OperatorRewriteInfo::getRewriteKind
OverloadCandidateRewriteKind getRewriteKind(const FunctionDecl *FD, OverloadCandidateParamOrder PO)
Determine the kind of rewrite that should be performed for this candidate.
Definition: Overload.h:997
clang::ConstructorInfo::Constructor
CXXConstructorDecl * Constructor
Definition: Overload.h:1183
clang::getConstructorInfo
ConstructorInfo getConstructorInfo(NamedDecl *ND)
Definition: Overload.h:1191
clang::ovl_fail_illegal_constructor
@ ovl_fail_illegal_constructor
This conversion candidate was not considered because it is an illegal instantiation of a constructor ...
Definition: Overload.h:757
clang::BadConversionSequence::too_few_initializers
@ too_few_initializers
Definition: Overload.h:473
clang::AmbiguousConversionSequence::getFromType
QualType getFromType() const
Definition: Overload.h:426
clang::ICK_Zero_Queue_Conversion
@ ICK_Zero_Queue_Conversion
Zero constant to queue.
Definition: Overload.h:185
clang::ICK_Complex_Conversion
@ ICK_Complex_Conversion
Complex conversions (C99 6.3.1.6)
Definition: Overload.h:140
clang::ImplicitConversionSequence::dump
void dump() const
dump - Print this implicit conversion sequence to standard error.
Definition: SemaOverload.cpp:542
clang::OverloadCandidateSet::OperatorRewriteInfo
Information about operator rewrites to consider when adding operator functions to a candidate set.
Definition: Overload.h:962
clang::ICK_Function_Conversion
@ ICK_Function_Conversion
Function pointer conversion (C++17 [conv.fctptr])
Definition: Overload.h:119
clang::ImplicitConversionSequence::setStandard
void setStandard()
Definition: Overload.h:668
clang::OverloadCandidateSet::OperatorRewriteInfo::AllowRewrittenCandidates
bool AllowRewrittenCandidates
Whether we should include rewritten candidates in the overload set.
Definition: Overload.h:971
clang::ICK_Pointer_Member
@ ICK_Pointer_Member
Pointer-to-member conversions (C++ [conv.mem])
Definition: Overload.h:149
Decl.h
clang::OverloadCandidate::Fix
ConversionFixItGenerator Fix
The FixIt hints which can be used to fix the Bad candidate.
Definition: Overload.h:833
clang::ImplicitConversionSequence::isInitialized
bool isInitialized() const
Determines whether this conversion sequence has been initialized.
Definition: Overload.h:652
clang::AmbiguousConversionSequence::FromTypePtr
void * FromTypePtr
Definition: Overload.h:422
clang::ImplicitConversionSequence::operator=
ImplicitConversionSequence & operator=(const ImplicitConversionSequence &Other)
Definition: Overload.h:601
clang::ImplicitConversionRank
ImplicitConversionRank
ImplicitConversionRank - The rank of an implicit conversion kind.
Definition: Overload.h:201
clang::ImplicitConversionSequence::EllipsisConversion
@ EllipsisConversion
Definition: Overload.h:528
clang::FunctionTemplateDecl
Declaration of a template function.
Definition: DeclTemplate.h:978
llvm::MutableArrayRef< ImplicitConversionSequence >
clang::Type::isReferenceType
bool isReferenceType() const
Definition: Type.h:6685
clang::OverloadCandidateSet::getKind
CandidateSetKind getKind() const
Definition: Overload.h:1080
clang::StandardConversionSequence::setAsIdentityConversion
void setAsIdentityConversion()
StandardConversionSequence - Set the standard conversion sequence to the identity conversion.
Definition: SemaOverload.cpp:193
DeclTemplate.h
clang::DeclarationName::getCXXOverloadedOperator
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
Definition: DeclarationName.h:462
clang::OCD_ViableCandidates
@ OCD_ViableCandidates
Requests that only viable candidates be shown.
Definition: Overload.h:71
clang::BadConversionSequence::init
void init(FailureKind K, QualType From, QualType To)
Definition: Overload.h:495
clang::BadConversionSequence::unrelated_class
@ unrelated_class
Definition: Overload.h:469
clang::StandardConversionSequence::dump
void dump() const
dump - Print this standard conversion sequence to standard error.
Definition: SemaOverload.cpp:485
clang::PartialDiagnosticAt
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
Definition: PartialDiagnostic.h:208
clang::Decl::getAccess
AccessSpecifier getAccess() const
Definition: DeclBase.h:478
clang::DeclAccessPair::make
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
Definition: DeclAccessPair.h:35
clang::ConversionFixItGenerator::tryToFixConversion
bool tryToFixConversion(const Expr *FromExpr, const QualType FromQTy, const QualType ToQTy, Sema &S)
If possible, generates and stores a fix for the given conversion.
Definition: SemaFixItUtils.cpp:50
clang::StandardConversionSequence::IncompatibleObjC
unsigned IncompatibleObjC
IncompatibleObjC - Whether this is an Objective-C conversion that we should warn about (if we actuall...
Definition: Overload.h:287
clang::UserDefinedConversionSequence::ConversionFunction
FunctionDecl * ConversionFunction
ConversionFunction - The function that will perform the user-defined conversion.
Definition: Overload.h:407
clang::StandardConversionSequence::getFromType
QualType getFromType() const
Definition: Overload.h:346
clang::OverloadCandidateSet::getDestAS
LangAS getDestAS()
Definition: Overload.h:1163
clang::OverloadCandidate::Viable
bool Viable
Viable - True to indicate that this overload candidate is viable.
Definition: Overload.h:836
clang::ovl_fail_addr_not_available
@ ovl_fail_addr_not_available
This candidate was not viable because its address could not be taken.
Definition: Overload.h:781
clang::CRK_Reversed
@ CRK_Reversed
Candidate is a rewritten candidate with a reversed order of parameters.
Definition: Overload.h:98
DeclBase.h
clang::BadConversionSequence
BadConversionSequence - Records information about an invalid conversion sequence.
Definition: Overload.h:466
clang::BadConversionSequence::getToType
QualType getToType() const
Definition: Overload.h:503
clang::ovl_fail_object_addrspace_mismatch
@ ovl_fail_object_addrspace_mismatch
This constructor/conversion candidate fail due to an address space mismatch between the object being ...
Definition: Overload.h:794
clang::DeclAccessPair
A POD class for pairing a NamedDecl* with an access specifier.
Definition: DeclAccessPair.h:29
clang::DeductionFailureInfo
A structure used to record information about a failed template argument deduction,...
Definition: TemplateDeduction.h:241
clang::ImplicitConversionSequence::isAmbiguous
bool isAmbiguous() const
Definition: Overload.h:645
clang::OverloadCandidateSet::getLocation
SourceLocation getLocation() const
Definition: Overload.h:1079
clang::StandardConversionSequence::isIdentityConversion
bool isIdentityConversion() const
Definition: Overload.h:357
clang::OverloadCandidateSet::CSK_InitByConstructor
@ CSK_InitByConstructor
C++ [over.match.ctor], [over.match.list] Initialization of an object of class type by constructor,...
Definition: Overload.h:957
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:212
clang::ImplicitConversionSequence::Better
@ Better
Definition: Overload.h:725
clang::BadConversionSequence::too_many_initializers
@ too_many_initializers
Definition: Overload.h:474
clang::OverloadCandidateSet::OperatorRewriteInfo::isAcceptableCandidate
bool isAcceptableCandidate(const FunctionDecl *FD)
Definition: Overload.h:980
clang::OverloadCandidate::RewriteKind
unsigned RewriteKind
Whether this is a rewritten candidate, and if so, of what kind?
Definition: Overload.h:865
clang::ICR_Conversion
@ ICR_Conversion
Conversion.
Definition: Overload.h:209
clang::ovl_non_default_multiversion_function
@ ovl_non_default_multiversion_function
This candidate was not viable because it is a non-default multiversioned function.
Definition: Overload.h:789
clang::AmbiguousConversionSequence::end
iterator end()
Definition: Overload.h:452
clang::StandardConversionSequence::ObjCLifetimeConversionBinding
unsigned ObjCLifetimeConversionBinding
Whether this binds a reference to an object with a different Objective-C lifetime qualifier.
Definition: Overload.h:313
clang::GetConversionRank
ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind)
GetConversionRank - Retrieve the implicit conversion rank corresponding to the given implicit convers...
Definition: SemaOverload.cpp:118
clang::OverloadCandidateSet::OperatorRewriteInfo::OriginalOperator
OverloadedOperatorKind OriginalOperator
The original operator as written in the source.
Definition: Overload.h:969
clang::OCD_AmbiguousCandidates
@ OCD_AmbiguousCandidates
Requests that only tied-for-best candidates be shown.
Definition: Overload.h:74
clang::BadConversionSequence::bad_qualifiers
@ bad_qualifiers
Definition: Overload.h:470
clang::ICK_Boolean_Conversion
@ ICK_Boolean_Conversion
Boolean conversions (C++ [conv.bool])
Definition: Overload.h:152
clang::ovl_fail_bad_target
@ ovl_fail_bad_target
(CUDA) This candidate was not viable because the callee was not accessible from the caller's target (...
Definition: Overload.h:770
clang::OverloadCandidateSet::setDestAS
void setDestAS(LangAS AS)
Definition: Overload.h:1165
clang::ImplicitConversionSequence::setAsIdentityConversion
void setAsIdentityConversion(QualType T)
Definition: Overload.h:678
clang::Decl::getCanonicalDecl
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:901
clang::OverloadCandidateSet::exclude
void exclude(Decl *F)
Exclude a function from being considered by overload resolution.
Definition: Overload.h:1096
clang::CRK_DifferentOperator
@ CRK_DifferentOperator
Candidate is a rewritten candidate with a different operator name.
Definition: Overload.h:95
clang::ImplicitConversionSequence::isEllipsis
bool isEllipsis() const
Definition: Overload.h:644
uintptr_t
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Definition: opencl-c-base.h:124
clang::ConstructorInfo
Definition: Overload.h:1181
clang::BadConversionSequence::lvalue_ref_to_rvalue
@ lvalue_ref_to_rvalue
Definition: Overload.h:471
Type.h
clang::OverloadCandidateSet::OperatorRewriteInfo::OperatorRewriteInfo
OperatorRewriteInfo()
Definition: Overload.h:963
clang::ImplicitConversionSequence::isBad
bool isBad() const
Definition: Overload.h:642
Expr.h
bool
#define bool
Definition: stdbool.h:15
clang::OverloadCandidateRewriteKind
OverloadCandidateRewriteKind
The kinds of rewrite we perform on overload candidates.
Definition: Overload.h:90
clang::ICK_Incompatible_Pointer_Conversion
@ ICK_Incompatible_Pointer_Conversion
C-only conversion between pointers with incompatible types.
Definition: Overload.h:191
clang::BadConversionSequence::Kind
FailureKind Kind
Definition: Overload.h:480
clang::Type::getPointeeType
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
Definition: Type.cpp:625
clang::ImplicitConversionSequence::Worse
@ Worse
Definition: Overload.h:727
clang::OverloadCandidateSet::iterator
SmallVectorImpl< OverloadCandidate >::iterator iterator
Definition: Overload.h:1104
clang::OverloadCandidate::Conversions
ConversionSequenceList Conversions
The conversion sequences used to convert the function arguments to the function parameters.
Definition: Overload.h:830
clang::ovl_fail_trivial_conversion
@ ovl_fail_trivial_conversion
This conversion candidate was not considered because it duplicates the work of a trivial or derived-t...
Definition: Overload.h:746
clang::ImplicitConversionSequence::DiagnoseAmbiguousConversion
void DiagnoseAmbiguousConversion(Sema &S, SourceLocation CaretLoc, const PartialDiagnostic &PDiag) const
Diagnoses an ambiguous conversion.
Definition: SemaOverload.cpp:10427
clang::ImplicitConversionSequence::setEllipsis
void setEllipsis()
Definition: Overload.h:669
clang::OR_Deleted
@ OR_Deleted
Succeeded, but refers to a deleted function.
Definition: Overload.h:62
clang::ImplicitConversionSequence::Standard
StandardConversionSequence Standard
When ConversionKind == StandardConversion, provides the details of the standard conversion sequence.
Definition: Overload.h:563
clang::OverloadCandidate::Function
FunctionDecl * Function
Function - The actual function that this candidate represents.
Definition: Overload.h:812
clang::StandardConversionSequence::DirectBinding
unsigned DirectBinding
DirectBinding - True when this is a reference binding that is a direct binding (C++ [dcl....
Definition: Overload.h:295
clang::NK_Constant_Narrowing
@ NK_Constant_Narrowing
A narrowing conversion, because a constant expression got narrowed.
Definition: Overload.h:240
clang::ICK_Floating_Promotion
@ ICK_Floating_Promotion
Floating point promotions (C++ [conv.fpprom])
Definition: Overload.h:128
clang::AmbiguousConversionSequence::setFromType
void setFromType(QualType T)
Definition: Overload.h:434
clang::BadConversionSequence::FromExpr
Expr * FromExpr
Definition: Overload.h:478
clang::OverloadCandidateSet::OperatorRewriteInfo::shouldAddReversed
bool shouldAddReversed(OverloadedOperatorKind Op)
Determine whether we should consider looking for and adding reversed candidates for operator Op.
Definition: SemaOverload.cpp:888
clang::ICK_Block_Pointer_Conversion
@ ICK_Block_Pointer_Conversion
Block Pointer conversions.
Definition: Overload.h:173
clang::ImplicitConversionSequence::BadConversion
@ BadConversion
Definition: Overload.h:529
clang::AmbiguousConversionSequence::ConversionSet
SmallVector< std::pair< NamedDecl *, FunctionDecl * >, 4 > ConversionSet
Definition: Overload.h:420
clang::UserDefinedConversionSequence::HadMultipleCandidates
bool HadMultipleCandidates
HadMultipleCandidates - When this is true, it means that the conversion function was resolved from an...
Definition: Overload.h:398
clang::ovl_fail_bad_conversion
@ ovl_fail_bad_conversion
Definition: Overload.h:740
clang::ImplicitConversionSequence::CompareKind
CompareKind
Definition: Overload.h:724
clang::StandardConversionSequence::Second
ImplicitConversionKind Second
Second - The second conversion can be an integral promotion, floating point promotion,...
Definition: Overload.h:270
clang::ICK_Vector_Splat
@ ICK_Vector_Splat
A vector splat from an arithmetic type.
Definition: Overload.h:167
clang::AmbiguousConversionSequence::copyFrom
void copyFrom(const AmbiguousConversionSequence &)
Definition: SemaOverload.cpp:578
clang::OverloadedOperatorKind
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:21
clang::OverloadCandidateSet::NoteCandidates
void NoteCandidates(PartialDiagnosticAt PA, Sema &S, OverloadCandidateDisplayKind OCD, ArrayRef< Expr * > Args, StringRef Opc="", SourceLocation Loc=SourceLocation(), llvm::function_ref< bool(OverloadCandidate &)> Filter=[](OverloadCandidate &) { return true;})
When overload resolution fails, prints diagnostic messages containing the candidates in the candidate...
Definition: SemaOverload.cpp:11720
clang::BadConversionSequence::no_conversion
@ no_conversion
Definition: Overload.h:468
clang::StandardConversionSequence::FromTypePtr
void * FromTypePtr
FromType - The type that this conversion is converting from.
Definition: Overload.h:318
clang::ICK_Function_To_Pointer
@ ICK_Function_To_Pointer
Function-to-pointer (C++ [conv.array])
Definition: Overload.h:116
clang::OverloadCandidate::FoundDecl
DeclAccessPair FoundDecl
FoundDecl - The original declaration that was looked up / invented / otherwise found,...
Definition: Overload.h:817
clang::OverloadCandidateSet::getRewriteInfo
OperatorRewriteInfo getRewriteInfo() const
Definition: Overload.h:1081
clang::AmbiguousConversionSequence::conversions
const ConversionSet & conversions() const
Definition: Overload.h:441
clang::LangAS
LangAS
Defines the address space values used by the address space qualifier of QualType.
Definition: AddressSpaces.h:25
clang::OverloadCandidateSet
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13....
Definition: Overload.h:936
clang::OCD_AllCandidates
@ OCD_AllCandidates
Requests that all candidates be shown.
Definition: Overload.h:68
clang::Type::castAs
const T * castAs() const
Member-template castAs<specific type>.
Definition: Type.h:7227
clang::ConversionFixItGenerator::clear
void clear()
Definition: SemaFixItUtils.h:79
clang::OverloadCandidateSet::BestViableFunction
OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best)
Find the best viable function on this overload set, if it exists.
Definition: SemaOverload.cpp:10029
clang::ICK_Zero_Event_Conversion
@ ICK_Zero_Event_Conversion
Zero constant to event (OpenCL1.2 6.12.10)
Definition: Overload.h:182
clang::ImplicitConversionSequence::Indistinguishable
@ Indistinguishable
Definition: Overload.h:726
clang::AmbiguousConversionSequence::destruct
void destruct()
Definition: SemaOverload.cpp:573
clang::OverloadCandidateSet::OperatorRewriteInfo::isRewrittenOperator
bool isRewrittenOperator(const FunctionDecl *FD)
Would use of this function result in a rewrite using a different operator?
Definition: Overload.h:975
clang::CallExpr::ADLCallKind
ADLCallKind
Definition: Expr.h:2851
clang::OverloadCandidateSet::OperatorRewriteInfo::OperatorRewriteInfo
OperatorRewriteInfo(OverloadedOperatorKind Op, bool AllowRewritten)
Definition: Overload.h:965
SourceLocation.h
clang::OO_None
@ OO_None
Not an overloaded operator.
Definition: OperatorKinds.h:22
clang::ImplicitConversionSequence::getInitializerListContainerType
QualType getInitializerListContainerType() const
Definition: Overload.h:697
clang::OverloadCandidateSet::operator=
OverloadCandidateSet & operator=(const OverloadCandidateSet &)=delete
clang::AmbiguousConversionSequence
Represents an ambiguous user-defined conversion sequence.
Definition: Overload.h:418
clang::Type::isPointerType
bool isPointerType() const
Definition: Type.h:6673
clang::ICR_Exact_Match
@ ICR_Exact_Match
Exact Match.
Definition: Overload.h:203
clang::AmbiguousConversionSequence::construct
void construct()
Definition: SemaOverload.cpp:569
false
#define false
Definition: stdbool.h:17
clang::StandardConversionSequence
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3....
Definition: Overload.h:259
clang::OR_No_Viable_Function
@ OR_No_Viable_Function
No viable function found.
Definition: Overload.h:56
clang::OverloadCandidateDisplayKind
OverloadCandidateDisplayKind
Definition: Overload.h:65
clang::CRK_None
@ CRK_None
Candidate is not a rewritten candidate.
Definition: Overload.h:92
clang::FunctionProtoType
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3885
clang::UserDefinedConversionSequence
UserDefinedConversionSequence - Represents a user-defined conversion sequence (C++ 13....
Definition: Overload.h:373
clang::CXXConversionDecl::getConversionType
QualType getConversionType() const
Returns the type that this conversion function is converting to.
Definition: DeclCXX.h:2771
clang::AmbiguousConversionSequence::iterator
ConversionSet::iterator iterator
Definition: Overload.h:449
TemplateDeduction.h
llvm::ArrayRef
Definition: LLVM.h:34
clang::StandardConversionSequence::setFromType
void setFromType(QualType T)
Definition: Overload.h:333
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:89
clang::ICK_Floating_Integral
@ ICK_Floating_Integral
Floating-integral conversions (C++ [conv.fpint])
Definition: Overload.h:143
clang::ImplicitConversionSequence::setBad
void setBad(BadConversionSequence::FailureKind Failure, Expr *FromExpr, QualType ToType)
Sets this sequence as a bad conversion for an explicit argument.
Definition: Overload.h:655
clang::ICK_Vector_Conversion
@ ICK_Vector_Conversion
Vector conversions.
Definition: Overload.h:161
clang::OverloadCandidate
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
Definition: Overload.h:807
clang::StandardConversionSequence::ReferenceBinding
unsigned ReferenceBinding
ReferenceBinding - True when this is a reference binding (C++ [over.ics.ref]).
Definition: Overload.h:291
clang::StandardConversionSequence::DeprecatedStringLiteralToCharPtr
unsigned DeprecatedStringLiteralToCharPtr
Whether this is the deprecated conversion of a string literal to a pointer to non-const character dat...
Definition: Overload.h:279
clang::ImplicitConversionSequence::isStandard
bool isStandard() const
Definition: Overload.h:643
clang::OverloadCandidateSet::~OverloadCandidateSet
~OverloadCandidateSet()
Definition: Overload.h:1077
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:355
LLVM.h
clang::StandardConversionSequence::getRank
ImplicitConversionRank getRank() const
getRank - Retrieve the rank of this standard conversion sequence (C++ 13.3.3.1.1p3).
Definition: SemaOverload.cpp:212
clang::OverloadCandidateParamOrder::Reversed
@ Reversed
clang::OR_Ambiguous
@ OR_Ambiguous
Ambiguous candidates found.
Definition: Overload.h:59
clang::OverloadCandidateSet::CandidateSetKind
CandidateSetKind
Definition: Overload.h:938
clang::ImplicitConversionKind
ImplicitConversionKind
ImplicitConversionKind - The kind of implicit conversion used to convert an argument to a parameter's...
Definition: Overload.h:105
clang::ImplicitConversionSequence::setAmbiguous
void setAmbiguous()
Definition: Overload.h:672
clang::ImplicitConversionSequence::~ImplicitConversionSequence
~ImplicitConversionSequence()
Definition: Overload.h:607
clang::BadConversionSequence::setFromType
void setFromType(QualType T)
Definition: Overload.h:510
clang::ICR_Promotion
@ ICR_Promotion
Promotion.
Definition: Overload.h:206
clang::StandardConversionSequence::IsLvalueReference
unsigned IsLvalueReference
Whether this is an lvalue reference binding (otherwise, it's an rvalue reference binding).
Definition: Overload.h:299
clang::ovl_fail_bad_final_conversion
@ ovl_fail_bad_final_conversion
This conversion candidate is not viable because its result type is not implicitly convertible to the ...
Definition: Overload.h:761
clang::StandardConversionSequence::getToType
QualType getToType(unsigned Idx) const
Definition: Overload.h:350
clang::OverloadCandidate::FinalConversion
StandardConversionSequence FinalConversion
FinalConversion - For a conversion function (where Function is a CXXConversionDecl),...
Definition: Overload.h:882
clang::QualType::getFromOpaquePtr
static QualType getFromOpaquePtr(const void *Ptr)
Definition: Type.h:720
clang::OverloadingResult
OverloadingResult
OverloadingResult - Capture the result of performing overload resolution.
Definition: Overload.h:51
clang::PartialDiagnostic
Definition: PartialDiagnostic.h:34
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::FunctionTemplateDecl::getTemplatedDecl
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Definition: DeclTemplate.h:1033
clang::isBetterOverloadCandidate
bool isBetterOverloadCandidate(Sema &S, const OverloadCandidate &Cand1, const OverloadCandidate &Cand2, SourceLocation Loc, OverloadCandidateSet::CandidateSetKind Kind)
isBetterOverloadCandidate - Determines whether the first overload candidate is a better candidate tha...
Definition: SemaOverload.cpp:9597
clang::ICK_Writeback_Conversion
@ ICK_Writeback_Conversion
Objective-C ARC writeback conversion.
Definition: Overload.h:179
clang::AmbiguousConversionSequence::ToTypePtr
void * ToTypePtr
Definition: Overload.h:423
clang::ICR_OCL_Scalar_Widening
@ ICR_OCL_Scalar_Widening
OpenCL Scalar Widening.
Definition: Overload.h:212
clang::LangAS::Default
@ Default
clang::OverloadCandidate::TryToFixBadConversion
bool TryToFixBadConversion(unsigned Idx, Sema &S)
Definition: Overload.h:903
clang::OverloadCandidate::Surrogate
CXXConversionDecl * Surrogate
Surrogate - The conversion function for which this candidate is a surrogate, but only if IsSurrogate ...
Definition: Overload.h:825
clang::ImplicitConversionSequence::setUserDefined
void setUserDefined()
Definition: Overload.h:670
clang::ImplicitConversionSequence::setBad
void setBad(BadConversionSequence::FailureKind Failure, QualType FromType, QualType ToType)
Sets this sequence as a bad conversion for an implicit argument.
Definition: Overload.h:662
clang::StandardConversionSequence::getNarrowingKind
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...
Definition: SemaOverload.cpp:311
clang
Definition: CalledOnceCheck.h:17
clang::ICK_Complex_Real
@ ICK_Complex_Real
Complex-real conversions (C99 6.3.1.7)
Definition: Overload.h:170
clang::ImplicitConversionSequence::getKindRank
unsigned getKindRank() const
Return a ranking of the implicit conversion sequence kind, where smaller ranks represent better conve...
Definition: Overload.h:623
clang::ovl_fail_bad_deduction
@ ovl_fail_bad_deduction
Definition: Overload.h:741
SemaFixItUtils.h
clang::ImplicitConversionSequence::setInitializerListContainerType
void setInitializerListContainerType(QualType T, bool IA)
Definition: Overload.h:690
clang::OverloadCandidate::getNumParams
unsigned getNumParams() const
Definition: Overload.h:916
clang::ICK_C_Only_Conversion
@ ICK_C_Only_Conversion
Conversions allowed in C, but not C++.
Definition: Overload.h:188
clang::StandardConversionSequence::isPointerConversionToVoidPointer
bool isPointerConversionToVoidPointer(ASTContext &Context) const
isPointerConversionToVoidPointer - Determines whether this conversion is a conversion of a pointer to...
Definition: SemaOverload.cpp:249
clang::StandardConversionSequence::Third
ImplicitConversionKind Third
Third - The third conversion can be a qualification conversion or a function conversion.
Definition: Overload.h:274
clang::StandardConversionSequence::BindsToFunctionLvalue
unsigned BindsToFunctionLvalue
Whether we're binding to a function lvalue.
Definition: Overload.h:302
clang::ImplicitConversionSequence::Ambiguous
AmbiguousConversionSequence Ambiguous
When ConversionKind == AmbiguousConversion, provides the details of the ambiguous conversion.
Definition: Overload.h:571
clang::Expr::getType
QualType getType() const
Definition: Expr.h:141
clang::ICK_Floating_Conversion
@ ICK_Floating_Conversion
Floating point conversions (C++ [conv.double].
Definition: Overload.h:137
clang::NK_Variable_Narrowing
@ NK_Variable_Narrowing
A narrowing conversion, because a non-constant-expression variable might have got narrowed.
Definition: Overload.h:244
clang::OverloadCandidateParamOrder::Normal
@ Normal
clang::NamedDecl::getDeclName
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:313
clang::ConversionSequenceList
llvm::MutableArrayRef< ImplicitConversionSequence > ConversionSequenceList
A list of implicit conversion sequences for the arguments of an OverloadCandidate.
Definition: Overload.h:804
clang::OverloadCandidateSet::size
size_t size() const
Definition: Overload.h:1109
clang::OverloadCandidate::BuiltinParamTypes
QualType BuiltinParamTypes[3]
BuiltinParamTypes - Provides the parameter types of a built-in overload candidate.
Definition: Overload.h:821
clang::ovl_fail_too_few_arguments
@ ovl_fail_too_few_arguments
Definition: Overload.h:739
clang::ICK_Num_Conversion_Kinds
@ ICK_Num_Conversion_Kinds
The number of conversion kinds.
Definition: Overload.h:194
clang::NarrowingKind
NarrowingKind
NarrowingKind - The kind of narrowing conversion being performed by a standard conversion sequence ac...
Definition: Overload.h:232
clang::OverloadCandidate::getRewriteKind
OverloadCandidateRewriteKind getRewriteKind() const
Get RewriteKind value in OverloadCandidateRewriteKind type (This function is to workaround the spurio...
Definition: Overload.h:887
clang::OverloadCandidate::hasAmbiguousConversion
bool hasAmbiguousConversion() const
hasAmbiguousConversion - Returns whether this overload candidate requires an ambiguous conversion or ...
Definition: Overload.h:895
clang::StandardConversionSequence::isPointerConversionToBool
bool isPointerConversionToBool() const
isPointerConversionToBool - Determines whether this conversion is a conversion of a pointer or pointe...
Definition: SemaOverload.cpp:227
clang::ImplicitConversionSequence::isInitializerListOfIncompleteArray
bool isInitializerListOfIncompleteArray() const
Definition: Overload.h:694
clang::QualType::getAsOpaquePtr
void * getAsOpaquePtr() const
Definition: Type.h:718
clang::BadConversionSequence::getFromType
QualType getFromType() const
Definition: Overload.h:502
clang::StandardConversionSequence::FoundCopyConstructor
DeclAccessPair FoundCopyConstructor
Definition: Overload.h:331
clang::ICK_Pointer_Conversion
@ ICK_Pointer_Conversion
Pointer conversions (C++ [conv.ptr])
Definition: Overload.h:146
clang::AmbiguousConversionSequence::Buffer
char Buffer[sizeof(ConversionSet)]
Definition: Overload.h:424
clang::OverloadFailureKind
OverloadFailureKind
Definition: Overload.h:737
clang::OverloadCandidateSet::begin
iterator begin()
Definition: Overload.h:1106
clang::APValue
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition: APValue.h:122
llvm::SmallVectorImpl
Definition: LLVM.h:39
clang::ovl_fail_enable_if
@ ovl_fail_enable_if
This candidate function was not viable because an enable_if attribute disabled it.
Definition: Overload.h:774
clang::Expr
This represents one expression.
Definition: Expr.h:109
clang::NK_Dependent_Narrowing
@ NK_Dependent_Narrowing
Cannot tell whether this is a narrowing conversion because the expression is value-dependent.
Definition: Overload.h:248
clang::StandardConversionSequence::BindsToRvalue
unsigned BindsToRvalue
Whether we're binding to an rvalue.
Definition: Overload.h:305
clang::OverloadCandidateSet::end
iterator end()
Definition: Overload.h:1107
clang::NK_Not_Narrowing
@ NK_Not_Narrowing
Not a narrowing conversion.
Definition: Overload.h:234
clang::ovl_fail_explicit
@ ovl_fail_explicit
This candidate constructor or conversion function is explicit but the context doesn't permit explicit...
Definition: Overload.h:778
clang::ImplicitConversionSequence::UserDefinedConversion
@ UserDefinedConversion
Definition: Overload.h:526
clang::AmbiguousConversionSequence::end
const_iterator end() const
Definition: Overload.h:457
clang::OverloadCandidateSet::CSK_Operator
@ CSK_Operator
C++ [over.match.oper]: Lookup of operator function candidates in a call using operator syntax.
Definition: Overload.h:947
clang::ICK_Qualification
@ ICK_Qualification
Qualification conversions (C++ [conv.qual])
Definition: Overload.h:122
clang::AmbiguousConversionSequence::const_iterator
ConversionSet::const_iterator const_iterator
Definition: Overload.h:454
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1856
clang::StandardConversionSequence::ToTypePtrs
void * ToTypePtrs[3]
ToType - The types that this conversion is converting to in each step.
Definition: Overload.h:323
clang::ovl_fail_too_many_arguments
@ ovl_fail_too_many_arguments
Definition: Overload.h:738
clang::CallExpr
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2795
clang::OverloadCandidateSet::empty
bool empty() const
Definition: Overload.h:1110
clang::UserDefinedConversionSequence::FoundConversionFunction
DeclAccessPair FoundConversionFunction
The declaration that we found via name lookup, which might be the same as ConversionFunction or it mi...
Definition: Overload.h:412
clang::ICK_Integral_Conversion
@ ICK_Integral_Conversion
Integral conversions (C++ [conv.integral])
Definition: Overload.h:134
clang::OverloadCandidate::isReversed
bool isReversed() const
Definition: Overload.h:891
clang::ICR_Writeback_Conversion
@ ICR_Writeback_Conversion
ObjC ARC writeback conversion.
Definition: Overload.h:218
clang::OverloadCandidate::Best
bool Best
Whether this candidate is the best viable function, or tied for being the best viable function.
Definition: Overload.h:845
clang::AmbiguousConversionSequence::addConversion
void addConversion(NamedDecl *Found, FunctionDecl *D)
Definition: Overload.h:445
clang::ImplicitConversionSequence
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
Definition: Overload.h:518
clang::UserDefinedConversionSequence::After
StandardConversionSequence After
After - Represents the standard conversion that occurs after the actual user-defined conversion.
Definition: Overload.h:402
clang::ImplicitConversionSequence::StandardConversion
@ StandardConversion
Definition: Overload.h:525
clang::AmbiguousConversionSequence::setToType
void setToType(QualType T)
Definition: Overload.h:435
clang::ImplicitConversionSequence::hasInitializerListContainerType
bool hasInitializerListContainerType() const
Definition: Overload.h:687
clang::ICK_Complex_Promotion
@ ICK_Complex_Promotion
Complex promotions (Clang extension)
Definition: Overload.h:131
clang::BadConversionSequence::init
void init(FailureKind K, Expr *From, QualType To)
Definition: Overload.h:490