clang  13.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 {
473  };
474 
475  // This can be null, e.g. for implicit object arguments.
477 
479 
480  private:
481  // The type we're converting from (an opaque QualType).
482  void *FromTy;
483 
484  // The type we're converting to (an opaque QualType).
485  void *ToTy;
486 
487  public:
488  void init(FailureKind K, Expr *From, QualType To) {
489  init(K, From->getType(), To);
490  FromExpr = From;
491  }
492 
493  void init(FailureKind K, QualType From, QualType To) {
494  Kind = K;
495  FromExpr = nullptr;
496  setFromType(From);
497  setToType(To);
498  }
499 
500  QualType getFromType() const { return QualType::getFromOpaquePtr(FromTy); }
502 
503  void setFromExpr(Expr *E) {
504  FromExpr = E;
505  setFromType(E->getType());
506  }
507 
508  void setFromType(QualType T) { FromTy = T.getAsOpaquePtr(); }
509  void setToType(QualType T) { ToTy = T.getAsOpaquePtr(); }
510  };
511 
512  /// ImplicitConversionSequence - Represents an implicit conversion
513  /// sequence, which may be a standard conversion sequence
514  /// (C++ 13.3.3.1.1), user-defined conversion sequence (C++ 13.3.3.1.2),
515  /// or an ellipsis conversion sequence (C++ 13.3.3.1.3).
517  public:
518  /// Kind - The kind of implicit conversion sequence. BadConversion
519  /// specifies that there is no conversion from the source type to
520  /// the target type. AmbiguousConversion represents the unique
521  /// ambiguous conversion (C++0x [over.best.ics]p10).
522  enum Kind {
528  };
529 
530  private:
531  enum {
532  Uninitialized = BadConversion + 1
533  };
534 
535  /// ConversionKind - The kind of implicit conversion sequence.
536  unsigned ConversionKind : 30;
537 
538  /// Whether the target is really a std::initializer_list, and the
539  /// sequence only represents the worst element conversion.
540  unsigned StdInitializerListElement : 1;
541 
542  void setKind(Kind K) {
543  destruct();
544  ConversionKind = K;
545  }
546 
547  void destruct() {
548  if (ConversionKind == AmbiguousConversion) Ambiguous.destruct();
549  }
550 
551  public:
552  union {
553  /// When ConversionKind == StandardConversion, provides the
554  /// details of the standard conversion sequence.
556 
557  /// When ConversionKind == UserDefinedConversion, provides the
558  /// details of the user-defined conversion sequence.
560 
561  /// When ConversionKind == AmbiguousConversion, provides the
562  /// details of the ambiguous conversion.
564 
565  /// When ConversionKind == BadConversion, provides the details
566  /// of the bad conversion.
568  };
569 
571  : ConversionKind(Uninitialized), StdInitializerListElement(false) {
573  }
574 
576  : ConversionKind(Other.ConversionKind),
577  StdInitializerListElement(Other.StdInitializerListElement) {
578  switch (ConversionKind) {
579  case Uninitialized: break;
580  case StandardConversion: Standard = Other.Standard; break;
581  case UserDefinedConversion: UserDefined = Other.UserDefined; break;
582  case AmbiguousConversion: Ambiguous.copyFrom(Other.Ambiguous); break;
583  case EllipsisConversion: break;
584  case BadConversion: Bad = Other.Bad; break;
585  }
586  }
587 
590  destruct();
591  new (this) ImplicitConversionSequence(Other);
592  return *this;
593  }
594 
596  destruct();
597  }
598 
599  Kind getKind() const {
600  assert(isInitialized() && "querying uninitialized conversion");
601  return Kind(ConversionKind);
602  }
603 
604  /// Return a ranking of the implicit conversion sequence
605  /// kind, where smaller ranks represent better conversion
606  /// sequences.
607  ///
608  /// In particular, this routine gives user-defined conversion
609  /// sequences and ambiguous conversion sequences the same rank,
610  /// per C++ [over.best.ics]p10.
611  unsigned getKindRank() const {
612  switch (getKind()) {
613  case StandardConversion:
614  return 0;
615 
617  case AmbiguousConversion:
618  return 1;
619 
620  case EllipsisConversion:
621  return 2;
622 
623  case BadConversion:
624  return 3;
625  }
626 
627  llvm_unreachable("Invalid ImplicitConversionSequence::Kind!");
628  }
629 
630  bool isBad() const { return getKind() == BadConversion; }
631  bool isStandard() const { return getKind() == StandardConversion; }
632  bool isEllipsis() const { return getKind() == EllipsisConversion; }
633  bool isAmbiguous() const { return getKind() == AmbiguousConversion; }
634  bool isUserDefined() const { return getKind() == UserDefinedConversion; }
635  bool isFailure() const { return isBad() || isAmbiguous(); }
636 
637  /// Determines whether this conversion sequence has been
638  /// initialized. Most operations should never need to query
639  /// uninitialized conversions and should assert as above.
640  bool isInitialized() const { return ConversionKind != Uninitialized; }
641 
642  /// Sets this sequence as a bad conversion for an explicit argument.
644  Expr *FromExpr, QualType ToType) {
645  setKind(BadConversion);
646  Bad.init(Failure, FromExpr, ToType);
647  }
648 
649  /// Sets this sequence as a bad conversion for an implicit argument.
651  QualType FromType, QualType ToType) {
652  setKind(BadConversion);
653  Bad.init(Failure, FromType, ToType);
654  }
655 
656  void setStandard() { setKind(StandardConversion); }
657  void setEllipsis() { setKind(EllipsisConversion); }
659 
660  void setAmbiguous() {
661  if (ConversionKind == AmbiguousConversion) return;
662  ConversionKind = AmbiguousConversion;
664  }
665 
667  setStandard();
671  }
672 
673  /// Whether the target is really a std::initializer_list, and the
674  /// sequence only represents the worst element conversion.
676  return StdInitializerListElement;
677  }
678 
679  void setStdInitializerListElement(bool V = true) {
680  StdInitializerListElement = V;
681  }
682 
683  /// Form an "implicit" conversion sequence from nullptr_t to bool, for a
684  /// direct-initialization of a bool object from nullptr_t.
686  QualType DestType,
687  bool NeedLValToRVal) {
689  ICS.setStandard();
691  ICS.Standard.setFromType(SourceType);
692  if (NeedLValToRVal)
694  ICS.Standard.setToType(0, SourceType);
696  ICS.Standard.setToType(1, DestType);
697  ICS.Standard.setToType(2, DestType);
698  return ICS;
699  }
700 
701  // The result of a comparison between implicit conversion
702  // sequences. Use Sema::CompareImplicitConversionSequences to
703  // actually perform the comparison.
704  enum CompareKind {
705  Better = -1,
707  Worse = 1
708  };
709 
711  SourceLocation CaretLoc,
712  const PartialDiagnostic &PDiag) const;
713 
714  void dump() const;
715  };
716 
722 
723  /// This conversion candidate was not considered because it
724  /// duplicates the work of a trivial or derived-to-base
725  /// conversion.
727 
728  /// This conversion candidate was not considered because it is
729  /// an illegal instantiation of a constructor temploid: it is
730  /// callable with one argument, we only have one argument, and
731  /// its first parameter type is exactly the type of the class.
732  ///
733  /// Defining such a constructor directly is illegal, and
734  /// template-argument deduction is supposed to ignore such
735  /// instantiations, but we can still get one with the right
736  /// kind of implicit instantiation.
738 
739  /// This conversion candidate is not viable because its result
740  /// type is not implicitly convertible to the desired type.
742 
743  /// This conversion function template specialization candidate is not
744  /// viable because the final conversion was not an exact match.
746 
747  /// (CUDA) This candidate was not viable because the callee
748  /// was not accessible from the caller's target (i.e. host->device,
749  /// global->host, device->host).
751 
752  /// This candidate function was not viable because an enable_if
753  /// attribute disabled it.
755 
756  /// This candidate constructor or conversion function is explicit but
757  /// the context doesn't permit explicit functions.
759 
760  /// This candidate was not viable because its address could not be taken.
762 
763  /// This candidate was not viable because its OpenCL extension is disabled.
765 
766  /// This inherited constructor is not viable because it would slice the
767  /// argument.
769 
770  /// This candidate was not viable because it is a non-default multiversioned
771  /// function.
773 
774  /// This constructor/conversion candidate fail due to an address space
775  /// mismatch between the object being constructed and the overload
776  /// candidate.
778 
779  /// This candidate was not viable because its associated constraints were
780  /// not satisfied.
782  };
783 
784  /// A list of implicit conversion sequences for the arguments of an
785  /// OverloadCandidate.
786  using ConversionSequenceList =
788 
789  /// OverloadCandidate - A single candidate in an overload set (C++ 13.3).
791  /// Function - The actual function that this candidate
792  /// represents. When NULL, this is a built-in candidate
793  /// (C++ [over.oper]) or a surrogate for a conversion to a
794  /// function pointer or reference (C++ [over.call.object]).
796 
797  /// FoundDecl - The original declaration that was looked up /
798  /// invented / otherwise found, together with its access.
799  /// Might be a UsingShadowDecl or a FunctionTemplateDecl.
801 
802  /// BuiltinParamTypes - Provides the parameter types of a built-in overload
803  /// candidate. Only valid when Function is NULL.
805 
806  /// Surrogate - The conversion function for which this candidate
807  /// is a surrogate, but only if IsSurrogate is true.
809 
810  /// The conversion sequences used to convert the function arguments
811  /// to the function parameters. Note that these are indexed by argument,
812  /// so may not match the parameter order of Function.
814 
815  /// The FixIt hints which can be used to fix the Bad candidate.
817 
818  /// Viable - True to indicate that this overload candidate is viable.
819  bool Viable : 1;
820 
821  /// Whether this candidate is the best viable function, or tied for being
822  /// the best viable function.
823  ///
824  /// For an ambiguous overload resolution, indicates whether this candidate
825  /// was part of the ambiguity kernel: the minimal non-empty set of viable
826  /// candidates such that all elements of the ambiguity kernel are better
827  /// than all viable candidates not in the ambiguity kernel.
828  bool Best : 1;
829 
830  /// IsSurrogate - True to indicate that this candidate is a
831  /// surrogate for a conversion to a function pointer or reference
832  /// (C++ [over.call.object]).
833  bool IsSurrogate : 1;
834 
835  /// IgnoreObjectArgument - True to indicate that the first
836  /// argument's conversion, which for this function represents the
837  /// implicit object argument, should be ignored. This will be true
838  /// when the candidate is a static member function (where the
839  /// implicit object argument is just a placeholder) or a
840  /// non-static member function when the call doesn't have an
841  /// object argument.
843 
844  /// True if the candidate was found using ADL.
846 
847  /// Whether this is a rewritten candidate, and if so, of what kind?
848  unsigned RewriteKind : 2;
849 
850  /// FailureKind - The reason why this candidate is not viable.
851  /// Actually an OverloadFailureKind.
852  unsigned char FailureKind;
853 
854  /// The number of call arguments that were explicitly provided,
855  /// to be used while performing partial ordering of function templates.
857 
858  union {
860 
861  /// FinalConversion - For a conversion function (where Function is
862  /// a CXXConversionDecl), the standard conversion that occurs
863  /// after the call to the overload candidate to convert the result
864  /// of calling the conversion function to the required type.
866  };
867 
868  /// Get RewriteKind value in OverloadCandidateRewriteKind type (This
869  /// function is to workaround the spurious GCC bitfield enum warning)
871  return static_cast<OverloadCandidateRewriteKind>(RewriteKind);
872  }
873 
874  bool isReversed() const { return getRewriteKind() & CRK_Reversed; }
875 
876  /// hasAmbiguousConversion - Returns whether this overload
877  /// candidate requires an ambiguous conversion or not.
878  bool hasAmbiguousConversion() const {
879  for (auto &C : Conversions) {
880  if (!C.isInitialized()) return false;
881  if (C.isAmbiguous()) return true;
882  }
883  return false;
884  }
885 
886  bool TryToFixBadConversion(unsigned Idx, Sema &S) {
887  bool CanFix = Fix.tryToFixConversion(
888  Conversions[Idx].Bad.FromExpr,
889  Conversions[Idx].Bad.getFromType(),
890  Conversions[Idx].Bad.getToType(), S);
891 
892  // If at least one conversion fails, the candidate cannot be fixed.
893  if (!CanFix)
894  Fix.clear();
895 
896  return CanFix;
897  }
898 
899  unsigned getNumParams() const {
900  if (IsSurrogate) {
902  while (STy->isPointerType() || STy->isReferenceType())
903  STy = STy->getPointeeType();
904  return STy->castAs<FunctionProtoType>()->getNumParams();
905  }
906  if (Function)
907  return Function->getNumParams();
908  return ExplicitCallArguments;
909  }
910 
911  private:
912  friend class OverloadCandidateSet;
915  };
916 
917  /// OverloadCandidateSet - A set of overload candidates, used in C++
918  /// overload resolution (C++ 13.3).
920  public:
922  /// Normal lookup.
924 
925  /// C++ [over.match.oper]:
926  /// Lookup of operator function candidates in a call using operator
927  /// syntax. Candidates that have no parameters of class type will be
928  /// skipped unless there is a parameter of (reference to) enum type and
929  /// the corresponding argument is of the same enum type.
931 
932  /// C++ [over.match.copy]:
933  /// Copy-initialization of an object of class type by user-defined
934  /// conversion.
936 
937  /// C++ [over.match.ctor], [over.match.list]
938  /// Initialization of an object of class type by constructor,
939  /// using either a parenthesized or braced list of arguments.
941  };
942 
943  /// Information about operator rewrites to consider when adding operator
944  /// functions to a candidate set.
949  : OriginalOperator(Op), AllowRewrittenCandidates(AllowRewritten) {}
950 
951  /// The original operator as written in the source.
953  /// Whether we should include rewritten candidates in the overload set.
955 
956  /// Would use of this function result in a rewrite using a different
957  /// operator?
959  return OriginalOperator &&
961  }
962 
964  if (!OriginalOperator)
965  return true;
966 
967  // For an overloaded operator, we can have candidates with a different
968  // name in our unqualified lookup set. Make sure we only consider the
969  // ones we're supposed to.
972  return OO && (OO == OriginalOperator ||
975  }
976 
977  /// Determine the kind of rewrite that should be performed for this
978  /// candidate.
982  if (isRewrittenOperator(FD))
986  return CRK;
987  }
988 
989  /// Determines whether this operator could be implemented by a function
990  /// with reversed parameter order.
991  bool isReversible() {
995  }
996 
997  /// Determine whether we should consider looking for and adding reversed
998  /// candidates for operator Op.
1000 
1001  /// Determine whether we should add a rewritten candidate for \p FD with
1002  /// reversed parameter order.
1003  bool shouldAddReversed(ASTContext &Ctx, const FunctionDecl *FD);
1004  };
1005 
1006  private:
1009 
1010  // Allocator for ConversionSequenceLists. We store the first few of these
1011  // inline to avoid allocation for small sets.
1012  llvm::BumpPtrAllocator SlabAllocator;
1013 
1014  SourceLocation Loc;
1015  CandidateSetKind Kind;
1016  OperatorRewriteInfo RewriteInfo;
1017 
1018  constexpr static unsigned NumInlineBytes =
1019  24 * sizeof(ImplicitConversionSequence);
1020  unsigned NumInlineBytesUsed = 0;
1021  alignas(void *) char InlineSpace[NumInlineBytes];
1022 
1023  // Address space of the object being constructed.
1024  LangAS DestAS = LangAS::Default;
1025 
1026  /// If we have space, allocates from inline storage. Otherwise, allocates
1027  /// from the slab allocator.
1028  /// FIXME: It would probably be nice to have a SmallBumpPtrAllocator
1029  /// instead.
1030  /// FIXME: Now that this only allocates ImplicitConversionSequences, do we
1031  /// want to un-generalize this?
1032  template <typename T>
1033  T *slabAllocate(unsigned N) {
1034  // It's simpler if this doesn't need to consider alignment.
1035  static_assert(alignof(T) == alignof(void *),
1036  "Only works for pointer-aligned types.");
1037  static_assert(std::is_trivial<T>::value ||
1038  std::is_same<ImplicitConversionSequence, T>::value,
1039  "Add destruction logic to OverloadCandidateSet::clear().");
1040 
1041  unsigned NBytes = sizeof(T) * N;
1042  if (NBytes > NumInlineBytes - NumInlineBytesUsed)
1043  return SlabAllocator.Allocate<T>(N);
1044  char *FreeSpaceStart = InlineSpace + NumInlineBytesUsed;
1045  assert(uintptr_t(FreeSpaceStart) % alignof(void *) == 0 &&
1046  "Misaligned storage!");
1047 
1048  NumInlineBytesUsed += NBytes;
1049  return reinterpret_cast<T *>(FreeSpaceStart);
1050  }
1051 
1052  void destroyCandidates();
1053 
1054  /// Whether diagnostics should be deferred.
1055  bool shouldDeferDiags(Sema &S, ArrayRef<Expr *> Args, SourceLocation OpLoc);
1056 
1057  public:
1059  OperatorRewriteInfo RewriteInfo = {})
1060  : Loc(Loc), Kind(CSK), RewriteInfo(RewriteInfo) {}
1061  OverloadCandidateSet(const OverloadCandidateSet &) = delete;
1063  ~OverloadCandidateSet() { destroyCandidates(); }
1064 
1065  SourceLocation getLocation() const { return Loc; }
1066  CandidateSetKind getKind() const { return Kind; }
1067  OperatorRewriteInfo getRewriteInfo() const { return RewriteInfo; }
1068 
1069  /// Determine when this overload candidate will be new to the
1070  /// overload set.
1073  uintptr_t Key = reinterpret_cast<uintptr_t>(F->getCanonicalDecl());
1074  Key |= static_cast<uintptr_t>(PO);
1075  return Functions.insert(Key).second;
1076  }
1077 
1078  /// Exclude a function from being considered by overload resolution.
1079  void exclude(Decl *F) {
1082  }
1083 
1084  /// Clear out all of the candidates.
1085  void clear(CandidateSetKind CSK);
1086 
1088 
1089  iterator begin() { return Candidates.begin(); }
1090  iterator end() { return Candidates.end(); }
1091 
1092  size_t size() const { return Candidates.size(); }
1093  bool empty() const { return Candidates.empty(); }
1094 
1095  /// Allocate storage for conversion sequences for NumConversions
1096  /// conversions.
1098  allocateConversionSequences(unsigned NumConversions) {
1099  ImplicitConversionSequence *Conversions =
1100  slabAllocate<ImplicitConversionSequence>(NumConversions);
1101 
1102  // Construct the new objects.
1103  for (unsigned I = 0; I != NumConversions; ++I)
1104  new (&Conversions[I]) ImplicitConversionSequence();
1105 
1106  return ConversionSequenceList(Conversions, NumConversions);
1107  }
1108 
1109  /// Add a new candidate with NumConversions conversion sequence slots
1110  /// to the overload set.
1111  OverloadCandidate &addCandidate(unsigned NumConversions = 0,
1112  ConversionSequenceList Conversions = None) {
1113  assert((Conversions.empty() || Conversions.size() == NumConversions) &&
1114  "preallocated conversion sequence has wrong length");
1115 
1116  Candidates.push_back(OverloadCandidate());
1117  OverloadCandidate &C = Candidates.back();
1118  C.Conversions = Conversions.empty()
1119  ? allocateConversionSequences(NumConversions)
1120  : Conversions;
1121  return C;
1122  }
1123 
1124  /// Find the best viable function on this overload set, if it exists.
1127 
1130  SourceLocation OpLoc = SourceLocation(),
1131  llvm::function_ref<bool(OverloadCandidate &)> Filter =
1132  [](OverloadCandidate &) { return true; });
1133 
1134  void NoteCandidates(
1136  ArrayRef<Expr *> Args, StringRef Opc = "",
1137  SourceLocation Loc = SourceLocation(),
1138  llvm::function_ref<bool(OverloadCandidate &)> Filter =
1139  [](OverloadCandidate &) { return true; });
1140 
1141  void NoteCandidates(Sema &S, ArrayRef<Expr *> Args,
1142  ArrayRef<OverloadCandidate *> Cands,
1143  StringRef Opc = "",
1144  SourceLocation OpLoc = SourceLocation());
1145 
1146  LangAS getDestAS() { return DestAS; }
1147 
1148  void setDestAS(LangAS AS) {
1149  assert((Kind == CSK_InitByConstructor ||
1151  "can't set the destination address space when not constructing an "
1152  "object");
1153  DestAS = AS;
1154  }
1155 
1156  };
1157 
1158  bool isBetterOverloadCandidate(Sema &S,
1159  const OverloadCandidate &Cand1,
1160  const OverloadCandidate &Cand2,
1161  SourceLocation Loc,
1163 
1168 
1169  explicit operator bool() const { return Constructor; }
1170  };
1171 
1172  // FIXME: Add an AddOverloadCandidate / AddTemplateOverloadCandidate overload
1173  // that takes one of these.
1175  if (isa<UsingDecl>(ND))
1176  return ConstructorInfo{};
1177 
1178  // For constructors, the access check is performed against the underlying
1179  // declaration, not the found declaration.
1180  auto *D = ND->getUnderlyingDecl();
1181  ConstructorInfo Info = {DeclAccessPair::make(ND, D->getAccess()), nullptr,
1182  nullptr};
1183  Info.ConstructorTmpl = dyn_cast<FunctionTemplateDecl>(D);
1184  if (Info.ConstructorTmpl)
1185  D = Info.ConstructorTmpl->getTemplatedDecl();
1186  Info.Constructor = dyn_cast<CXXConstructorDecl>(D);
1187  return Info;
1188  }
1189 
1190 } // namespace clang
1191 
1192 #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:745
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:991
clang::CXXConstructorDecl
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2390
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:3321
clang::OverloadCandidateSet::OverloadCandidateSet
OverloadCandidateSet(SourceLocation Loc, CandidateSetKind CSK, OperatorRewriteInfo RewriteInfo={})
Definition: Overload.h:1058
clang::ovl_fail_inhctor_slice
@ ovl_fail_inhctor_slice
This inherited constructor is not viable because it would slice the argument.
Definition: Overload.h:768
clang::ImplicitConversionSequence::setStdInitializerListElement
void setStdInitializerListElement(bool V=true)
Definition: Overload.h:679
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:852
DeclAccessPair.h
clang::CXXConversionDecl
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2720
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:1111
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:923
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:856
clang::BadConversionSequence::setToType
void setToType(QualType T)
Definition: Overload.h:509
clang::ImplicitConversionSequence::ImplicitConversionSequence
ImplicitConversionSequence()
Definition: Overload.h:570
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:685
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:89
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:559
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:223
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:781
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:429
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:661
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:833
clang::OverloadCandidate::IgnoreObjectArgument
bool IgnoreObjectArgument
IgnoreObjectArgument - True to indicate that the first argument's conversion, which for this function...
Definition: Overload.h:842
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:634
clang::ImplicitConversionSequence::AmbiguousConversion
@ AmbiguousConversion
Definition: Overload.h:525
clang::OverloadCandidateSet::allocateConversionSequences
ConversionSequenceList allocateConversionSequences(unsigned NumConversions)
Allocate storage for conversion sequences for NumConversions conversions.
Definition: Overload.h:1098
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:1071
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:599
clang::StandardConversionSequence::setAllToTypes
void setAllToTypes(QualType T)
Definition: Overload.h:340
clang::ConstructorInfo::ConstructorTmpl
FunctionTemplateDecl * ConstructorTmpl
Definition: Overload.h:1167
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:11590
clang::BadConversionSequence::setFromExpr
void setFromExpr(Expr *E)
Definition: Overload.h:503
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:567
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:635
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:575
clang::ImplicitConversionSequence::Kind
Kind
Kind - The kind of implicit conversion sequence.
Definition: Overload.h:522
clang::OverloadCandidate::DeductionFailure
DeductionFailureInfo DeductionFailure
Definition: Overload.h:859
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:845
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:935
clang::ConstructorInfo::FoundDecl
DeclAccessPair FoundDecl
Definition: Overload.h:1165
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:980
clang::ConstructorInfo::Constructor
CXXConstructorDecl * Constructor
Definition: Overload.h:1166
clang::ovl_fail_ext_disabled
@ ovl_fail_ext_disabled
This candidate was not viable because its OpenCL extension is disabled.
Definition: Overload.h:764
clang::getConstructorInfo
ConstructorInfo getConstructorInfo(NamedDecl *ND)
Definition: Overload.h:1174
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:737
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:945
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:656
clang::OverloadCandidateSet::OperatorRewriteInfo::AllowRewrittenCandidates
bool AllowRewrittenCandidates
Whether we should include rewritten candidates in the overload set.
Definition: Overload.h:954
clang::ICK_Pointer_Member
@ ICK_Pointer_Member
Pointer-to-member conversions (C++ [conv.mem])
Definition: Overload.h:149
clang::ImplicitConversionSequence::isStdInitializerListElement
bool isStdInitializerListElement() const
Whether the target is really a std::initializer_list, and the sequence only represents the worst elem...
Definition: Overload.h:675
Decl.h
clang::OverloadCandidate::Fix
ConversionFixItGenerator Fix
The FixIt hints which can be used to fix the Bad candidate.
Definition: Overload.h:816
clang::ImplicitConversionSequence::isInitialized
bool isInitialized() const
Determines whether this conversion sequence has been initialized.
Definition: Overload.h:640
clang::AmbiguousConversionSequence::FromTypePtr
void * FromTypePtr
Definition: Overload.h:422
clang::ImplicitConversionSequence::operator=
ImplicitConversionSequence & operator=(const ImplicitConversionSequence &Other)
Definition: Overload.h:589
clang::ImplicitConversionRank
ImplicitConversionRank
ImplicitConversionRank - The rank of an implicit conversion kind.
Definition: Overload.h:201
clang::ImplicitConversionSequence::EllipsisConversion
@ EllipsisConversion
Definition: Overload.h:526
clang::FunctionTemplateDecl
Declaration of a template function.
Definition: DeclTemplate.h:973
llvm::MutableArrayRef< ImplicitConversionSequence >
clang::Type::isReferenceType
bool isReferenceType() const
Definition: Type.h:6680
V
#define V(N, I)
Definition: ASTContext.h:3018
clang::OverloadCandidateSet::getKind
CandidateSetKind getKind() const
Definition: Overload.h:1066
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:493
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:1146
clang::OverloadCandidate::Viable
bool Viable
Viable - True to indicate that this overload candidate is viable.
Definition: Overload.h:819
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:761
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:501
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:777
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:633
clang::OverloadCandidateSet::getLocation
SourceLocation getLocation() const
Definition: Overload.h:1065
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:940
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:187
clang::ImplicitConversionSequence::Better
@ Better
Definition: Overload.h:705
clang::OverloadCandidateSet::OperatorRewriteInfo::isAcceptableCandidate
bool isAcceptableCandidate(const FunctionDecl *FD)
Definition: Overload.h:963
clang::OverloadCandidate::RewriteKind
unsigned RewriteKind
Whether this is a rewritten candidate, and if so, of what kind?
Definition: Overload.h:848
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:772
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:952
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:750
clang::OverloadCandidateSet::setDestAS
void setDestAS(LangAS AS)
Definition: Overload.h:1148
clang::ImplicitConversionSequence::setAsIdentityConversion
void setAsIdentityConversion(QualType T)
Definition: Overload.h:666
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:1079
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:632
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:92
clang::ConstructorInfo
Definition: Overload.h:1164
clang::BadConversionSequence::lvalue_ref_to_rvalue
@ lvalue_ref_to_rvalue
Definition: Overload.h:471
Type.h
clang::OverloadCandidateSet::OperatorRewriteInfo::OperatorRewriteInfo
OperatorRewriteInfo()
Definition: Overload.h:946
clang::ImplicitConversionSequence::isBad
bool isBad() const
Definition: Overload.h:630
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:478
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:707
clang::OverloadCandidateSet::iterator
SmallVectorImpl< OverloadCandidate >::iterator iterator
Definition: Overload.h:1087
clang::OverloadCandidate::Conversions
ConversionSequenceList Conversions
The conversion sequences used to convert the function arguments to the function parameters.
Definition: Overload.h:813
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:726
clang::ImplicitConversionSequence::DiagnoseAmbiguousConversion
void DiagnoseAmbiguousConversion(Sema &S, SourceLocation CaretLoc, const PartialDiagnostic &PDiag) const
Diagnoses an ambiguous conversion.
Definition: SemaOverload.cpp:10354
clang::ImplicitConversionSequence::setEllipsis
void setEllipsis()
Definition: Overload.h:657
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:555
clang::OverloadCandidate::Function
FunctionDecl * Function
Function - The actual function that this candidate represents.
Definition: Overload.h:795
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:476
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:527
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:720
clang::ImplicitConversionSequence::CompareKind
CompareKind
Definition: Overload.h:704
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:11653
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:800
clang::OverloadCandidateSet::getRewriteInfo
OperatorRewriteInfo getRewriteInfo() const
Definition: Overload.h:1067
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:919
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:7218
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:9956
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:706
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:958
clang::CallExpr::ADLCallKind
ADLCallKind
Definition: Expr.h:2786
clang::OverloadCandidateSet::OperatorRewriteInfo::OperatorRewriteInfo
OperatorRewriteInfo(OverloadedOperatorKind Op, bool AllowRewritten)
Definition: Overload.h:948
SourceLocation.h
clang::OO_None
@ OO_None
Not an overloaded operator.
Definition: OperatorKinds.h:22
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:6668
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:3880
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:2758
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:643
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:790
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:631
clang::OverloadCandidateSet::~OverloadCandidateSet
~OverloadCandidateSet()
Definition: Overload.h:1063
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:352
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:921
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:660
clang::ImplicitConversionSequence::~ImplicitConversionSequence
~ImplicitConversionSequence()
Definition: Overload.h:595
clang::BadConversionSequence::setFromType
void setFromType(QualType T)
Definition: Overload.h:508
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:741
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:865
clang::QualType::getFromOpaquePtr
static QualType getFromOpaquePtr(const void *Ptr)
Definition: Type.h:708
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:1028
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:9541
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:886
clang::OverloadCandidate::Surrogate
CXXConversionDecl * Surrogate
Surrogate - The conversion function for which this candidate is a surrogate, but only if IsSurrogate ...
Definition: Overload.h:808
clang::ImplicitConversionSequence::setUserDefined
void setUserDefined()
Definition: Overload.h:658
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:650
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
Dataflow Directional Tag Classes.
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:611
clang::ovl_fail_bad_deduction
@ ovl_fail_bad_deduction
Definition: Overload.h:721
SemaFixItUtils.h
clang::OverloadCandidate::getNumParams
unsigned getNumParams() const
Definition: Overload.h:899
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:563
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:287
clang::ConversionSequenceList
llvm::MutableArrayRef< ImplicitConversionSequence > ConversionSequenceList
A list of implicit conversion sequences for the arguments of an OverloadCandidate.
Definition: Overload.h:787
clang::OverloadCandidateSet::size
size_t size() const
Definition: Overload.h:1092
clang::OverloadCandidate::BuiltinParamTypes
QualType BuiltinParamTypes[3]
BuiltinParamTypes - Provides the parameter types of a built-in overload candidate.
Definition: Overload.h:804
clang::ovl_fail_too_few_arguments
@ ovl_fail_too_few_arguments
Definition: Overload.h:719
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:870
clang::OverloadCandidate::hasAmbiguousConversion
bool hasAmbiguousConversion() const
hasAmbiguousConversion - Returns whether this overload candidate requires an ambiguous conversion or ...
Definition: Overload.h:878
clang::StandardConversionSequence::isPointerConversionToBool
bool isPointerConversionToBool() const
isPointerConversionToBool - Determines whether this conversion is a conversion of a pointer or pointe...
Definition: SemaOverload.cpp:227
clang::QualType::getAsOpaquePtr
void * getAsOpaquePtr() const
Definition: Type.h:706
clang::BadConversionSequence::getFromType
QualType getFromType() const
Definition: Overload.h:500
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:717
clang::OverloadCandidateSet::begin
iterator begin()
Definition: Overload.h:1089
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:754
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:1090
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:758
clang::ImplicitConversionSequence::UserDefinedConversion
@ UserDefinedConversion
Definition: Overload.h:524
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:930
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:1821
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:718
clang::CallExpr
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2730
clang::OverloadCandidateSet::empty
bool empty() const
Definition: Overload.h:1093
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:874
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:828
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:516
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:523
clang::AmbiguousConversionSequence::setToType
void setToType(QualType T)
Definition: Overload.h:435
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:488