clang API Documentation
00001 //===--- Overload.h - C++ Overloading ---------------------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines the data structures and types used in C++ 00011 // overload resolution. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_CLANG_SEMA_OVERLOAD_H 00016 #define LLVM_CLANG_SEMA_OVERLOAD_H 00017 00018 #include "clang/AST/Decl.h" 00019 #include "clang/AST/DeclTemplate.h" 00020 #include "clang/AST/Expr.h" 00021 #include "clang/AST/TemplateBase.h" 00022 #include "clang/AST/Type.h" 00023 #include "clang/AST/UnresolvedSet.h" 00024 #include "llvm/ADT/SmallPtrSet.h" 00025 #include "llvm/ADT/SmallVector.h" 00026 00027 namespace clang { 00028 class ASTContext; 00029 class CXXConstructorDecl; 00030 class CXXConversionDecl; 00031 class FunctionDecl; 00032 00033 /// OverloadingResult - Capture the result of performing overload 00034 /// resolution. 00035 enum OverloadingResult { 00036 OR_Success, ///< Overload resolution succeeded. 00037 OR_No_Viable_Function, ///< No viable function found. 00038 OR_Ambiguous, ///< Ambiguous candidates found. 00039 OR_Deleted ///< Succeeded, but refers to a deleted function. 00040 }; 00041 00042 /// ImplicitConversionKind - The kind of implicit conversion used to 00043 /// convert an argument to a parameter's type. The enumerator values 00044 /// match with Table 9 of (C++ 13.3.3.1.1) and are listed such that 00045 /// better conversion kinds have smaller values. 00046 enum ImplicitConversionKind { 00047 ICK_Identity = 0, ///< Identity conversion (no conversion) 00048 ICK_Lvalue_To_Rvalue, ///< Lvalue-to-rvalue conversion (C++ 4.1) 00049 ICK_Array_To_Pointer, ///< Array-to-pointer conversion (C++ 4.2) 00050 ICK_Function_To_Pointer, ///< Function-to-pointer (C++ 4.3) 00051 ICK_NoReturn_Adjustment, ///< Removal of noreturn from a type (Clang) 00052 ICK_Qualification, ///< Qualification conversions (C++ 4.4) 00053 ICK_Integral_Promotion, ///< Integral promotions (C++ 4.5) 00054 ICK_Floating_Promotion, ///< Floating point promotions (C++ 4.6) 00055 ICK_Complex_Promotion, ///< Complex promotions (Clang extension) 00056 ICK_Integral_Conversion, ///< Integral conversions (C++ 4.7) 00057 ICK_Floating_Conversion, ///< Floating point conversions (C++ 4.8) 00058 ICK_Complex_Conversion, ///< Complex conversions (C99 6.3.1.6) 00059 ICK_Floating_Integral, ///< Floating-integral conversions (C++ 4.9) 00060 ICK_Pointer_Conversion, ///< Pointer conversions (C++ 4.10) 00061 ICK_Pointer_Member, ///< Pointer-to-member conversions (C++ 4.11) 00062 ICK_Boolean_Conversion, ///< Boolean conversions (C++ 4.12) 00063 ICK_Compatible_Conversion, ///< Conversions between compatible types in C99 00064 ICK_Derived_To_Base, ///< Derived-to-base (C++ [over.best.ics]) 00065 ICK_Vector_Conversion, ///< Vector conversions 00066 ICK_Vector_Splat, ///< A vector splat from an arithmetic type 00067 ICK_Complex_Real, ///< Complex-real conversions (C99 6.3.1.7) 00068 ICK_Num_Conversion_Kinds ///< The number of conversion kinds 00069 }; 00070 00071 /// ImplicitConversionCategory - The category of an implicit 00072 /// conversion kind. The enumerator values match with Table 9 of 00073 /// (C++ 13.3.3.1.1) and are listed such that better conversion 00074 /// categories have smaller values. 00075 enum ImplicitConversionCategory { 00076 ICC_Identity = 0, ///< Identity 00077 ICC_Lvalue_Transformation, ///< Lvalue transformation 00078 ICC_Qualification_Adjustment, ///< Qualification adjustment 00079 ICC_Promotion, ///< Promotion 00080 ICC_Conversion ///< Conversion 00081 }; 00082 00083 ImplicitConversionCategory 00084 GetConversionCategory(ImplicitConversionKind Kind); 00085 00086 /// ImplicitConversionRank - The rank of an implicit conversion 00087 /// kind. The enumerator values match with Table 9 of (C++ 00088 /// 13.3.3.1.1) and are listed such that better conversion ranks 00089 /// have smaller values. 00090 enum ImplicitConversionRank { 00091 ICR_Exact_Match = 0, ///< Exact Match 00092 ICR_Promotion, ///< Promotion 00093 ICR_Conversion, ///< Conversion 00094 ICR_Complex_Real_Conversion ///< Complex <-> Real conversion 00095 }; 00096 00097 ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind); 00098 00099 /// StandardConversionSequence - represents a standard conversion 00100 /// sequence (C++ 13.3.3.1.1). A standard conversion sequence 00101 /// contains between zero and three conversions. If a particular 00102 /// conversion is not needed, it will be set to the identity conversion 00103 /// (ICK_Identity). Note that the three conversions are 00104 /// specified as separate members (rather than in an array) so that 00105 /// we can keep the size of a standard conversion sequence to a 00106 /// single word. 00107 struct StandardConversionSequence { 00108 /// First -- The first conversion can be an lvalue-to-rvalue 00109 /// conversion, array-to-pointer conversion, or 00110 /// function-to-pointer conversion. 00111 ImplicitConversionKind First : 8; 00112 00113 /// Second - The second conversion can be an integral promotion, 00114 /// floating point promotion, integral conversion, floating point 00115 /// conversion, floating-integral conversion, pointer conversion, 00116 /// pointer-to-member conversion, or boolean conversion. 00117 ImplicitConversionKind Second : 8; 00118 00119 /// Third - The third conversion can be a qualification conversion. 00120 ImplicitConversionKind Third : 8; 00121 00122 /// Deprecated - Whether this the deprecated conversion of a 00123 /// string literal to a pointer to non-const character data 00124 /// (C++ 4.2p2). 00125 bool DeprecatedStringLiteralToCharPtr : 1; 00126 00127 /// IncompatibleObjC - Whether this is an Objective-C conversion 00128 /// that we should warn about (if we actually use it). 00129 bool IncompatibleObjC : 1; 00130 00131 /// ReferenceBinding - True when this is a reference binding 00132 /// (C++ [over.ics.ref]). 00133 bool ReferenceBinding : 1; 00134 00135 /// DirectBinding - True when this is a reference binding that is a 00136 /// direct binding (C++ [dcl.init.ref]). 00137 bool DirectBinding : 1; 00138 00139 /// RRefBinding - True when this is a reference binding of an rvalue 00140 /// reference to an rvalue (C++0x [over.ics.rank]p3b4). 00141 bool RRefBinding : 1; 00142 00143 /// FromType - The type that this conversion is converting 00144 /// from. This is an opaque pointer that can be translated into a 00145 /// QualType. 00146 void *FromTypePtr; 00147 00148 /// ToType - The types that this conversion is converting to in 00149 /// each step. This is an opaque pointer that can be translated 00150 /// into a QualType. 00151 void *ToTypePtrs[3]; 00152 00153 /// CopyConstructor - The copy constructor that is used to perform 00154 /// this conversion, when the conversion is actually just the 00155 /// initialization of an object via copy constructor. Such 00156 /// conversions are either identity conversions or derived-to-base 00157 /// conversions. 00158 CXXConstructorDecl *CopyConstructor; 00159 00160 void setFromType(QualType T) { FromTypePtr = T.getAsOpaquePtr(); } 00161 void setToType(unsigned Idx, QualType T) { 00162 assert(Idx < 3 && "To type index is out of range"); 00163 ToTypePtrs[Idx] = T.getAsOpaquePtr(); 00164 } 00165 void setAllToTypes(QualType T) { 00166 ToTypePtrs[0] = T.getAsOpaquePtr(); 00167 ToTypePtrs[1] = ToTypePtrs[0]; 00168 ToTypePtrs[2] = ToTypePtrs[0]; 00169 } 00170 00171 QualType getFromType() const { 00172 return QualType::getFromOpaquePtr(FromTypePtr); 00173 } 00174 QualType getToType(unsigned Idx) const { 00175 assert(Idx < 3 && "To type index is out of range"); 00176 return QualType::getFromOpaquePtr(ToTypePtrs[Idx]); 00177 } 00178 00179 void setAsIdentityConversion(); 00180 00181 bool isIdentityConversion() const { 00182 return First == ICK_Identity && Second == ICK_Identity && 00183 Third == ICK_Identity; 00184 } 00185 00186 ImplicitConversionRank getRank() const; 00187 bool isPointerConversionToBool() const; 00188 bool isPointerConversionToVoidPointer(ASTContext& Context) const; 00189 void DebugPrint() const; 00190 }; 00191 00192 /// UserDefinedConversionSequence - Represents a user-defined 00193 /// conversion sequence (C++ 13.3.3.1.2). 00194 struct UserDefinedConversionSequence { 00195 /// Before - Represents the standard conversion that occurs before 00196 /// the actual user-defined conversion. (C++ 13.3.3.1.2p1): 00197 /// 00198 /// If the user-defined conversion is specified by a constructor 00199 /// (12.3.1), the initial standard conversion sequence converts 00200 /// the source type to the type required by the argument of the 00201 /// constructor. If the user-defined conversion is specified by 00202 /// a conversion function (12.3.2), the initial standard 00203 /// conversion sequence converts the source type to the implicit 00204 /// object parameter of the conversion function. 00205 StandardConversionSequence Before; 00206 00207 /// EllipsisConversion - When this is true, it means user-defined 00208 /// conversion sequence starts with a ... (elipsis) conversion, instead of 00209 /// a standard conversion. In this case, 'Before' field must be ignored. 00210 // FIXME. I much rather put this as the first field. But there seems to be 00211 // a gcc code gen. bug which causes a crash in a test. Putting it here seems 00212 // to work around the crash. 00213 bool EllipsisConversion : 1; 00214 00215 /// After - Represents the standard conversion that occurs after 00216 /// the actual user-defined conversion. 00217 StandardConversionSequence After; 00218 00219 /// ConversionFunction - The function that will perform the 00220 /// user-defined conversion. 00221 FunctionDecl* ConversionFunction; 00222 00223 void DebugPrint() const; 00224 }; 00225 00226 /// Represents an ambiguous user-defined conversion sequence. 00227 struct AmbiguousConversionSequence { 00228 typedef llvm::SmallVector<FunctionDecl*, 4> ConversionSet; 00229 00230 void *FromTypePtr; 00231 void *ToTypePtr; 00232 char Buffer[sizeof(ConversionSet)]; 00233 00234 QualType getFromType() const { 00235 return QualType::getFromOpaquePtr(FromTypePtr); 00236 } 00237 QualType getToType() const { 00238 return QualType::getFromOpaquePtr(ToTypePtr); 00239 } 00240 void setFromType(QualType T) { FromTypePtr = T.getAsOpaquePtr(); } 00241 void setToType(QualType T) { ToTypePtr = T.getAsOpaquePtr(); } 00242 00243 ConversionSet &conversions() { 00244 return *reinterpret_cast<ConversionSet*>(Buffer); 00245 } 00246 00247 const ConversionSet &conversions() const { 00248 return *reinterpret_cast<const ConversionSet*>(Buffer); 00249 } 00250 00251 void addConversion(FunctionDecl *D) { 00252 conversions().push_back(D); 00253 } 00254 00255 typedef ConversionSet::iterator iterator; 00256 iterator begin() { return conversions().begin(); } 00257 iterator end() { return conversions().end(); } 00258 00259 typedef ConversionSet::const_iterator const_iterator; 00260 const_iterator begin() const { return conversions().begin(); } 00261 const_iterator end() const { return conversions().end(); } 00262 00263 void construct(); 00264 void destruct(); 00265 void copyFrom(const AmbiguousConversionSequence &); 00266 }; 00267 00268 /// BadConversionSequence - Records information about an invalid 00269 /// conversion sequence. 00270 struct BadConversionSequence { 00271 enum FailureKind { 00272 no_conversion, 00273 unrelated_class, 00274 suppressed_user, 00275 bad_qualifiers 00276 }; 00277 00278 // This can be null, e.g. for implicit object arguments. 00279 Expr *FromExpr; 00280 00281 FailureKind Kind; 00282 00283 private: 00284 // The type we're converting from (an opaque QualType). 00285 void *FromTy; 00286 00287 // The type we're converting to (an opaque QualType). 00288 void *ToTy; 00289 00290 public: 00291 void init(FailureKind K, Expr *From, QualType To) { 00292 init(K, From->getType(), To); 00293 FromExpr = From; 00294 } 00295 void init(FailureKind K, QualType From, QualType To) { 00296 Kind = K; 00297 FromExpr = 0; 00298 setFromType(From); 00299 setToType(To); 00300 } 00301 00302 QualType getFromType() const { return QualType::getFromOpaquePtr(FromTy); } 00303 QualType getToType() const { return QualType::getFromOpaquePtr(ToTy); } 00304 00305 void setFromExpr(Expr *E) { 00306 FromExpr = E; 00307 setFromType(E->getType()); 00308 } 00309 void setFromType(QualType T) { FromTy = T.getAsOpaquePtr(); } 00310 void setToType(QualType T) { ToTy = T.getAsOpaquePtr(); } 00311 }; 00312 00313 /// ImplicitConversionSequence - Represents an implicit conversion 00314 /// sequence, which may be a standard conversion sequence 00315 /// (C++ 13.3.3.1.1), user-defined conversion sequence (C++ 13.3.3.1.2), 00316 /// or an ellipsis conversion sequence (C++ 13.3.3.1.3). 00317 struct ImplicitConversionSequence { 00318 /// Kind - The kind of implicit conversion sequence. BadConversion 00319 /// specifies that there is no conversion from the source type to 00320 /// the target type. AmbiguousConversion represents the unique 00321 /// ambiguous conversion (C++0x [over.best.ics]p10). 00322 enum Kind { 00323 StandardConversion = 0, 00324 UserDefinedConversion, 00325 AmbiguousConversion, 00326 EllipsisConversion, 00327 BadConversion 00328 }; 00329 00330 private: 00331 enum { 00332 Uninitialized = BadConversion + 1 00333 }; 00334 00335 /// ConversionKind - The kind of implicit conversion sequence. 00336 unsigned ConversionKind; 00337 00338 void setKind(Kind K) { 00339 destruct(); 00340 ConversionKind = K; 00341 } 00342 00343 void destruct() { 00344 if (ConversionKind == AmbiguousConversion) Ambiguous.destruct(); 00345 } 00346 00347 public: 00348 union { 00349 /// When ConversionKind == StandardConversion, provides the 00350 /// details of the standard conversion sequence. 00351 StandardConversionSequence Standard; 00352 00353 /// When ConversionKind == UserDefinedConversion, provides the 00354 /// details of the user-defined conversion sequence. 00355 UserDefinedConversionSequence UserDefined; 00356 00357 /// When ConversionKind == AmbiguousConversion, provides the 00358 /// details of the ambiguous conversion. 00359 AmbiguousConversionSequence Ambiguous; 00360 00361 /// When ConversionKind == BadConversion, provides the details 00362 /// of the bad conversion. 00363 BadConversionSequence Bad; 00364 }; 00365 00366 ImplicitConversionSequence() : ConversionKind(Uninitialized) {} 00367 ~ImplicitConversionSequence() { 00368 destruct(); 00369 } 00370 ImplicitConversionSequence(const ImplicitConversionSequence &Other) 00371 : ConversionKind(Other.ConversionKind) 00372 { 00373 switch (ConversionKind) { 00374 case Uninitialized: break; 00375 case StandardConversion: Standard = Other.Standard; break; 00376 case UserDefinedConversion: UserDefined = Other.UserDefined; break; 00377 case AmbiguousConversion: Ambiguous.copyFrom(Other.Ambiguous); break; 00378 case EllipsisConversion: break; 00379 case BadConversion: Bad = Other.Bad; break; 00380 } 00381 } 00382 00383 ImplicitConversionSequence & 00384 operator=(const ImplicitConversionSequence &Other) { 00385 destruct(); 00386 new (this) ImplicitConversionSequence(Other); 00387 return *this; 00388 } 00389 00390 Kind getKind() const { 00391 assert(isInitialized() && "querying uninitialized conversion"); 00392 return Kind(ConversionKind); 00393 } 00394 00395 /// \brief Return a ranking of the implicit conversion sequence 00396 /// kind, where smaller ranks represent better conversion 00397 /// sequences. 00398 /// 00399 /// In particular, this routine gives user-defined conversion 00400 /// sequences and ambiguous conversion sequences the same rank, 00401 /// per C++ [over.best.ics]p10. 00402 unsigned getKindRank() const { 00403 switch (getKind()) { 00404 case StandardConversion: 00405 return 0; 00406 00407 case UserDefinedConversion: 00408 case AmbiguousConversion: 00409 return 1; 00410 00411 case EllipsisConversion: 00412 return 2; 00413 00414 case BadConversion: 00415 return 3; 00416 } 00417 00418 return 3; 00419 } 00420 00421 bool isBad() const { return getKind() == BadConversion; } 00422 bool isStandard() const { return getKind() == StandardConversion; } 00423 bool isEllipsis() const { return getKind() == EllipsisConversion; } 00424 bool isAmbiguous() const { return getKind() == AmbiguousConversion; } 00425 bool isUserDefined() const { return getKind() == UserDefinedConversion; } 00426 00427 /// Determines whether this conversion sequence has been 00428 /// initialized. Most operations should never need to query 00429 /// uninitialized conversions and should assert as above. 00430 bool isInitialized() const { return ConversionKind != Uninitialized; } 00431 00432 /// Sets this sequence as a bad conversion for an explicit argument. 00433 void setBad(BadConversionSequence::FailureKind Failure, 00434 Expr *FromExpr, QualType ToType) { 00435 setKind(BadConversion); 00436 Bad.init(Failure, FromExpr, ToType); 00437 } 00438 00439 /// Sets this sequence as a bad conversion for an implicit argument. 00440 void setBad(BadConversionSequence::FailureKind Failure, 00441 QualType FromType, QualType ToType) { 00442 setKind(BadConversion); 00443 Bad.init(Failure, FromType, ToType); 00444 } 00445 00446 void setStandard() { setKind(StandardConversion); } 00447 void setEllipsis() { setKind(EllipsisConversion); } 00448 void setUserDefined() { setKind(UserDefinedConversion); } 00449 void setAmbiguous() { 00450 if (ConversionKind == AmbiguousConversion) return; 00451 ConversionKind = AmbiguousConversion; 00452 Ambiguous.construct(); 00453 } 00454 00455 // The result of a comparison between implicit conversion 00456 // sequences. Use Sema::CompareImplicitConversionSequences to 00457 // actually perform the comparison. 00458 enum CompareKind { 00459 Better = -1, 00460 Indistinguishable = 0, 00461 Worse = 1 00462 }; 00463 00464 void DebugPrint() const; 00465 }; 00466 00467 enum OverloadFailureKind { 00468 ovl_fail_too_many_arguments, 00469 ovl_fail_too_few_arguments, 00470 ovl_fail_bad_conversion, 00471 ovl_fail_bad_deduction, 00472 00473 /// This conversion candidate was not considered because it 00474 /// duplicates the work of a trivial or derived-to-base 00475 /// conversion. 00476 ovl_fail_trivial_conversion, 00477 00478 /// This conversion candidate is not viable because its result 00479 /// type is not implicitly convertible to the desired type. 00480 ovl_fail_bad_final_conversion, 00481 00482 /// This conversion function template specialization candidate is not 00483 /// viable because the final conversion was not an exact match. 00484 ovl_fail_final_conversion_not_exact 00485 }; 00486 00487 /// OverloadCandidate - A single candidate in an overload set (C++ 13.3). 00488 struct OverloadCandidate { 00489 /// Function - The actual function that this candidate 00490 /// represents. When NULL, this is a built-in candidate 00491 /// (C++ [over.oper]) or a surrogate for a conversion to a 00492 /// function pointer or reference (C++ [over.call.object]). 00493 FunctionDecl *Function; 00494 00495 /// FoundDecl - The original declaration that was looked up / 00496 /// invented / otherwise found, together with its access. 00497 /// Might be a UsingShadowDecl or a FunctionTemplateDecl. 00498 DeclAccessPair FoundDecl; 00499 00500 // BuiltinTypes - Provides the return and parameter types of a 00501 // built-in overload candidate. Only valid when Function is NULL. 00502 struct { 00503 QualType ResultTy; 00504 QualType ParamTypes[3]; 00505 } BuiltinTypes; 00506 00507 /// Surrogate - The conversion function for which this candidate 00508 /// is a surrogate, but only if IsSurrogate is true. 00509 CXXConversionDecl *Surrogate; 00510 00511 /// Conversions - The conversion sequences used to convert the 00512 /// function arguments to the function parameters. 00513 llvm::SmallVector<ImplicitConversionSequence, 4> Conversions; 00514 00515 /// Viable - True to indicate that this overload candidate is viable. 00516 bool Viable; 00517 00518 /// IsSurrogate - True to indicate that this candidate is a 00519 /// surrogate for a conversion to a function pointer or reference 00520 /// (C++ [over.call.object]). 00521 bool IsSurrogate; 00522 00523 /// IgnoreObjectArgument - True to indicate that the first 00524 /// argument's conversion, which for this function represents the 00525 /// implicit object argument, should be ignored. This will be true 00526 /// when the candidate is a static member function (where the 00527 /// implicit object argument is just a placeholder) or a 00528 /// non-static member function when the call doesn't have an 00529 /// object argument. 00530 bool IgnoreObjectArgument; 00531 00532 /// FailureKind - The reason why this candidate is not viable. 00533 /// Actually an OverloadFailureKind. 00534 unsigned char FailureKind; 00535 00536 /// A structure used to record information about a failed 00537 /// template argument deduction. 00538 struct DeductionFailureInfo { 00539 // A Sema::TemplateDeductionResult. 00540 unsigned Result; 00541 00542 /// \brief Opaque pointer containing additional data about 00543 /// this deduction failure. 00544 void *Data; 00545 00546 /// \brief Retrieve the template parameter this deduction failure 00547 /// refers to, if any. 00548 TemplateParameter getTemplateParameter(); 00549 00550 /// \brief Retrieve the template argument list associated with this 00551 /// deduction failure, if any. 00552 TemplateArgumentList *getTemplateArgumentList(); 00553 00554 /// \brief Return the first template argument this deduction failure 00555 /// refers to, if any. 00556 const TemplateArgument *getFirstArg(); 00557 00558 /// \brief Return the second template argument this deduction failure 00559 /// refers to, if any. 00560 const TemplateArgument *getSecondArg(); 00561 00562 /// \brief Free any memory associated with this deduction failure. 00563 void Destroy(); 00564 }; 00565 00566 union { 00567 DeductionFailureInfo DeductionFailure; 00568 00569 /// FinalConversion - For a conversion function (where Function is 00570 /// a CXXConversionDecl), the standard conversion that occurs 00571 /// after the call to the overload candidate to convert the result 00572 /// of calling the conversion function to the required type. 00573 StandardConversionSequence FinalConversion; 00574 }; 00575 00576 /// hasAmbiguousConversion - Returns whether this overload 00577 /// candidate requires an ambiguous conversion or not. 00578 bool hasAmbiguousConversion() const { 00579 for (llvm::SmallVectorImpl<ImplicitConversionSequence>::const_iterator 00580 I = Conversions.begin(), E = Conversions.end(); I != E; ++I) { 00581 if (!I->isInitialized()) return false; 00582 if (I->isAmbiguous()) return true; 00583 } 00584 return false; 00585 } 00586 }; 00587 00588 /// OverloadCandidateSet - A set of overload candidates, used in C++ 00589 /// overload resolution (C++ 13.3). 00590 class OverloadCandidateSet : public llvm::SmallVector<OverloadCandidate, 16> { 00591 typedef llvm::SmallVector<OverloadCandidate, 16> inherited; 00592 llvm::SmallPtrSet<Decl *, 16> Functions; 00593 00594 SourceLocation Loc; 00595 00596 OverloadCandidateSet(const OverloadCandidateSet &); 00597 OverloadCandidateSet &operator=(const OverloadCandidateSet &); 00598 00599 public: 00600 OverloadCandidateSet(SourceLocation Loc) : Loc(Loc) {} 00601 00602 SourceLocation getLocation() const { return Loc; } 00603 00604 /// \brief Determine when this overload candidate will be new to the 00605 /// overload set. 00606 bool isNewCandidate(Decl *F) { 00607 return Functions.insert(F->getCanonicalDecl()); 00608 } 00609 00610 /// \brief Clear out all of the candidates. 00611 void clear(); 00612 00613 ~OverloadCandidateSet() { clear(); } 00614 }; 00615 } // end namespace clang 00616 00617 #endif // LLVM_CLANG_SEMA_OVERLOAD_H