clang  9.0.0svn
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 
74  /// ImplicitConversionKind - The kind of implicit conversion used to
75  /// convert an argument to a parameter's type. The enumerator values
76  /// match with the table titled 'Conversions' in [over.ics.scs] and are listed
77  /// such that better conversion kinds have smaller values.
79  /// Identity conversion (no conversion)
81 
82  /// Lvalue-to-rvalue conversion (C++ [conv.lval])
84 
85  /// Array-to-pointer conversion (C++ [conv.array])
87 
88  /// Function-to-pointer (C++ [conv.array])
90 
91  /// Function pointer conversion (C++17 [conv.fctptr])
93 
94  /// Qualification conversions (C++ [conv.qual])
96 
97  /// Integral promotions (C++ [conv.prom])
99 
100  /// Floating point promotions (C++ [conv.fpprom])
102 
103  /// Complex promotions (Clang extension)
105 
106  /// Integral conversions (C++ [conv.integral])
108 
109  /// Floating point conversions (C++ [conv.double]
111 
112  /// Complex conversions (C99 6.3.1.6)
114 
115  /// Floating-integral conversions (C++ [conv.fpint])
117 
118  /// Pointer conversions (C++ [conv.ptr])
120 
121  /// Pointer-to-member conversions (C++ [conv.mem])
123 
124  /// Boolean conversions (C++ [conv.bool])
126 
127  /// Conversions between compatible types in C99
129 
130  /// Derived-to-base (C++ [over.best.ics])
132 
133  /// Vector conversions
135 
136  /// A vector splat from an arithmetic type
138 
139  /// Complex-real conversions (C99 6.3.1.7)
141 
142  /// Block Pointer conversions
144 
145  /// Transparent Union Conversions
147 
148  /// Objective-C ARC writeback conversion
150 
151  /// Zero constant to event (OpenCL1.2 6.12.10)
153 
154  /// Zero constant to queue
156 
157  /// Conversions allowed in C, but not C++
159 
160  /// C-only conversion between pointers with incompatible types
162 
163  /// The number of conversion kinds
165  };
166 
167  /// ImplicitConversionRank - The rank of an implicit conversion
168  /// kind. The enumerator values match with Table 9 of (C++
169  /// 13.3.3.1.1) and are listed such that better conversion ranks
170  /// have smaller values.
172  /// Exact Match
174 
175  /// Promotion
177 
178  /// Conversion
180 
181  /// OpenCL Scalar Widening
183 
184  /// Complex <-> Real conversion
186 
187  /// ObjC ARC writeback conversion
189 
190  /// Conversion only allowed in the C standard (e.g. void* to char*).
192 
193  /// Conversion not allowed by the C standard, but that we accept as an
194  /// extension anyway.
196  };
197 
199 
200  /// NarrowingKind - The kind of narrowing conversion being performed by a
201  /// standard conversion sequence according to C++11 [dcl.init.list]p7.
203  /// Not a narrowing conversion.
205 
206  /// A narrowing conversion by virtue of the source and destination types.
208 
209  /// A narrowing conversion, because a constant expression got narrowed.
211 
212  /// A narrowing conversion, because a non-constant-expression variable might
213  /// have got narrowed.
215 
216  /// Cannot tell whether this is a narrowing conversion because the
217  /// expression is value-dependent.
219  };
220 
221  /// StandardConversionSequence - represents a standard conversion
222  /// sequence (C++ 13.3.3.1.1). A standard conversion sequence
223  /// contains between zero and three conversions. If a particular
224  /// conversion is not needed, it will be set to the identity conversion
225  /// (ICK_Identity). Note that the three conversions are
226  /// specified as separate members (rather than in an array) so that
227  /// we can keep the size of a standard conversion sequence to a
228  /// single word.
230  public:
231  /// First -- The first conversion can be an lvalue-to-rvalue
232  /// conversion, array-to-pointer conversion, or
233  /// function-to-pointer conversion.
235 
236  /// Second - The second conversion can be an integral promotion,
237  /// floating point promotion, integral conversion, floating point
238  /// conversion, floating-integral conversion, pointer conversion,
239  /// pointer-to-member conversion, or boolean conversion.
241 
242  /// Third - The third conversion can be a qualification conversion
243  /// or a function conversion.
245 
246  /// Whether this is the deprecated conversion of a
247  /// string literal to a pointer to non-const character data
248  /// (C++ 4.2p2).
250 
251  /// Whether the qualification conversion involves a change in the
252  /// Objective-C lifetime (for automatic reference counting).
254 
255  /// IncompatibleObjC - Whether this is an Objective-C conversion
256  /// that we should warn about (if we actually use it).
257  unsigned IncompatibleObjC : 1;
258 
259  /// ReferenceBinding - True when this is a reference binding
260  /// (C++ [over.ics.ref]).
261  unsigned ReferenceBinding : 1;
262 
263  /// DirectBinding - True when this is a reference binding that is a
264  /// direct binding (C++ [dcl.init.ref]).
265  unsigned DirectBinding : 1;
266 
267  /// Whether this is an lvalue reference binding (otherwise, it's
268  /// an rvalue reference binding).
269  unsigned IsLvalueReference : 1;
270 
271  /// Whether we're binding to a function lvalue.
272  unsigned BindsToFunctionLvalue : 1;
273 
274  /// Whether we're binding to an rvalue.
275  unsigned BindsToRvalue : 1;
276 
277  /// Whether this binds an implicit object argument to a
278  /// non-static member function without a ref-qualifier.
280 
281  /// Whether this binds a reference to an object with a different
282  /// Objective-C lifetime qualifier.
284 
285  /// FromType - The type that this conversion is converting
286  /// from. This is an opaque pointer that can be translated into a
287  /// QualType.
288  void *FromTypePtr;
289 
290  /// ToType - The types that this conversion is converting to in
291  /// each step. This is an opaque pointer that can be translated
292  /// into a QualType.
293  void *ToTypePtrs[3];
294 
295  /// CopyConstructor - The copy constructor that is used to perform
296  /// this conversion, when the conversion is actually just the
297  /// initialization of an object via copy constructor. Such
298  /// conversions are either identity conversions or derived-to-base
299  /// conversions.
302 
303  void setFromType(QualType T) { FromTypePtr = T.getAsOpaquePtr(); }
304 
305  void setToType(unsigned Idx, QualType T) {
306  assert(Idx < 3 && "To type index is out of range");
307  ToTypePtrs[Idx] = T.getAsOpaquePtr();
308  }
309 
311  ToTypePtrs[0] = T.getAsOpaquePtr();
312  ToTypePtrs[1] = ToTypePtrs[0];
313  ToTypePtrs[2] = ToTypePtrs[0];
314  }
315 
317  return QualType::getFromOpaquePtr(FromTypePtr);
318  }
319 
320  QualType getToType(unsigned Idx) const {
321  assert(Idx < 3 && "To type index is out of range");
322  return QualType::getFromOpaquePtr(ToTypePtrs[Idx]);
323  }
324 
326 
327  bool isIdentityConversion() const {
328  return Second == ICK_Identity && Third == ICK_Identity;
329  }
330 
333  getNarrowingKind(ASTContext &Context, const Expr *Converted,
334  APValue &ConstantValue, QualType &ConstantType,
335  bool IgnoreFloatToIntegralConversion = false) const;
336  bool isPointerConversionToBool() const;
337  bool isPointerConversionToVoidPointer(ASTContext& Context) const;
338  void dump() const;
339  };
340 
341  /// UserDefinedConversionSequence - Represents a user-defined
342  /// conversion sequence (C++ 13.3.3.1.2).
344  /// Represents the standard conversion that occurs before
345  /// the actual user-defined conversion.
346  ///
347  /// C++11 13.3.3.1.2p1:
348  /// If the user-defined conversion is specified by a constructor
349  /// (12.3.1), the initial standard conversion sequence converts
350  /// the source type to the type required by the argument of the
351  /// constructor. If the user-defined conversion is specified by
352  /// a conversion function (12.3.2), the initial standard
353  /// conversion sequence converts the source type to the implicit
354  /// object parameter of the conversion function.
356 
357  /// EllipsisConversion - When this is true, it means user-defined
358  /// conversion sequence starts with a ... (ellipsis) conversion, instead of
359  /// a standard conversion. In this case, 'Before' field must be ignored.
360  // FIXME. I much rather put this as the first field. But there seems to be
361  // a gcc code gen. bug which causes a crash in a test. Putting it here seems
362  // to work around the crash.
364 
365  /// HadMultipleCandidates - When this is true, it means that the
366  /// conversion function was resolved from an overloaded set having
367  /// size greater than 1.
369 
370  /// After - Represents the standard conversion that occurs after
371  /// the actual user-defined conversion.
373 
374  /// ConversionFunction - The function that will perform the
375  /// user-defined conversion. Null if the conversion is an
376  /// aggregate initialization from an initializer list.
378 
379  /// The declaration that we found via name lookup, which might be
380  /// the same as \c ConversionFunction or it might be a using declaration
381  /// that refers to \c ConversionFunction.
383 
384  void dump() const;
385  };
386 
387  /// Represents an ambiguous user-defined conversion sequence.
389  using ConversionSet =
391 
392  void *FromTypePtr;
393  void *ToTypePtr;
394  char Buffer[sizeof(ConversionSet)];
395 
397  return QualType::getFromOpaquePtr(FromTypePtr);
398  }
399 
400  QualType getToType() const {
401  return QualType::getFromOpaquePtr(ToTypePtr);
402  }
403 
404  void setFromType(QualType T) { FromTypePtr = T.getAsOpaquePtr(); }
405  void setToType(QualType T) { ToTypePtr = T.getAsOpaquePtr(); }
406 
408  return *reinterpret_cast<ConversionSet*>(Buffer);
409  }
410 
411  const ConversionSet &conversions() const {
412  return *reinterpret_cast<const ConversionSet*>(Buffer);
413  }
414 
416  conversions().push_back(std::make_pair(Found, D));
417  }
418 
419  using iterator = ConversionSet::iterator;
420 
421  iterator begin() { return conversions().begin(); }
422  iterator end() { return conversions().end(); }
423 
424  using const_iterator = ConversionSet::const_iterator;
425 
426  const_iterator begin() const { return conversions().begin(); }
427  const_iterator end() const { return conversions().end(); }
428 
429  void construct();
430  void destruct();
431  void copyFrom(const AmbiguousConversionSequence &);
432  };
433 
434  /// BadConversionSequence - Records information about an invalid
435  /// conversion sequence.
437  enum FailureKind {
442  rvalue_ref_to_lvalue
443  };
444 
445  // This can be null, e.g. for implicit object arguments.
447 
449 
450  private:
451  // The type we're converting from (an opaque QualType).
452  void *FromTy;
453 
454  // The type we're converting to (an opaque QualType).
455  void *ToTy;
456 
457  public:
458  void init(FailureKind K, Expr *From, QualType To) {
459  init(K, From->getType(), To);
460  FromExpr = From;
461  }
462 
463  void init(FailureKind K, QualType From, QualType To) {
464  Kind = K;
465  FromExpr = nullptr;
466  setFromType(From);
467  setToType(To);
468  }
469 
470  QualType getFromType() const { return QualType::getFromOpaquePtr(FromTy); }
472 
473  void setFromExpr(Expr *E) {
474  FromExpr = E;
475  setFromType(E->getType());
476  }
477 
478  void setFromType(QualType T) { FromTy = T.getAsOpaquePtr(); }
479  void setToType(QualType T) { ToTy = T.getAsOpaquePtr(); }
480  };
481 
482  /// ImplicitConversionSequence - Represents an implicit conversion
483  /// sequence, which may be a standard conversion sequence
484  /// (C++ 13.3.3.1.1), user-defined conversion sequence (C++ 13.3.3.1.2),
485  /// or an ellipsis conversion sequence (C++ 13.3.3.1.3).
487  public:
488  /// Kind - The kind of implicit conversion sequence. BadConversion
489  /// specifies that there is no conversion from the source type to
490  /// the target type. AmbiguousConversion represents the unique
491  /// ambiguous conversion (C++0x [over.best.ics]p10).
492  enum Kind {
493  StandardConversion = 0,
497  BadConversion
498  };
499 
500  private:
501  enum {
502  Uninitialized = BadConversion + 1
503  };
504 
505  /// ConversionKind - The kind of implicit conversion sequence.
506  unsigned ConversionKind : 30;
507 
508  /// Whether the target is really a std::initializer_list, and the
509  /// sequence only represents the worst element conversion.
510  unsigned StdInitializerListElement : 1;
511 
512  void setKind(Kind K) {
513  destruct();
514  ConversionKind = K;
515  }
516 
517  void destruct() {
518  if (ConversionKind == AmbiguousConversion) Ambiguous.destruct();
519  }
520 
521  public:
522  union {
523  /// When ConversionKind == StandardConversion, provides the
524  /// details of the standard conversion sequence.
526 
527  /// When ConversionKind == UserDefinedConversion, provides the
528  /// details of the user-defined conversion sequence.
530 
531  /// When ConversionKind == AmbiguousConversion, provides the
532  /// details of the ambiguous conversion.
534 
535  /// When ConversionKind == BadConversion, provides the details
536  /// of the bad conversion.
538  };
539 
541  : ConversionKind(Uninitialized), StdInitializerListElement(false) {
542  Standard.setAsIdentityConversion();
543  }
544 
546  : ConversionKind(Other.ConversionKind),
547  StdInitializerListElement(Other.StdInitializerListElement) {
548  switch (ConversionKind) {
549  case Uninitialized: break;
550  case StandardConversion: Standard = Other.Standard; break;
551  case UserDefinedConversion: UserDefined = Other.UserDefined; break;
552  case AmbiguousConversion: Ambiguous.copyFrom(Other.Ambiguous); break;
553  case EllipsisConversion: break;
554  case BadConversion: Bad = Other.Bad; break;
555  }
556  }
557 
560  destruct();
561  new (this) ImplicitConversionSequence(Other);
562  return *this;
563  }
564 
566  destruct();
567  }
568 
569  Kind getKind() const {
570  assert(isInitialized() && "querying uninitialized conversion");
571  return Kind(ConversionKind);
572  }
573 
574  /// Return a ranking of the implicit conversion sequence
575  /// kind, where smaller ranks represent better conversion
576  /// sequences.
577  ///
578  /// In particular, this routine gives user-defined conversion
579  /// sequences and ambiguous conversion sequences the same rank,
580  /// per C++ [over.best.ics]p10.
581  unsigned getKindRank() const {
582  switch (getKind()) {
583  case StandardConversion:
584  return 0;
585 
586  case UserDefinedConversion:
587  case AmbiguousConversion:
588  return 1;
589 
590  case EllipsisConversion:
591  return 2;
592 
593  case BadConversion:
594  return 3;
595  }
596 
597  llvm_unreachable("Invalid ImplicitConversionSequence::Kind!");
598  }
599 
600  bool isBad() const { return getKind() == BadConversion; }
601  bool isStandard() const { return getKind() == StandardConversion; }
602  bool isEllipsis() const { return getKind() == EllipsisConversion; }
603  bool isAmbiguous() const { return getKind() == AmbiguousConversion; }
604  bool isUserDefined() const { return getKind() == UserDefinedConversion; }
605  bool isFailure() const { return isBad() || isAmbiguous(); }
606 
607  /// Determines whether this conversion sequence has been
608  /// initialized. Most operations should never need to query
609  /// uninitialized conversions and should assert as above.
610  bool isInitialized() const { return ConversionKind != Uninitialized; }
611 
612  /// Sets this sequence as a bad conversion for an explicit argument.
614  Expr *FromExpr, QualType ToType) {
615  setKind(BadConversion);
616  Bad.init(Failure, FromExpr, ToType);
617  }
618 
619  /// Sets this sequence as a bad conversion for an implicit argument.
621  QualType FromType, QualType ToType) {
622  setKind(BadConversion);
623  Bad.init(Failure, FromType, ToType);
624  }
625 
626  void setStandard() { setKind(StandardConversion); }
627  void setEllipsis() { setKind(EllipsisConversion); }
628  void setUserDefined() { setKind(UserDefinedConversion); }
629 
630  void setAmbiguous() {
631  if (ConversionKind == AmbiguousConversion) return;
632  ConversionKind = AmbiguousConversion;
633  Ambiguous.construct();
634  }
635 
637  setStandard();
638  Standard.setAsIdentityConversion();
639  Standard.setFromType(T);
640  Standard.setAllToTypes(T);
641  }
642 
643  /// Whether the target is really a std::initializer_list, and the
644  /// sequence only represents the worst element conversion.
646  return StdInitializerListElement;
647  }
648 
649  void setStdInitializerListElement(bool V = true) {
650  StdInitializerListElement = V;
651  }
652 
653  // The result of a comparison between implicit conversion
654  // sequences. Use Sema::CompareImplicitConversionSequences to
655  // actually perform the comparison.
656  enum CompareKind {
657  Better = -1,
658  Indistinguishable = 0,
659  Worse = 1
660  };
661 
662  void DiagnoseAmbiguousConversion(Sema &S,
663  SourceLocation CaretLoc,
664  const PartialDiagnostic &PDiag) const;
665 
666  void dump() const;
667  };
668 
674 
675  /// This conversion candidate was not considered because it
676  /// duplicates the work of a trivial or derived-to-base
677  /// conversion.
679 
680  /// This conversion candidate was not considered because it is
681  /// an illegal instantiation of a constructor temploid: it is
682  /// callable with one argument, we only have one argument, and
683  /// its first parameter type is exactly the type of the class.
684  ///
685  /// Defining such a constructor directly is illegal, and
686  /// template-argument deduction is supposed to ignore such
687  /// instantiations, but we can still get one with the right
688  /// kind of implicit instantiation.
690 
691  /// This conversion candidate is not viable because its result
692  /// type is not implicitly convertible to the desired type.
694 
695  /// This conversion function template specialization candidate is not
696  /// viable because the final conversion was not an exact match.
698 
699  /// (CUDA) This candidate was not viable because the callee
700  /// was not accessible from the caller's target (i.e. host->device,
701  /// global->host, device->host).
703 
704  /// This candidate function was not viable because an enable_if
705  /// attribute disabled it.
707 
708  /// This candidate constructor or conversion fonction
709  /// is used implicitly but the explicit(bool) specifier
710  /// was resolved to true
712 
713  /// This candidate was not viable because its address could not be taken.
715 
716  /// This candidate was not viable because its OpenCL extension is disabled.
718 
719  /// This inherited constructor is not viable because it would slice the
720  /// argument.
722 
723  /// This candidate was not viable because it is a non-default multiversioned
724  /// function.
726 
727  /// This constructor/conversion candidate fail due to an address space
728  /// mismatch between the object being constructed and the overload
729  /// candidate.
731  };
732 
733  /// A list of implicit conversion sequences for the arguments of an
734  /// OverloadCandidate.
735  using ConversionSequenceList =
737 
738  /// OverloadCandidate - A single candidate in an overload set (C++ 13.3).
740  /// Function - The actual function that this candidate
741  /// represents. When NULL, this is a built-in candidate
742  /// (C++ [over.oper]) or a surrogate for a conversion to a
743  /// function pointer or reference (C++ [over.call.object]).
745 
746  /// FoundDecl - The original declaration that was looked up /
747  /// invented / otherwise found, together with its access.
748  /// Might be a UsingShadowDecl or a FunctionTemplateDecl.
750 
751  /// BuiltinParamTypes - Provides the parameter types of a built-in overload
752  /// candidate. Only valid when Function is NULL.
753  QualType BuiltinParamTypes[3];
754 
755  /// Surrogate - The conversion function for which this candidate
756  /// is a surrogate, but only if IsSurrogate is true.
758 
759  /// The conversion sequences used to convert the function arguments
760  /// to the function parameters.
762 
763  /// The FixIt hints which can be used to fix the Bad candidate.
765 
766  /// Viable - True to indicate that this overload candidate is viable.
767  bool Viable : 1;
768 
769  /// IsSurrogate - True to indicate that this candidate is a
770  /// surrogate for a conversion to a function pointer or reference
771  /// (C++ [over.call.object]).
772  bool IsSurrogate : 1;
773 
774  /// IgnoreObjectArgument - True to indicate that the first
775  /// argument's conversion, which for this function represents the
776  /// implicit object argument, should be ignored. This will be true
777  /// when the candidate is a static member function (where the
778  /// implicit object argument is just a placeholder) or a
779  /// non-static member function when the call doesn't have an
780  /// object argument.
782 
783  /// True if the candidate was found using ADL.
785 
786  /// FailureKind - The reason why this candidate is not viable.
787  /// Actually an OverloadFailureKind.
788  unsigned char FailureKind;
789 
790  /// The number of call arguments that were explicitly provided,
791  /// to be used while performing partial ordering of function templates.
793 
794  union {
796 
797  /// FinalConversion - For a conversion function (where Function is
798  /// a CXXConversionDecl), the standard conversion that occurs
799  /// after the call to the overload candidate to convert the result
800  /// of calling the conversion function to the required type.
802  };
803 
804  /// hasAmbiguousConversion - Returns whether this overload
805  /// candidate requires an ambiguous conversion or not.
806  bool hasAmbiguousConversion() const {
807  for (auto &C : Conversions) {
808  if (!C.isInitialized()) return false;
809  if (C.isAmbiguous()) return true;
810  }
811  return false;
812  }
813 
814  bool TryToFixBadConversion(unsigned Idx, Sema &S) {
815  bool CanFix = Fix.tryToFixConversion(
816  Conversions[Idx].Bad.FromExpr,
817  Conversions[Idx].Bad.getFromType(),
818  Conversions[Idx].Bad.getToType(), S);
819 
820  // If at least one conversion fails, the candidate cannot be fixed.
821  if (!CanFix)
822  Fix.clear();
823 
824  return CanFix;
825  }
826 
827  unsigned getNumParams() const {
828  if (IsSurrogate) {
829  auto STy = Surrogate->getConversionType();
830  while (STy->isPointerType() || STy->isReferenceType())
831  STy = STy->getPointeeType();
832  return STy->getAs<FunctionProtoType>()->getNumParams();
833  }
834  if (Function)
835  return Function->getNumParams();
836  return ExplicitCallArguments;
837  }
838 
839  private:
840  friend class OverloadCandidateSet;
841  OverloadCandidate() : IsADLCandidate(CallExpr::NotADL) {}
842  };
843 
844  /// OverloadCandidateSet - A set of overload candidates, used in C++
845  /// overload resolution (C++ 13.3).
847  public:
849  /// Normal lookup.
851 
852  /// C++ [over.match.oper]:
853  /// Lookup of operator function candidates in a call using operator
854  /// syntax. Candidates that have no parameters of class type will be
855  /// skipped unless there is a parameter of (reference to) enum type and
856  /// the corresponding argument is of the same enum type.
858 
859  /// C++ [over.match.copy]:
860  /// Copy-initialization of an object of class type by user-defined
861  /// conversion.
863 
864  /// C++ [over.match.ctor], [over.match.list]
865  /// Initialization of an object of class type by constructor,
866  /// using either a parenthesized or braced list of arguments.
868  };
869 
870  private:
872  llvm::SmallPtrSet<Decl *, 16> Functions;
873 
874  // Allocator for ConversionSequenceLists. We store the first few of these
875  // inline to avoid allocation for small sets.
876  llvm::BumpPtrAllocator SlabAllocator;
877 
878  SourceLocation Loc;
880 
881  constexpr static unsigned NumInlineBytes =
882  24 * sizeof(ImplicitConversionSequence);
883  unsigned NumInlineBytesUsed = 0;
884  llvm::AlignedCharArray<alignof(void *), NumInlineBytes> InlineSpace;
885 
886  // Address space of the object being constructed.
887  LangAS DestAS = LangAS::Default;
888 
889  /// If we have space, allocates from inline storage. Otherwise, allocates
890  /// from the slab allocator.
891  /// FIXME: It would probably be nice to have a SmallBumpPtrAllocator
892  /// instead.
893  /// FIXME: Now that this only allocates ImplicitConversionSequences, do we
894  /// want to un-generalize this?
895  template <typename T>
896  T *slabAllocate(unsigned N) {
897  // It's simpler if this doesn't need to consider alignment.
898  static_assert(alignof(T) == alignof(void *),
899  "Only works for pointer-aligned types.");
900  static_assert(std::is_trivial<T>::value ||
901  std::is_same<ImplicitConversionSequence, T>::value,
902  "Add destruction logic to OverloadCandidateSet::clear().");
903 
904  unsigned NBytes = sizeof(T) * N;
905  if (NBytes > NumInlineBytes - NumInlineBytesUsed)
906  return SlabAllocator.Allocate<T>(N);
907  char *FreeSpaceStart = InlineSpace.buffer + NumInlineBytesUsed;
908  assert(uintptr_t(FreeSpaceStart) % alignof(void *) == 0 &&
909  "Misaligned storage!");
910 
911  NumInlineBytesUsed += NBytes;
912  return reinterpret_cast<T *>(FreeSpaceStart);
913  }
914 
915  void destroyCandidates();
916 
917  public:
919  : Loc(Loc), Kind(CSK) {}
920  OverloadCandidateSet(const OverloadCandidateSet &) = delete;
921  OverloadCandidateSet &operator=(const OverloadCandidateSet &) = delete;
922  ~OverloadCandidateSet() { destroyCandidates(); }
923 
924  SourceLocation getLocation() const { return Loc; }
925  CandidateSetKind getKind() const { return Kind; }
926 
927  /// Determine when this overload candidate will be new to the
928  /// overload set.
929  bool isNewCandidate(Decl *F) {
930  return Functions.insert(F->getCanonicalDecl()).second;
931  }
932 
933  /// Clear out all of the candidates.
934  void clear(CandidateSetKind CSK);
935 
937 
938  iterator begin() { return Candidates.begin(); }
939  iterator end() { return Candidates.end(); }
940 
941  size_t size() const { return Candidates.size(); }
942  bool empty() const { return Candidates.empty(); }
943 
944  /// Allocate storage for conversion sequences for NumConversions
945  /// conversions.
947  allocateConversionSequences(unsigned NumConversions) {
948  ImplicitConversionSequence *Conversions =
949  slabAllocate<ImplicitConversionSequence>(NumConversions);
950 
951  // Construct the new objects.
952  for (unsigned I = 0; I != NumConversions; ++I)
953  new (&Conversions[I]) ImplicitConversionSequence();
954 
955  return ConversionSequenceList(Conversions, NumConversions);
956  }
957 
958  /// Add a new candidate with NumConversions conversion sequence slots
959  /// to the overload set.
960  OverloadCandidate &addCandidate(unsigned NumConversions = 0,
961  ConversionSequenceList Conversions = None) {
962  assert((Conversions.empty() || Conversions.size() == NumConversions) &&
963  "preallocated conversion sequence has wrong length");
964 
965  Candidates.push_back(OverloadCandidate());
966  OverloadCandidate &C = Candidates.back();
967  C.Conversions = Conversions.empty()
968  ? allocateConversionSequences(NumConversions)
969  : Conversions;
970  return C;
971  }
972 
973  /// Find the best viable function on this overload set, if it exists.
974  OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc,
976 
977  SmallVector<OverloadCandidate *, 32> CompleteCandidates(
979  SourceLocation OpLoc = SourceLocation(),
980  llvm::function_ref<bool(OverloadCandidate &)> Filter =
981  [](OverloadCandidate &) { return true; });
982 
983  void NoteCandidates(
985  ArrayRef<Expr *> Args, StringRef Opc = "",
987  llvm::function_ref<bool(OverloadCandidate &)> Filter =
988  [](OverloadCandidate &) { return true; });
989 
990  void NoteCandidates(Sema &S, ArrayRef<Expr *> Args,
992  StringRef Opc = "",
993  SourceLocation OpLoc = SourceLocation());
994 
995  LangAS getDestAS() { return DestAS; }
996 
997  void setDestAS(LangAS AS) {
998  assert((Kind == CSK_InitByConstructor ||
999  Kind == CSK_InitByUserDefinedConversion) &&
1000  "can't set the destination address space when not constructing an "
1001  "object");
1002  DestAS = AS;
1003  }
1004 
1005  };
1006 
1008  const OverloadCandidate &Cand1,
1009  const OverloadCandidate &Cand2,
1010  SourceLocation Loc,
1012 
1017 
1018  explicit operator bool() const { return Constructor; }
1019  };
1020 
1021  // FIXME: Add an AddOverloadCandidate / AddTemplateOverloadCandidate overload
1022  // that takes one of these.
1024  if (isa<UsingDecl>(ND))
1025  return ConstructorInfo{};
1026 
1027  // For constructors, the access check is performed against the underlying
1028  // declaration, not the found declaration.
1029  auto *D = ND->getUnderlyingDecl();
1030  ConstructorInfo Info = {DeclAccessPair::make(ND, D->getAccess()), nullptr,
1031  nullptr};
1032  Info.ConstructorTmpl = dyn_cast<FunctionTemplateDecl>(D);
1033  if (Info.ConstructorTmpl)
1034  D = Info.ConstructorTmpl->getTemplatedDecl();
1035  Info.Constructor = dyn_cast<CXXConstructorDecl>(D);
1036  return Info;
1037  }
1038 
1039 } // namespace clang
1040 
1041 #endif // LLVM_CLANG_SEMA_OVERLOAD_H
unsigned ExplicitCallArguments
The number of call arguments that were explicitly provided, to be used while performing partial order...
Definition: Overload.h:792
DeclAccessPair FoundConversionFunction
The declaration that we found via name lookup, which might be the same as ConversionFunction or it mi...
Definition: Overload.h:382
Function pointer conversion (C++17 [conv.fctptr])
Definition: Overload.h:92
unsigned DeprecatedStringLiteralToCharPtr
Whether this is the deprecated conversion of a string literal to a pointer to non-const character dat...
Definition: Overload.h:249
(CUDA) This candidate was not viable because the callee was not accessible from the caller&#39;s target (...
Definition: Overload.h:702
This candidate constructor or conversion fonction is used implicitly but the explicit(bool) specifier...
Definition: Overload.h:711
void setFromType(QualType T)
Definition: Overload.h:478
Represents a function declaration or definition.
Definition: Decl.h:1748
void setStdInitializerListElement(bool V=true)
Definition: Overload.h:649
bool EllipsisConversion
EllipsisConversion - When this is true, it means user-defined conversion sequence starts with a ...
Definition: Overload.h:363
A (possibly-)qualified type.
Definition: Type.h:643
ImplicitConversionKind
ImplicitConversionKind - The kind of implicit conversion used to convert an argument to a parameter&#39;s...
Definition: Overload.h:78
void setFromType(QualType T)
Definition: Overload.h:303
Conversion not allowed by the C standard, but that we accept as an extension anyway.
Definition: Overload.h:195
llvm::MutableArrayRef< ImplicitConversionSequence > ConversionSequenceList
A list of implicit conversion sequences for the arguments of an OverloadCandidate.
Definition: Overload.h:736
A structure used to record information about a failed template argument deduction, for diagnosis.
Cannot tell whether this is a narrowing conversion because the expression is value-dependent.
Definition: Overload.h:218
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
Definition: Type.cpp:505
Vector conversions.
Definition: Overload.h:134
C Language Family Type Representation.
bool tryToFixConversion(const Expr *FromExpr, const QualType FromQTy, const QualType ToQTy, Sema &S)
If possible, generates and stores a fix for the given conversion.
ConversionSet::const_iterator const_iterator
Definition: Overload.h:424
Complex conversions (C99 6.3.1.6)
Definition: Overload.h:113
UserDefinedConversionSequence UserDefined
When ConversionKind == UserDefinedConversion, provides the details of the user-defined conversion seq...
Definition: Overload.h:529
ConstructorInfo getConstructorInfo(NamedDecl *ND)
Definition: Overload.h:1023
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...
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
Defines the C++ template declaration subclasses.
Not a narrowing conversion.
Definition: Overload.h:204
ImplicitConversionRank
ImplicitConversionRank - The rank of an implicit conversion kind.
Definition: Overload.h:171
unsigned IncompatibleObjC
IncompatibleObjC - Whether this is an Objective-C conversion that we should warn about (if we actuall...
Definition: Overload.h:257
virtual void clear()
Ambiguous candidates found.
Definition: Overload.h:59
Conversions between compatible types in C99.
Definition: Overload.h:128
bool IgnoreObjectArgument
IgnoreObjectArgument - True to indicate that the first argument&#39;s conversion, which for this function...
Definition: Overload.h:781
QualType getConversionType() const
Returns the type that this conversion function is converting to.
Definition: DeclCXX.h:2928
unsigned DirectBinding
DirectBinding - True when this is a reference binding that is a direct binding (C++ [dcl...
Definition: Overload.h:265
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2566
Exact Match.
Definition: Overload.h:173
bool hasAmbiguousConversion() const
hasAmbiguousConversion - Returns whether this overload candidate requires an ambiguous conversion or ...
Definition: Overload.h:806
QualType getFromType() const
Definition: Overload.h:316
const T * getAs() const
Member-template getAs<specific type>&#39;.
Definition: Type.h:6851
bool IsSurrogate
IsSurrogate - True to indicate that this candidate is a surrogate for a conversion to a function poin...
Definition: Overload.h:772
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
Definition: AddressSpaces.h:25
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
Definition: Decl.h:431
bool HadMultipleCandidates
HadMultipleCandidates - When this is true, it means that the conversion function was resolved from an...
Definition: Overload.h:368
Conversion.
Definition: Overload.h:179
void * ToTypePtrs[3]
ToType - The types that this conversion is converting to in each step.
Definition: Overload.h:293
OverloadCandidate & addCandidate(unsigned NumConversions=0, ConversionSequenceList Conversions=None)
Add a new candidate with NumConversions conversion sequence slots to the overload set...
Definition: Overload.h:960
ImplicitConversionSequence(const ImplicitConversionSequence &Other)
Definition: Overload.h:545
Boolean conversions (C++ [conv.bool])
Definition: Overload.h:125
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:154
unsigned BindsToFunctionLvalue
Whether we&#39;re binding to a function lvalue.
Definition: Overload.h:272
C++ [over.match.copy]: Copy-initialization of an object of class type by user-defined conversion...
Definition: Overload.h:862
BadConversionSequence Bad
When ConversionKind == BadConversion, provides the details of the bad conversion. ...
Definition: Overload.h:537
Identity conversion (no conversion)
Definition: Overload.h:80
CallExpr::ADLCallKind IsADLCandidate
True if the candidate was found using ADL.
Definition: Overload.h:784
bool isStdInitializerListElement() const
Whether the target is really a std::initializer_list, and the sequence only represents the worst elem...
Definition: Overload.h:645
Kind
Kind - The kind of implicit conversion sequence.
Definition: Overload.h:492
ConversionSet & conversions()
Definition: Overload.h:407
BadConversionSequence - Records information about an invalid conversion sequence. ...
Definition: Overload.h:436
Floating point conversions (C++ [conv.double].
Definition: Overload.h:110
ConversionSequenceList allocateConversionSequences(unsigned NumConversions)
Allocate storage for conversion sequences for NumConversions conversions.
Definition: Overload.h:947
OverloadCandidateDisplayKind
Definition: Overload.h:65
Floating point promotions (C++ [conv.fpprom])
Definition: Overload.h:101
bool isInitialized() const
Determines whether this conversion sequence has been initialized.
Definition: Overload.h:610
unsigned BindsToRvalue
Whether we&#39;re binding to an rvalue.
Definition: Overload.h:275
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
void setDestAS(LangAS AS)
Definition: Overload.h:997
Succeeded, but refers to a deleted function.
Definition: Overload.h:62
ImplicitConversionSequence & operator=(const ImplicitConversionSequence &Other)
Definition: Overload.h:559
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
unsigned QualificationIncludesObjCLifetime
Whether the qualification conversion involves a change in the Objective-C lifetime (for automatic ref...
Definition: Overload.h:253
QualType getToType(unsigned Idx) const
Definition: Overload.h:320
This candidate function was not viable because an enable_if attribute disabled it.
Definition: Overload.h:706
ImplicitConversionKind Second
Second - The second conversion can be an integral promotion, floating point promotion, integral conversion, floating point conversion, floating-integral conversion, pointer conversion, pointer-to-member conversion, or boolean conversion.
Definition: Overload.h:240
A narrowing conversion, because a constant expression got narrowed.
Definition: Overload.h:210
unsigned IsLvalueReference
Whether this is an lvalue reference binding (otherwise, it&#39;s an rvalue reference binding).
Definition: Overload.h:269
NarrowingKind
NarrowingKind - The kind of narrowing conversion being performed by a standard conversion sequence ac...
Definition: Overload.h:202
Qualification conversions (C++ [conv.qual])
Definition: Overload.h:95
void * getAsOpaquePtr() const
Definition: Type.h:688
The number of conversion kinds.
Definition: Overload.h:164
ImplicitConversionKind Third
Third - The third conversion can be a qualification conversion or a function conversion.
Definition: Overload.h:244
Complex <-> Real conversion.
Definition: Overload.h:185
bool Viable
Viable - True to indicate that this overload candidate is viable.
Definition: Overload.h:767
ConversionSequenceList Conversions
The conversion sequences used to convert the function arguments to the function parameters.
Definition: Overload.h:761
Integral promotions (C++ [conv.prom])
Definition: Overload.h:98
This conversion function template specialization candidate is not viable because the final conversion...
Definition: Overload.h:697
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:877
void setAsIdentityConversion(QualType T)
Definition: Overload.h:636
C-only conversion between pointers with incompatible types.
Definition: Overload.h:161
DeclAccessPair FoundDecl
Definition: Overload.h:1014
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:328
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3719
Transparent Union Conversions.
Definition: Overload.h:146
This conversion candidate was not considered because it duplicates the work of a trivial or derived-t...
Definition: Overload.h:678
CandidateSetKind getKind() const
Definition: Overload.h:925
bool isNewCandidate(Decl *F)
Determine when this overload candidate will be new to the overload set.
Definition: Overload.h:929
A narrowing conversion by virtue of the source and destination types.
Definition: Overload.h:207
Promotion.
Definition: Overload.h:176
StandardConversionSequence FinalConversion
FinalConversion - For a conversion function (where Function is a CXXConversionDecl), the standard conversion that occurs after the call to the overload candidate to convert the result of calling the conversion function to the required type.
Definition: Overload.h:801
ObjC ARC writeback conversion.
Definition: Overload.h:188
OpenCL Scalar Widening.
Definition: Overload.h:182
This represents one expression.
Definition: Expr.h:108
Represents an ambiguous user-defined conversion sequence.
Definition: Overload.h:388
This candidate was not viable because it is a non-default multiversioned function.
Definition: Overload.h:725
This inherited constructor is not viable because it would slice the argument.
Definition: Overload.h:721
SourceLocation getLocation() const
Definition: Overload.h:924
StandardConversionSequence After
After - Represents the standard conversion that occurs after the actual user-defined conversion...
Definition: Overload.h:372
#define V(N, I)
Definition: ASTContext.h:2907
__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:62
Zero constant to queue.
Definition: Overload.h:155
#define bool
Definition: stdbool.h:15
CXXConstructorDecl * CopyConstructor
CopyConstructor - The copy constructor that is used to perform this conversion, when the conversion i...
Definition: Overload.h:300
Overload resolution succeeded.
Definition: Overload.h:53
unsigned ReferenceBinding
ReferenceBinding - True when this is a reference binding (C++ [over.ics.ref]).
Definition: Overload.h:261
Floating-integral conversions (C++ [conv.fpint])
Definition: Overload.h:116
void init(FailureKind K, Expr *From, QualType To)
Definition: Overload.h:458
This conversion candidate was not considered because it is an illegal instantiation of a constructor ...
Definition: Overload.h:689
bool TryToFixBadConversion(unsigned Idx, Sema &S)
Definition: Overload.h:814
QualType getType() const
Definition: Expr.h:137
CXXConversionDecl * Surrogate
Surrogate - The conversion function for which this candidate is a surrogate, but only if IsSurrogate ...
Definition: Overload.h:757
UserDefinedConversionSequence - Represents a user-defined conversion sequence (C++ 13...
Definition: Overload.h:343
This candidate was not viable because its address could not be taken.
Definition: Overload.h:714
const ConversionSet & conversions() const
Definition: Overload.h:411
StandardConversionSequence Standard
When ConversionKind == StandardConversion, provides the details of the standard conversion sequence...
Definition: Overload.h:525
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2891
A narrowing conversion, because a non-constant-expression variable might have got narrowed...
Definition: Overload.h:214
QualType getFromType() const
Definition: Overload.h:470
Lvalue-to-rvalue conversion (C++ [conv.lval])
Definition: Overload.h:83
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...
OverloadFailureKind
Definition: Overload.h:669
unsigned ObjCLifetimeConversionBinding
Whether this binds a reference to an object with a different Objective-C lifetime qualifier...
Definition: Overload.h:283
CXXConstructorDecl * Constructor
Definition: Overload.h:1015
llvm::cl::opt< std::string > Filter
Integral conversions (C++ [conv.integral])
Definition: Overload.h:107
SmallVectorImpl< OverloadCandidate >::iterator iterator
Definition: Overload.h:936
Complex promotions (Clang extension)
Definition: Overload.h:104
#define false
Definition: stdbool.h:17
Kind
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
Definition: Overload.h:486
bool isPointerConversionToVoidPointer(ASTContext &Context) const
isPointerConversionToVoidPointer - Determines whether this conversion is a conversion of a pointer to...
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
Definition: Overload.h:739
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Encodes a location in the source.
C++ [over.match.ctor], [over.match.list] Initialization of an object of class type by constructor...
Definition: Overload.h:867
ConversionSet::iterator iterator
Definition: Overload.h:419
A vector splat from an arithmetic type.
Definition: Overload.h:137
OverloadingResult
OverloadingResult - Capture the result of performing overload resolution.
Definition: Overload.h:51
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs. ...
Objective-C ARC writeback conversion.
Definition: Overload.h:149
void init(FailureKind K, QualType From, QualType To)
Definition: Overload.h:463
void setAsIdentityConversion()
StandardConversionSequence - Set the standard conversion sequence to the identity conversion...
Pointer conversions (C++ [conv.ptr])
Definition: Overload.h:119
C++ [over.match.oper]: Lookup of operator function candidates in a call using operator syntax...
Definition: Overload.h:857
Requests that all candidates be shown.
Definition: Overload.h:68
Derived-to-base (C++ [over.best.ics])
Definition: Overload.h:131
Complex-real conversions (C99 6.3.1.7)
Definition: Overload.h:140
This constructor/conversion candidate fail due to an address space mismatch between the object being ...
Definition: Overload.h:730
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13...
Definition: Overload.h:846
void setBad(BadConversionSequence::FailureKind Failure, Expr *FromExpr, QualType ToType)
Sets this sequence as a bad conversion for an explicit argument.
Definition: Overload.h:613
static QualType getFromOpaquePtr(const void *Ptr)
Definition: Type.h:690
void setFromExpr(Expr *E)
Definition: Overload.h:473
unsigned getNumParams() const
Definition: Overload.h:827
bool isPointerConversionToBool() const
isPointerConversionToBool - Determines whether this conversion is a conversion of a pointer or pointe...
A POD class for pairing a NamedDecl* with an access specifier.
ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind)
GetConversionRank - Retrieve the implicit conversion rank corresponding to the given implicit convers...
DeclAccessPair FoundCopyConstructor
Definition: Overload.h:301
OverloadCandidateSet(SourceLocation Loc, CandidateSetKind CSK)
Definition: Overload.h:918
Dataflow Directional Tag Classes.
AccessSpecifier getAccess() const
Definition: DeclBase.h:473
Conversions allowed in C, but not C++.
Definition: Overload.h:158
Array-to-pointer conversion (C++ [conv.array])
Definition: Overload.h:86
StandardConversionSequence Before
Represents the standard conversion that occurs before the actual user-defined conversion.
Definition: Overload.h:355
Requests that only viable candidates be shown.
Definition: Overload.h:71
FunctionDecl * Function
Function - The actual function that this candidate represents.
Definition: Overload.h:744
FunctionDecl * ConversionFunction
ConversionFunction - The function that will perform the user-defined conversion.
Definition: Overload.h:377
Conversion only allowed in the C standard (e.g. void* to char*).
Definition: Overload.h:191
void setToType(QualType T)
Definition: Overload.h:479
void setAllToTypes(QualType T)
Definition: Overload.h:310
unsigned getKindRank() const
Return a ranking of the implicit conversion sequence kind, where smaller ranks represent better conve...
Definition: Overload.h:581
This candidate was not viable because its OpenCL extension is disabled.
Definition: Overload.h:717
unsigned BindsImplicitObjectArgumentWithoutRefQualifier
Whether this binds an implicit object argument to a non-static member function without a ref-qualifie...
Definition: Overload.h:279
unsigned char FailureKind
FailureKind - The reason why this candidate is not viable.
Definition: Overload.h:788
void setBad(BadConversionSequence::FailureKind Failure, QualType FromType, QualType ToType)
Sets this sequence as a bad conversion for an implicit argument.
Definition: Overload.h:620
DeclAccessPair FoundDecl
FoundDecl - The original declaration that was looked up / invented / otherwise found, together with its access.
Definition: Overload.h:749
Block Pointer conversions.
Definition: Overload.h:143
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
Definition: APValue.h:76
ConversionFixItGenerator Fix
The FixIt hints which can be used to fix the Bad candidate.
Definition: Overload.h:764
AmbiguousConversionSequence Ambiguous
When ConversionKind == AmbiguousConversion, provides the details of the ambiguous conversion...
Definition: Overload.h:533
void addConversion(NamedDecl *Found, FunctionDecl *D)
Definition: Overload.h:415
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
Function-to-pointer (C++ [conv.array])
Definition: Overload.h:89
Defines the clang::SourceLocation class and associated facilities.
QualType getToType() const
Definition: Overload.h:471
FunctionTemplateDecl * ConstructorTmpl
Definition: Overload.h:1016
const_iterator begin() const
Definition: Overload.h:426
void * FromTypePtr
FromType - The type that this conversion is converting from.
Definition: Overload.h:288
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2516
ImplicitConversionRank getRank() const
getRank - Retrieve the rank of this standard conversion sequence (C++ 13.3.3.1.1p3).
static Decl::Kind getKind(const Decl *D)
Definition: DeclBase.cpp:944
The class facilities generation and storage of conversion FixIts.
Zero constant to event (OpenCL1.2 6.12.10)
Definition: Overload.h:152
ImplicitConversionKind First
First – The first conversion can be an lvalue-to-rvalue conversion, array-to-pointer conversion...
Definition: Overload.h:234
No viable function found.
Definition: Overload.h:56
DeductionFailureInfo DeductionFailure
Definition: Overload.h:795
This represents a decl that may have a name.
Definition: Decl.h:248
void dump() const
dump - Print this standard conversion sequence to standard error.
Pointer-to-member conversions (C++ [conv.mem])
Definition: Overload.h:122
void setToType(unsigned Idx, QualType T)
Definition: Overload.h:305
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
Definition: Decl.cpp:3138
This conversion candidate is not viable because its result type is not implicitly convertible to the ...
Definition: Overload.h:693
const_iterator end() const
Definition: Overload.h:427
Declaration of a template function.
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3.1.1).
Definition: Overload.h:229