Overload.h revision 440a48318c53647d6416bcb1ff1af1452aa5d453
1//===--- Overload.h - C++ Overloading ---------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file defines the data structures and types used in C++ 11// overload resolution. 12// 13//===----------------------------------------------------------------------===// 14 15#ifndef LLVM_CLANG_SEMA_OVERLOAD_H 16#define LLVM_CLANG_SEMA_OVERLOAD_H 17 18#include "clang/AST/Decl.h" 19#include "clang/AST/DeclTemplate.h" 20#include "clang/AST/Expr.h" 21#include "clang/AST/TemplateBase.h" 22#include "clang/AST/Type.h" 23#include "clang/AST/UnresolvedSet.h" 24#include "llvm/ADT/SmallPtrSet.h" 25#include "llvm/ADT/SmallVector.h" 26 27namespace clang { 28 class ASTContext; 29 class CXXConstructorDecl; 30 class CXXConversionDecl; 31 class FunctionDecl; 32 class Sema; 33 34 /// OverloadingResult - Capture the result of performing overload 35 /// resolution. 36 enum OverloadingResult { 37 OR_Success, ///< Overload resolution succeeded. 38 OR_No_Viable_Function, ///< No viable function found. 39 OR_Ambiguous, ///< Ambiguous candidates found. 40 OR_Deleted ///< Succeeded, but refers to a deleted function. 41 }; 42 43 enum OverloadCandidateDisplayKind { 44 /// Requests that all candidates be shown. Viable candidates will 45 /// be printed first. 46 OCD_AllCandidates, 47 48 /// Requests that only viable candidates be shown. 49 OCD_ViableCandidates 50 }; 51 52 /// ImplicitConversionKind - The kind of implicit conversion used to 53 /// convert an argument to a parameter's type. The enumerator values 54 /// match with Table 9 of (C++ 13.3.3.1.1) and are listed such that 55 /// better conversion kinds have smaller values. 56 enum ImplicitConversionKind { 57 ICK_Identity = 0, ///< Identity conversion (no conversion) 58 ICK_Lvalue_To_Rvalue, ///< Lvalue-to-rvalue conversion (C++ 4.1) 59 ICK_Array_To_Pointer, ///< Array-to-pointer conversion (C++ 4.2) 60 ICK_Function_To_Pointer, ///< Function-to-pointer (C++ 4.3) 61 ICK_NoReturn_Adjustment, ///< Removal of noreturn from a type (Clang) 62 ICK_Qualification, ///< Qualification conversions (C++ 4.4) 63 ICK_Integral_Promotion, ///< Integral promotions (C++ 4.5) 64 ICK_Floating_Promotion, ///< Floating point promotions (C++ 4.6) 65 ICK_Complex_Promotion, ///< Complex promotions (Clang extension) 66 ICK_Integral_Conversion, ///< Integral conversions (C++ 4.7) 67 ICK_Floating_Conversion, ///< Floating point conversions (C++ 4.8) 68 ICK_Complex_Conversion, ///< Complex conversions (C99 6.3.1.6) 69 ICK_Floating_Integral, ///< Floating-integral conversions (C++ 4.9) 70 ICK_Pointer_Conversion, ///< Pointer conversions (C++ 4.10) 71 ICK_Pointer_Member, ///< Pointer-to-member conversions (C++ 4.11) 72 ICK_Boolean_Conversion, ///< Boolean conversions (C++ 4.12) 73 ICK_Compatible_Conversion, ///< Conversions between compatible types in C99 74 ICK_Derived_To_Base, ///< Derived-to-base (C++ [over.best.ics]) 75 ICK_Vector_Conversion, ///< Vector conversions 76 ICK_Vector_Splat, ///< A vector splat from an arithmetic type 77 ICK_Complex_Real, ///< Complex-real conversions (C99 6.3.1.7) 78 ICK_Num_Conversion_Kinds ///< The number of conversion kinds 79 }; 80 81 /// ImplicitConversionCategory - The category of an implicit 82 /// conversion kind. The enumerator values match with Table 9 of 83 /// (C++ 13.3.3.1.1) and are listed such that better conversion 84 /// categories have smaller values. 85 enum ImplicitConversionCategory { 86 ICC_Identity = 0, ///< Identity 87 ICC_Lvalue_Transformation, ///< Lvalue transformation 88 ICC_Qualification_Adjustment, ///< Qualification adjustment 89 ICC_Promotion, ///< Promotion 90 ICC_Conversion ///< Conversion 91 }; 92 93 ImplicitConversionCategory 94 GetConversionCategory(ImplicitConversionKind Kind); 95 96 /// ImplicitConversionRank - The rank of an implicit conversion 97 /// kind. The enumerator values match with Table 9 of (C++ 98 /// 13.3.3.1.1) and are listed such that better conversion ranks 99 /// have smaller values. 100 enum ImplicitConversionRank { 101 ICR_Exact_Match = 0, ///< Exact Match 102 ICR_Promotion, ///< Promotion 103 ICR_Conversion, ///< Conversion 104 ICR_Complex_Real_Conversion ///< Complex <-> Real conversion 105 }; 106 107 ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind); 108 109 /// StandardConversionSequence - represents a standard conversion 110 /// sequence (C++ 13.3.3.1.1). A standard conversion sequence 111 /// contains between zero and three conversions. If a particular 112 /// conversion is not needed, it will be set to the identity conversion 113 /// (ICK_Identity). Note that the three conversions are 114 /// specified as separate members (rather than in an array) so that 115 /// we can keep the size of a standard conversion sequence to a 116 /// single word. 117 class StandardConversionSequence { 118 public: 119 /// First -- The first conversion can be an lvalue-to-rvalue 120 /// conversion, array-to-pointer conversion, or 121 /// function-to-pointer conversion. 122 ImplicitConversionKind First : 8; 123 124 /// Second - The second conversion can be an integral promotion, 125 /// floating point promotion, integral conversion, floating point 126 /// conversion, floating-integral conversion, pointer conversion, 127 /// pointer-to-member conversion, or boolean conversion. 128 ImplicitConversionKind Second : 8; 129 130 /// Third - The third conversion can be a qualification conversion. 131 ImplicitConversionKind Third : 8; 132 133 /// Deprecated - Whether this the deprecated conversion of a 134 /// string literal to a pointer to non-const character data 135 /// (C++ 4.2p2). 136 unsigned DeprecatedStringLiteralToCharPtr : 1; 137 138 /// IncompatibleObjC - Whether this is an Objective-C conversion 139 /// that we should warn about (if we actually use it). 140 unsigned IncompatibleObjC : 1; 141 142 /// ReferenceBinding - True when this is a reference binding 143 /// (C++ [over.ics.ref]). 144 unsigned ReferenceBinding : 1; 145 146 /// DirectBinding - True when this is a reference binding that is a 147 /// direct binding (C++ [dcl.init.ref]). 148 unsigned DirectBinding : 1; 149 150 /// \brief Whether this is an lvalue reference binding (otherwise, it's 151 /// an rvalue reference binding). 152 unsigned IsLvalueReference : 1; 153 154 /// \brief Whether we're binding to a function lvalue. 155 unsigned BindsToFunctionLvalue : 1; 156 157 /// \brief Whether we're binding to an rvalue. 158 unsigned BindsToRvalue : 1; 159 160 /// FromType - The type that this conversion is converting 161 /// from. This is an opaque pointer that can be translated into a 162 /// QualType. 163 void *FromTypePtr; 164 165 /// ToType - The types that this conversion is converting to in 166 /// each step. This is an opaque pointer that can be translated 167 /// into a QualType. 168 void *ToTypePtrs[3]; 169 170 /// CopyConstructor - The copy constructor that is used to perform 171 /// this conversion, when the conversion is actually just the 172 /// initialization of an object via copy constructor. Such 173 /// conversions are either identity conversions or derived-to-base 174 /// conversions. 175 CXXConstructorDecl *CopyConstructor; 176 177 void setFromType(QualType T) { FromTypePtr = T.getAsOpaquePtr(); } 178 void setToType(unsigned Idx, QualType T) { 179 assert(Idx < 3 && "To type index is out of range"); 180 ToTypePtrs[Idx] = T.getAsOpaquePtr(); 181 } 182 void setAllToTypes(QualType T) { 183 ToTypePtrs[0] = T.getAsOpaquePtr(); 184 ToTypePtrs[1] = ToTypePtrs[0]; 185 ToTypePtrs[2] = ToTypePtrs[0]; 186 } 187 188 QualType getFromType() const { 189 return QualType::getFromOpaquePtr(FromTypePtr); 190 } 191 QualType getToType(unsigned Idx) const { 192 assert(Idx < 3 && "To type index is out of range"); 193 return QualType::getFromOpaquePtr(ToTypePtrs[Idx]); 194 } 195 196 void setAsIdentityConversion(); 197 198 bool isIdentityConversion() const { 199 return First == ICK_Identity && Second == ICK_Identity && 200 Third == ICK_Identity; 201 } 202 203 ImplicitConversionRank getRank() const; 204 bool isPointerConversionToBool() const; 205 bool isPointerConversionToVoidPointer(ASTContext& Context) const; 206 void DebugPrint() const; 207 }; 208 209 /// UserDefinedConversionSequence - Represents a user-defined 210 /// conversion sequence (C++ 13.3.3.1.2). 211 struct UserDefinedConversionSequence { 212 /// Before - Represents the standard conversion that occurs before 213 /// the actual user-defined conversion. (C++ 13.3.3.1.2p1): 214 /// 215 /// If the user-defined conversion is specified by a constructor 216 /// (12.3.1), the initial standard conversion sequence converts 217 /// the source type to the type required by the argument of the 218 /// constructor. If the user-defined conversion is specified by 219 /// a conversion function (12.3.2), the initial standard 220 /// conversion sequence converts the source type to the implicit 221 /// object parameter of the conversion function. 222 StandardConversionSequence Before; 223 224 /// EllipsisConversion - When this is true, it means user-defined 225 /// conversion sequence starts with a ... (elipsis) conversion, instead of 226 /// a standard conversion. In this case, 'Before' field must be ignored. 227 // FIXME. I much rather put this as the first field. But there seems to be 228 // a gcc code gen. bug which causes a crash in a test. Putting it here seems 229 // to work around the crash. 230 bool EllipsisConversion : 1; 231 232 /// After - Represents the standard conversion that occurs after 233 /// the actual user-defined conversion. 234 StandardConversionSequence After; 235 236 /// ConversionFunction - The function that will perform the 237 /// user-defined conversion. 238 FunctionDecl* ConversionFunction; 239 240 /// \brief The declaration that we found via name lookup, which might be 241 /// the same as \c ConversionFunction or it might be a using declaration 242 /// that refers to \c ConversionFunction. 243 NamedDecl *FoundConversionFunction; 244 245 void DebugPrint() const; 246 }; 247 248 /// Represents an ambiguous user-defined conversion sequence. 249 struct AmbiguousConversionSequence { 250 typedef llvm::SmallVector<FunctionDecl*, 4> ConversionSet; 251 252 void *FromTypePtr; 253 void *ToTypePtr; 254 char Buffer[sizeof(ConversionSet)]; 255 256 QualType getFromType() const { 257 return QualType::getFromOpaquePtr(FromTypePtr); 258 } 259 QualType getToType() const { 260 return QualType::getFromOpaquePtr(ToTypePtr); 261 } 262 void setFromType(QualType T) { FromTypePtr = T.getAsOpaquePtr(); } 263 void setToType(QualType T) { ToTypePtr = T.getAsOpaquePtr(); } 264 265 ConversionSet &conversions() { 266 return *reinterpret_cast<ConversionSet*>(Buffer); 267 } 268 269 const ConversionSet &conversions() const { 270 return *reinterpret_cast<const ConversionSet*>(Buffer); 271 } 272 273 void addConversion(FunctionDecl *D) { 274 conversions().push_back(D); 275 } 276 277 typedef ConversionSet::iterator iterator; 278 iterator begin() { return conversions().begin(); } 279 iterator end() { return conversions().end(); } 280 281 typedef ConversionSet::const_iterator const_iterator; 282 const_iterator begin() const { return conversions().begin(); } 283 const_iterator end() const { return conversions().end(); } 284 285 void construct(); 286 void destruct(); 287 void copyFrom(const AmbiguousConversionSequence &); 288 }; 289 290 /// BadConversionSequence - Records information about an invalid 291 /// conversion sequence. 292 struct BadConversionSequence { 293 enum FailureKind { 294 no_conversion, 295 unrelated_class, 296 suppressed_user, 297 bad_qualifiers 298 }; 299 300 // This can be null, e.g. for implicit object arguments. 301 Expr *FromExpr; 302 303 FailureKind Kind; 304 305 private: 306 // The type we're converting from (an opaque QualType). 307 void *FromTy; 308 309 // The type we're converting to (an opaque QualType). 310 void *ToTy; 311 312 public: 313 void init(FailureKind K, Expr *From, QualType To) { 314 init(K, From->getType(), To); 315 FromExpr = From; 316 } 317 void init(FailureKind K, QualType From, QualType To) { 318 Kind = K; 319 FromExpr = 0; 320 setFromType(From); 321 setToType(To); 322 } 323 324 QualType getFromType() const { return QualType::getFromOpaquePtr(FromTy); } 325 QualType getToType() const { return QualType::getFromOpaquePtr(ToTy); } 326 327 void setFromExpr(Expr *E) { 328 FromExpr = E; 329 setFromType(E->getType()); 330 } 331 void setFromType(QualType T) { FromTy = T.getAsOpaquePtr(); } 332 void setToType(QualType T) { ToTy = T.getAsOpaquePtr(); } 333 }; 334 335 /// ImplicitConversionSequence - Represents an implicit conversion 336 /// sequence, which may be a standard conversion sequence 337 /// (C++ 13.3.3.1.1), user-defined conversion sequence (C++ 13.3.3.1.2), 338 /// or an ellipsis conversion sequence (C++ 13.3.3.1.3). 339 class ImplicitConversionSequence { 340 public: 341 /// Kind - The kind of implicit conversion sequence. BadConversion 342 /// specifies that there is no conversion from the source type to 343 /// the target type. AmbiguousConversion represents the unique 344 /// ambiguous conversion (C++0x [over.best.ics]p10). 345 enum Kind { 346 StandardConversion = 0, 347 UserDefinedConversion, 348 AmbiguousConversion, 349 EllipsisConversion, 350 BadConversion 351 }; 352 353 private: 354 enum { 355 Uninitialized = BadConversion + 1 356 }; 357 358 /// ConversionKind - The kind of implicit conversion sequence. 359 unsigned ConversionKind; 360 361 void setKind(Kind K) { 362 destruct(); 363 ConversionKind = K; 364 } 365 366 void destruct() { 367 if (ConversionKind == AmbiguousConversion) Ambiguous.destruct(); 368 } 369 370 public: 371 union { 372 /// When ConversionKind == StandardConversion, provides the 373 /// details of the standard conversion sequence. 374 StandardConversionSequence Standard; 375 376 /// When ConversionKind == UserDefinedConversion, provides the 377 /// details of the user-defined conversion sequence. 378 UserDefinedConversionSequence UserDefined; 379 380 /// When ConversionKind == AmbiguousConversion, provides the 381 /// details of the ambiguous conversion. 382 AmbiguousConversionSequence Ambiguous; 383 384 /// When ConversionKind == BadConversion, provides the details 385 /// of the bad conversion. 386 BadConversionSequence Bad; 387 }; 388 389 ImplicitConversionSequence() : ConversionKind(Uninitialized) {} 390 ~ImplicitConversionSequence() { 391 destruct(); 392 } 393 ImplicitConversionSequence(const ImplicitConversionSequence &Other) 394 : ConversionKind(Other.ConversionKind) 395 { 396 switch (ConversionKind) { 397 case Uninitialized: break; 398 case StandardConversion: Standard = Other.Standard; break; 399 case UserDefinedConversion: UserDefined = Other.UserDefined; break; 400 case AmbiguousConversion: Ambiguous.copyFrom(Other.Ambiguous); break; 401 case EllipsisConversion: break; 402 case BadConversion: Bad = Other.Bad; break; 403 } 404 } 405 406 ImplicitConversionSequence & 407 operator=(const ImplicitConversionSequence &Other) { 408 destruct(); 409 new (this) ImplicitConversionSequence(Other); 410 return *this; 411 } 412 413 Kind getKind() const { 414 assert(isInitialized() && "querying uninitialized conversion"); 415 return Kind(ConversionKind); 416 } 417 418 /// \brief Return a ranking of the implicit conversion sequence 419 /// kind, where smaller ranks represent better conversion 420 /// sequences. 421 /// 422 /// In particular, this routine gives user-defined conversion 423 /// sequences and ambiguous conversion sequences the same rank, 424 /// per C++ [over.best.ics]p10. 425 unsigned getKindRank() const { 426 switch (getKind()) { 427 case StandardConversion: 428 return 0; 429 430 case UserDefinedConversion: 431 case AmbiguousConversion: 432 return 1; 433 434 case EllipsisConversion: 435 return 2; 436 437 case BadConversion: 438 return 3; 439 } 440 441 return 3; 442 } 443 444 bool isBad() const { return getKind() == BadConversion; } 445 bool isStandard() const { return getKind() == StandardConversion; } 446 bool isEllipsis() const { return getKind() == EllipsisConversion; } 447 bool isAmbiguous() const { return getKind() == AmbiguousConversion; } 448 bool isUserDefined() const { return getKind() == UserDefinedConversion; } 449 450 /// Determines whether this conversion sequence has been 451 /// initialized. Most operations should never need to query 452 /// uninitialized conversions and should assert as above. 453 bool isInitialized() const { return ConversionKind != Uninitialized; } 454 455 /// Sets this sequence as a bad conversion for an explicit argument. 456 void setBad(BadConversionSequence::FailureKind Failure, 457 Expr *FromExpr, QualType ToType) { 458 setKind(BadConversion); 459 Bad.init(Failure, FromExpr, ToType); 460 } 461 462 /// Sets this sequence as a bad conversion for an implicit argument. 463 void setBad(BadConversionSequence::FailureKind Failure, 464 QualType FromType, QualType ToType) { 465 setKind(BadConversion); 466 Bad.init(Failure, FromType, ToType); 467 } 468 469 void setStandard() { setKind(StandardConversion); } 470 void setEllipsis() { setKind(EllipsisConversion); } 471 void setUserDefined() { setKind(UserDefinedConversion); } 472 void setAmbiguous() { 473 if (ConversionKind == AmbiguousConversion) return; 474 ConversionKind = AmbiguousConversion; 475 Ambiguous.construct(); 476 } 477 478 // The result of a comparison between implicit conversion 479 // sequences. Use Sema::CompareImplicitConversionSequences to 480 // actually perform the comparison. 481 enum CompareKind { 482 Better = -1, 483 Indistinguishable = 0, 484 Worse = 1 485 }; 486 487 void DiagnoseAmbiguousConversion(Sema &S, 488 SourceLocation CaretLoc, 489 const PartialDiagnostic &PDiag) const; 490 491 void DebugPrint() const; 492 }; 493 494 enum OverloadFailureKind { 495 ovl_fail_too_many_arguments, 496 ovl_fail_too_few_arguments, 497 ovl_fail_bad_conversion, 498 ovl_fail_bad_deduction, 499 500 /// This conversion candidate was not considered because it 501 /// duplicates the work of a trivial or derived-to-base 502 /// conversion. 503 ovl_fail_trivial_conversion, 504 505 /// This conversion candidate is not viable because its result 506 /// type is not implicitly convertible to the desired type. 507 ovl_fail_bad_final_conversion, 508 509 /// This conversion function template specialization candidate is not 510 /// viable because the final conversion was not an exact match. 511 ovl_fail_final_conversion_not_exact 512 }; 513 514 /// OverloadCandidate - A single candidate in an overload set (C++ 13.3). 515 struct OverloadCandidate { 516 /// Function - The actual function that this candidate 517 /// represents. When NULL, this is a built-in candidate 518 /// (C++ [over.oper]) or a surrogate for a conversion to a 519 /// function pointer or reference (C++ [over.call.object]). 520 FunctionDecl *Function; 521 522 /// FoundDecl - The original declaration that was looked up / 523 /// invented / otherwise found, together with its access. 524 /// Might be a UsingShadowDecl or a FunctionTemplateDecl. 525 DeclAccessPair FoundDecl; 526 527 // BuiltinTypes - Provides the return and parameter types of a 528 // built-in overload candidate. Only valid when Function is NULL. 529 struct { 530 QualType ResultTy; 531 QualType ParamTypes[3]; 532 } BuiltinTypes; 533 534 /// Surrogate - The conversion function for which this candidate 535 /// is a surrogate, but only if IsSurrogate is true. 536 CXXConversionDecl *Surrogate; 537 538 /// Conversions - The conversion sequences used to convert the 539 /// function arguments to the function parameters. 540 llvm::SmallVector<ImplicitConversionSequence, 4> Conversions; 541 542 /// Viable - True to indicate that this overload candidate is viable. 543 bool Viable; 544 545 /// IsSurrogate - True to indicate that this candidate is a 546 /// surrogate for a conversion to a function pointer or reference 547 /// (C++ [over.call.object]). 548 bool IsSurrogate; 549 550 /// IgnoreObjectArgument - True to indicate that the first 551 /// argument's conversion, which for this function represents the 552 /// implicit object argument, should be ignored. This will be true 553 /// when the candidate is a static member function (where the 554 /// implicit object argument is just a placeholder) or a 555 /// non-static member function when the call doesn't have an 556 /// object argument. 557 bool IgnoreObjectArgument; 558 559 /// FailureKind - The reason why this candidate is not viable. 560 /// Actually an OverloadFailureKind. 561 unsigned char FailureKind; 562 563 /// \brief The number of call arguments that were explicitly provided, 564 /// to be used while performing partial ordering of function templates. 565 unsigned ExplicitCallArguments; 566 567 /// A structure used to record information about a failed 568 /// template argument deduction. 569 struct DeductionFailureInfo { 570 // A Sema::TemplateDeductionResult. 571 unsigned Result; 572 573 /// \brief Opaque pointer containing additional data about 574 /// this deduction failure. 575 void *Data; 576 577 /// \brief Retrieve the template parameter this deduction failure 578 /// refers to, if any. 579 TemplateParameter getTemplateParameter(); 580 581 /// \brief Retrieve the template argument list associated with this 582 /// deduction failure, if any. 583 TemplateArgumentList *getTemplateArgumentList(); 584 585 /// \brief Return the first template argument this deduction failure 586 /// refers to, if any. 587 const TemplateArgument *getFirstArg(); 588 589 /// \brief Return the second template argument this deduction failure 590 /// refers to, if any. 591 const TemplateArgument *getSecondArg(); 592 593 /// \brief Free any memory associated with this deduction failure. 594 void Destroy(); 595 }; 596 597 union { 598 DeductionFailureInfo DeductionFailure; 599 600 /// FinalConversion - For a conversion function (where Function is 601 /// a CXXConversionDecl), the standard conversion that occurs 602 /// after the call to the overload candidate to convert the result 603 /// of calling the conversion function to the required type. 604 StandardConversionSequence FinalConversion; 605 }; 606 607 /// hasAmbiguousConversion - Returns whether this overload 608 /// candidate requires an ambiguous conversion or not. 609 bool hasAmbiguousConversion() const { 610 for (llvm::SmallVectorImpl<ImplicitConversionSequence>::const_iterator 611 I = Conversions.begin(), E = Conversions.end(); I != E; ++I) { 612 if (!I->isInitialized()) return false; 613 if (I->isAmbiguous()) return true; 614 } 615 return false; 616 } 617 }; 618 619 /// OverloadCandidateSet - A set of overload candidates, used in C++ 620 /// overload resolution (C++ 13.3). 621 class OverloadCandidateSet : public llvm::SmallVector<OverloadCandidate, 16> { 622 typedef llvm::SmallVector<OverloadCandidate, 16> inherited; 623 llvm::SmallPtrSet<Decl *, 16> Functions; 624 625 SourceLocation Loc; 626 627 OverloadCandidateSet(const OverloadCandidateSet &); 628 OverloadCandidateSet &operator=(const OverloadCandidateSet &); 629 630 public: 631 OverloadCandidateSet(SourceLocation Loc) : Loc(Loc) {} 632 633 SourceLocation getLocation() const { return Loc; } 634 635 /// \brief Determine when this overload candidate will be new to the 636 /// overload set. 637 bool isNewCandidate(Decl *F) { 638 return Functions.insert(F->getCanonicalDecl()); 639 } 640 641 /// \brief Clear out all of the candidates. 642 void clear(); 643 644 ~OverloadCandidateSet() { clear(); } 645 646 /// Find the best viable function on this overload set, if it exists. 647 OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc, 648 OverloadCandidateSet::iterator& Best, 649 bool UserDefinedConversion = false); 650 651 void NoteCandidates(Sema &S, 652 OverloadCandidateDisplayKind OCD, 653 Expr **Args, unsigned NumArgs, 654 const char *Opc = 0, 655 SourceLocation Loc = SourceLocation()); 656 }; 657 658 bool isBetterOverloadCandidate(Sema &S, 659 const OverloadCandidate& Cand1, 660 const OverloadCandidate& Cand2, 661 SourceLocation Loc, 662 bool UserDefinedConversion = false); 663} // end namespace clang 664 665#endif // LLVM_CLANG_SEMA_OVERLOAD_H 666