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