SemaOverload.cpp (195099) | SemaOverload.cpp (195341) |
---|---|
1//===--- SemaOverload.cpp - 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//===----------------------------------------------------------------------===// --- 1361 unchanged lines hidden (view full) --- 1370 // functions are all the converting constructors (12.3.1) of 1371 // that class. The argument list is the expression-list within 1372 // the parentheses of the initializer. 1373 DeclarationName ConstructorName 1374 = Context.DeclarationNames.getCXXConstructorName( 1375 Context.getCanonicalType(ToType).getUnqualifiedType()); 1376 DeclContext::lookup_iterator Con, ConEnd; 1377 for (llvm::tie(Con, ConEnd) | 1//===--- SemaOverload.cpp - 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//===----------------------------------------------------------------------===// --- 1361 unchanged lines hidden (view full) --- 1370 // functions are all the converting constructors (12.3.1) of 1371 // that class. The argument list is the expression-list within 1372 // the parentheses of the initializer. 1373 DeclarationName ConstructorName 1374 = Context.DeclarationNames.getCXXConstructorName( 1375 Context.getCanonicalType(ToType).getUnqualifiedType()); 1376 DeclContext::lookup_iterator Con, ConEnd; 1377 for (llvm::tie(Con, ConEnd) |
1378 = ToRecordDecl->lookup(Context, ConstructorName); | 1378 = ToRecordDecl->lookup(ConstructorName); |
1379 Con != ConEnd; ++Con) { 1380 CXXConstructorDecl *Constructor = cast<CXXConstructorDecl>(*Con); 1381 if (Constructor->isConvertingConstructor()) 1382 AddOverloadCandidate(Constructor, &From, 1, CandidateSet, 1383 /*SuppressUserConversions=*/true, ForceRValue); 1384 } 1385 } 1386 } --- 769 unchanged lines hidden (view full) --- 2156/// \brief Add all of the function declarations in the given function set to 2157/// the overload canddiate set. 2158void Sema::AddFunctionCandidates(const FunctionSet &Functions, 2159 Expr **Args, unsigned NumArgs, 2160 OverloadCandidateSet& CandidateSet, 2161 bool SuppressUserConversions) { 2162 for (FunctionSet::const_iterator F = Functions.begin(), 2163 FEnd = Functions.end(); | 1379 Con != ConEnd; ++Con) { 1380 CXXConstructorDecl *Constructor = cast<CXXConstructorDecl>(*Con); 1381 if (Constructor->isConvertingConstructor()) 1382 AddOverloadCandidate(Constructor, &From, 1, CandidateSet, 1383 /*SuppressUserConversions=*/true, ForceRValue); 1384 } 1385 } 1386 } --- 769 unchanged lines hidden (view full) --- 2156/// \brief Add all of the function declarations in the given function set to 2157/// the overload canddiate set. 2158void Sema::AddFunctionCandidates(const FunctionSet &Functions, 2159 Expr **Args, unsigned NumArgs, 2160 OverloadCandidateSet& CandidateSet, 2161 bool SuppressUserConversions) { 2162 for (FunctionSet::const_iterator F = Functions.begin(), 2163 FEnd = Functions.end(); |
2164 F != FEnd; ++F) 2165 AddOverloadCandidate(*F, Args, NumArgs, CandidateSet, 2166 SuppressUserConversions); | 2164 F != FEnd; ++F) { 2165 if (FunctionDecl *FD = dyn_cast<FunctionDecl>(*F)) 2166 AddOverloadCandidate(FD, Args, NumArgs, CandidateSet, 2167 SuppressUserConversions); 2168 else 2169 AddTemplateOverloadCandidate(cast<FunctionTemplateDecl>(*F), 2170 /*FIXME: explicit args */false, 0, 0, 2171 Args, NumArgs, CandidateSet, 2172 SuppressUserConversions); 2173 } |
2167} 2168 2169/// AddMethodCandidate - Adds the given C++ member function to the set 2170/// of candidate functions, using the given function call arguments 2171/// and the object argument (@c Object). For example, in a call 2172/// @c o.f(a1,a2), @c Object will contain @c o and @c Args will contain 2173/// both @c a1 and @c a2. If @p SuppressUserConversions, then don't 2174/// allow user-defined conversions via constructors or conversion --- 87 unchanged lines hidden (view full) --- 2262 } 2263} 2264 2265/// \brief Add a C++ function template as a candidate in the candidate set, 2266/// using template argument deduction to produce an appropriate function 2267/// template specialization. 2268void 2269Sema::AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, | 2174} 2175 2176/// AddMethodCandidate - Adds the given C++ member function to the set 2177/// of candidate functions, using the given function call arguments 2178/// and the object argument (@c Object). For example, in a call 2179/// @c o.f(a1,a2), @c Object will contain @c o and @c Args will contain 2180/// both @c a1 and @c a2. If @p SuppressUserConversions, then don't 2181/// allow user-defined conversions via constructors or conversion --- 87 unchanged lines hidden (view full) --- 2269 } 2270} 2271 2272/// \brief Add a C++ function template as a candidate in the candidate set, 2273/// using template argument deduction to produce an appropriate function 2274/// template specialization. 2275void 2276Sema::AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, |
2277 bool HasExplicitTemplateArgs, 2278 const TemplateArgument *ExplicitTemplateArgs, 2279 unsigned NumExplicitTemplateArgs, |
|
2270 Expr **Args, unsigned NumArgs, 2271 OverloadCandidateSet& CandidateSet, 2272 bool SuppressUserConversions, 2273 bool ForceRValue) { 2274 // C++ [over.match.funcs]p7: 2275 // In each case where a candidate is a function template, candidate 2276 // function template specializations are generated using template argument 2277 // deduction (14.8.3, 14.8.2). Those candidates are then handled as 2278 // candidate functions in the usual way.113) A given name can refer to one 2279 // or more function templates and also to a set of overloaded non-template 2280 // functions. In such a case, the candidate functions generated from each 2281 // function template are combined with the set of non-template candidate 2282 // functions. 2283 TemplateDeductionInfo Info(Context); 2284 FunctionDecl *Specialization = 0; 2285 if (TemplateDeductionResult Result | 2280 Expr **Args, unsigned NumArgs, 2281 OverloadCandidateSet& CandidateSet, 2282 bool SuppressUserConversions, 2283 bool ForceRValue) { 2284 // C++ [over.match.funcs]p7: 2285 // In each case where a candidate is a function template, candidate 2286 // function template specializations are generated using template argument 2287 // deduction (14.8.3, 14.8.2). Those candidates are then handled as 2288 // candidate functions in the usual way.113) A given name can refer to one 2289 // or more function templates and also to a set of overloaded non-template 2290 // functions. In such a case, the candidate functions generated from each 2291 // function template are combined with the set of non-template candidate 2292 // functions. 2293 TemplateDeductionInfo Info(Context); 2294 FunctionDecl *Specialization = 0; 2295 if (TemplateDeductionResult Result |
2286 = DeduceTemplateArguments(FunctionTemplate, Args, NumArgs, 2287 Specialization, Info)) { | 2296 = DeduceTemplateArguments(FunctionTemplate, HasExplicitTemplateArgs, 2297 ExplicitTemplateArgs, NumExplicitTemplateArgs, 2298 Args, NumArgs, Specialization, Info)) { |
2288 // FIXME: Record what happened with template argument deduction, so 2289 // that we can give the user a beautiful diagnostic. 2290 (void)Result; 2291 return; 2292 } 2293 2294 // Add the function template specialization produced by template argument 2295 // deduction as a candidate. --- 209 unchanged lines hidden (view full) --- 2505 2506 // -- If T1 is a class type, the set of member candidates is the 2507 // result of the qualified lookup of T1::operator@ 2508 // (13.3.1.1.1); otherwise, the set of member candidates is 2509 // empty. 2510 // FIXME: Lookup in base classes, too! 2511 if (const RecordType *T1Rec = T1->getAsRecordType()) { 2512 DeclContext::lookup_const_iterator Oper, OperEnd; | 2299 // FIXME: Record what happened with template argument deduction, so 2300 // that we can give the user a beautiful diagnostic. 2301 (void)Result; 2302 return; 2303 } 2304 2305 // Add the function template specialization produced by template argument 2306 // deduction as a candidate. --- 209 unchanged lines hidden (view full) --- 2516 2517 // -- If T1 is a class type, the set of member candidates is the 2518 // result of the qualified lookup of T1::operator@ 2519 // (13.3.1.1.1); otherwise, the set of member candidates is 2520 // empty. 2521 // FIXME: Lookup in base classes, too! 2522 if (const RecordType *T1Rec = T1->getAsRecordType()) { 2523 DeclContext::lookup_const_iterator Oper, OperEnd; |
2513 for (llvm::tie(Oper, OperEnd) = T1Rec->getDecl()->lookup(Context, OpName); | 2524 for (llvm::tie(Oper, OperEnd) = T1Rec->getDecl()->lookup(OpName); |
2514 Oper != OperEnd; ++Oper) 2515 AddMethodCandidate(cast<CXXMethodDecl>(*Oper), Args[0], 2516 Args+1, NumArgs - 1, CandidateSet, 2517 /*SuppressUserConversions=*/false); 2518 } 2519} 2520 2521/// AddBuiltinCandidate - Add a candidate for a built-in --- 878 unchanged lines hidden (view full) --- 3400 FunctionSet Functions; 3401 3402 // Record all of the function candidates that we've already 3403 // added to the overload set, so that we don't add those same 3404 // candidates a second time. 3405 for (OverloadCandidateSet::iterator Cand = CandidateSet.begin(), 3406 CandEnd = CandidateSet.end(); 3407 Cand != CandEnd; ++Cand) | 2525 Oper != OperEnd; ++Oper) 2526 AddMethodCandidate(cast<CXXMethodDecl>(*Oper), Args[0], 2527 Args+1, NumArgs - 1, CandidateSet, 2528 /*SuppressUserConversions=*/false); 2529 } 2530} 2531 2532/// AddBuiltinCandidate - Add a candidate for a built-in --- 878 unchanged lines hidden (view full) --- 3411 FunctionSet Functions; 3412 3413 // Record all of the function candidates that we've already 3414 // added to the overload set, so that we don't add those same 3415 // candidates a second time. 3416 for (OverloadCandidateSet::iterator Cand = CandidateSet.begin(), 3417 CandEnd = CandidateSet.end(); 3418 Cand != CandEnd; ++Cand) |
3408 if (Cand->Function) | 3419 if (Cand->Function) { |
3409 Functions.insert(Cand->Function); | 3420 Functions.insert(Cand->Function); |
3421 if (FunctionTemplateDecl *FunTmpl = Cand->Function->getPrimaryTemplate()) 3422 Functions.insert(FunTmpl); 3423 } |
|
3410 3411 ArgumentDependentLookup(Name, Args, NumArgs, Functions); 3412 3413 // Erase all of the candidates we already knew about. 3414 // FIXME: This is suboptimal. Is there a better way? 3415 for (OverloadCandidateSet::iterator Cand = CandidateSet.begin(), 3416 CandEnd = CandidateSet.end(); 3417 Cand != CandEnd; ++Cand) | 3424 3425 ArgumentDependentLookup(Name, Args, NumArgs, Functions); 3426 3427 // Erase all of the candidates we already knew about. 3428 // FIXME: This is suboptimal. Is there a better way? 3429 for (OverloadCandidateSet::iterator Cand = CandidateSet.begin(), 3430 CandEnd = CandidateSet.end(); 3431 Cand != CandEnd; ++Cand) |
3418 if (Cand->Function) | 3432 if (Cand->Function) { |
3419 Functions.erase(Cand->Function); | 3433 Functions.erase(Cand->Function); |
3434 if (FunctionTemplateDecl *FunTmpl = Cand->Function->getPrimaryTemplate()) 3435 Functions.erase(FunTmpl); 3436 } |
|
3420 3421 // For each of the ADL candidates we found, add it to the overload 3422 // set. 3423 for (FunctionSet::iterator Func = Functions.begin(), 3424 FuncEnd = Functions.end(); | 3437 3438 // For each of the ADL candidates we found, add it to the overload 3439 // set. 3440 for (FunctionSet::iterator Func = Functions.begin(), 3441 FuncEnd = Functions.end(); |
3425 Func != FuncEnd; ++Func) 3426 AddOverloadCandidate(*Func, Args, NumArgs, CandidateSet); | 3442 Func != FuncEnd; ++Func) { 3443 if (FunctionDecl *FD = dyn_cast<FunctionDecl>(*Func)) 3444 AddOverloadCandidate(FD, Args, NumArgs, CandidateSet); 3445 else 3446 AddTemplateOverloadCandidate(cast<FunctionTemplateDecl>(*Func), 3447 /*FIXME: explicit args */false, 0, 0, 3448 Args, NumArgs, CandidateSet); 3449 } |
3427} 3428 3429/// isBetterOverloadCandidate - Determines whether the first overload 3430/// candidate is a better candidate than the second (C++ 13.3.3p1). 3431bool 3432Sema::isBetterOverloadCandidate(const OverloadCandidate& Cand1, 3433 const OverloadCandidate& Cand2) 3434{ --- 116 unchanged lines hidden (view full) --- 3551 Best = CandidateSet.end(); 3552 return OR_Ambiguous; 3553 } 3554 } 3555 3556 // Best is the best viable function. 3557 if (Best->Function && 3558 (Best->Function->isDeleted() || | 3450} 3451 3452/// isBetterOverloadCandidate - Determines whether the first overload 3453/// candidate is a better candidate than the second (C++ 13.3.3p1). 3454bool 3455Sema::isBetterOverloadCandidate(const OverloadCandidate& Cand1, 3456 const OverloadCandidate& Cand2) 3457{ --- 116 unchanged lines hidden (view full) --- 3574 Best = CandidateSet.end(); 3575 return OR_Ambiguous; 3576 } 3577 } 3578 3579 // Best is the best viable function. 3580 if (Best->Function && 3581 (Best->Function->isDeleted() || |
3559 Best->Function->getAttr<UnavailableAttr>(Context))) | 3582 Best->Function->getAttr |
3560 return OR_Deleted; 3561 3562 // C++ [basic.def.odr]p2: 3563 // An overloaded function is used if it is selected by overload resolution 3564 // when referred to from a potentially-evaluated expression. [Note: this 3565 // covers calls to named functions (5.2.2), operator overloading 3566 // (clause 13), user-defined conversions (12.3.2), allocation function for 3567 // placement new (5.3.4), as well as non-default initialization (8.5). --- 10 unchanged lines hidden (view full) --- 3578 bool OnlyViable) 3579{ 3580 OverloadCandidateSet::iterator Cand = CandidateSet.begin(), 3581 LastCand = CandidateSet.end(); 3582 for (; Cand != LastCand; ++Cand) { 3583 if (Cand->Viable || !OnlyViable) { 3584 if (Cand->Function) { 3585 if (Cand->Function->isDeleted() || | 3583 return OR_Deleted; 3584 3585 // C++ [basic.def.odr]p2: 3586 // An overloaded function is used if it is selected by overload resolution 3587 // when referred to from a potentially-evaluated expression. [Note: this 3588 // covers calls to named functions (5.2.2), operator overloading 3589 // (clause 13), user-defined conversions (12.3.2), allocation function for 3590 // placement new (5.3.4), as well as non-default initialization (8.5). --- 10 unchanged lines hidden (view full) --- 3601 bool OnlyViable) 3602{ 3603 OverloadCandidateSet::iterator Cand = CandidateSet.begin(), 3604 LastCand = CandidateSet.end(); 3605 for (; Cand != LastCand; ++Cand) { 3606 if (Cand->Viable || !OnlyViable) { 3607 if (Cand->Function) { 3608 if (Cand->Function->isDeleted() || |
3586 Cand->Function->getAttr<UnavailableAttr>(Context)) { | 3609 Cand->Function->getAttr |
3587 // Deleted or "unavailable" function. 3588 Diag(Cand->Function->getLocation(), diag::err_ovl_candidate_deleted) 3589 << Cand->Function->isDeleted(); 3590 } else { 3591 // Normal function 3592 // FIXME: Give a better reason! 3593 Diag(Cand->Function->getLocation(), diag::err_ovl_candidate); 3594 } --- 141 unchanged lines hidden (view full) --- 3736/// (which eventually refers to the declaration Func) and the call 3737/// arguments Args/NumArgs, attempt to resolve the function call down 3738/// to a specific function. If overload resolution succeeds, returns 3739/// the function declaration produced by overload 3740/// resolution. Otherwise, emits diagnostics, deletes all of the 3741/// arguments and Fn, and returns NULL. 3742FunctionDecl *Sema::ResolveOverloadedCallFn(Expr *Fn, NamedDecl *Callee, 3743 DeclarationName UnqualifiedName, | 3610 // Deleted or "unavailable" function. 3611 Diag(Cand->Function->getLocation(), diag::err_ovl_candidate_deleted) 3612 << Cand->Function->isDeleted(); 3613 } else { 3614 // Normal function 3615 // FIXME: Give a better reason! 3616 Diag(Cand->Function->getLocation(), diag::err_ovl_candidate); 3617 } --- 141 unchanged lines hidden (view full) --- 3759/// (which eventually refers to the declaration Func) and the call 3760/// arguments Args/NumArgs, attempt to resolve the function call down 3761/// to a specific function. If overload resolution succeeds, returns 3762/// the function declaration produced by overload 3763/// resolution. Otherwise, emits diagnostics, deletes all of the 3764/// arguments and Fn, and returns NULL. 3765FunctionDecl *Sema::ResolveOverloadedCallFn(Expr *Fn, NamedDecl *Callee, 3766 DeclarationName UnqualifiedName, |
3767 bool HasExplicitTemplateArgs, 3768 const TemplateArgument *ExplicitTemplateArgs, 3769 unsigned NumExplicitTemplateArgs, |
|
3744 SourceLocation LParenLoc, 3745 Expr **Args, unsigned NumArgs, 3746 SourceLocation *CommaLocs, 3747 SourceLocation RParenLoc, 3748 bool &ArgumentDependentLookup) { 3749 OverloadCandidateSet CandidateSet; 3750 3751 // Add the functions denoted by Callee to the set of candidate --- 16 unchanged lines hidden (view full) --- 3768 // then Y is empty. 3769 if (OverloadedFunctionDecl *Ovl 3770 = dyn_cast_or_null<OverloadedFunctionDecl>(Callee)) { 3771 for (OverloadedFunctionDecl::function_iterator Func = Ovl->function_begin(), 3772 FuncEnd = Ovl->function_end(); 3773 Func != FuncEnd; ++Func) { 3774 DeclContext *Ctx = 0; 3775 if (FunctionDecl *FunDecl = dyn_cast<FunctionDecl>(*Func)) { | 3770 SourceLocation LParenLoc, 3771 Expr **Args, unsigned NumArgs, 3772 SourceLocation *CommaLocs, 3773 SourceLocation RParenLoc, 3774 bool &ArgumentDependentLookup) { 3775 OverloadCandidateSet CandidateSet; 3776 3777 // Add the functions denoted by Callee to the set of candidate --- 16 unchanged lines hidden (view full) --- 3794 // then Y is empty. 3795 if (OverloadedFunctionDecl *Ovl 3796 = dyn_cast_or_null<OverloadedFunctionDecl>(Callee)) { 3797 for (OverloadedFunctionDecl::function_iterator Func = Ovl->function_begin(), 3798 FuncEnd = Ovl->function_end(); 3799 Func != FuncEnd; ++Func) { 3800 DeclContext *Ctx = 0; 3801 if (FunctionDecl *FunDecl = dyn_cast<FunctionDecl>(*Func)) { |
3802 if (HasExplicitTemplateArgs) 3803 continue; 3804 |
|
3776 AddOverloadCandidate(FunDecl, Args, NumArgs, CandidateSet); 3777 Ctx = FunDecl->getDeclContext(); 3778 } else { 3779 FunctionTemplateDecl *FunTmpl = cast<FunctionTemplateDecl>(*Func); | 3805 AddOverloadCandidate(FunDecl, Args, NumArgs, CandidateSet); 3806 Ctx = FunDecl->getDeclContext(); 3807 } else { 3808 FunctionTemplateDecl *FunTmpl = cast<FunctionTemplateDecl>(*Func); |
3780 AddTemplateOverloadCandidate(FunTmpl, Args, NumArgs, CandidateSet); | 3809 AddTemplateOverloadCandidate(FunTmpl, HasExplicitTemplateArgs, 3810 ExplicitTemplateArgs, 3811 NumExplicitTemplateArgs, 3812 Args, NumArgs, CandidateSet); |
3781 Ctx = FunTmpl->getDeclContext(); 3782 } 3783 3784 3785 if (Ctx->isRecord() || Ctx->isFunctionOrMethod()) 3786 ArgumentDependentLookup = false; 3787 } 3788 } else if (FunctionDecl *Func = dyn_cast_or_null<FunctionDecl>(Callee)) { | 3813 Ctx = FunTmpl->getDeclContext(); 3814 } 3815 3816 3817 if (Ctx->isRecord() || Ctx->isFunctionOrMethod()) 3818 ArgumentDependentLookup = false; 3819 } 3820 } else if (FunctionDecl *Func = dyn_cast_or_null<FunctionDecl>(Callee)) { |
3821 assert(!HasExplicitTemplateArgs && "Explicit template arguments?"); |
|
3789 AddOverloadCandidate(Func, Args, NumArgs, CandidateSet); 3790 3791 if (Func->getDeclContext()->isRecord() || 3792 Func->getDeclContext()->isFunctionOrMethod()) 3793 ArgumentDependentLookup = false; 3794 } else if (FunctionTemplateDecl *FuncTemplate 3795 = dyn_cast_or_null<FunctionTemplateDecl>(Callee)) { | 3822 AddOverloadCandidate(Func, Args, NumArgs, CandidateSet); 3823 3824 if (Func->getDeclContext()->isRecord() || 3825 Func->getDeclContext()->isFunctionOrMethod()) 3826 ArgumentDependentLookup = false; 3827 } else if (FunctionTemplateDecl *FuncTemplate 3828 = dyn_cast_or_null<FunctionTemplateDecl>(Callee)) { |
3796 AddTemplateOverloadCandidate(FuncTemplate, Args, NumArgs, CandidateSet); | 3829 AddTemplateOverloadCandidate(FuncTemplate, HasExplicitTemplateArgs, 3830 ExplicitTemplateArgs, 3831 NumExplicitTemplateArgs, 3832 Args, NumArgs, CandidateSet); |
3797 3798 if (FuncTemplate->getDeclContext()->isRecord()) 3799 ArgumentDependentLookup = false; 3800 } 3801 3802 if (Callee) 3803 UnqualifiedName = Callee->getDeclName(); 3804 | 3833 3834 if (FuncTemplate->getDeclContext()->isRecord()) 3835 ArgumentDependentLookup = false; 3836 } 3837 3838 if (Callee) 3839 UnqualifiedName = Callee->getDeclName(); 3840 |
3841 // FIXME: Pass explicit template arguments through for ADL |
|
3805 if (ArgumentDependentLookup) 3806 AddArgumentDependentLookupCandidates(UnqualifiedName, Args, NumArgs, 3807 CandidateSet); 3808 3809 OverloadCandidateSet::iterator Best; 3810 switch (BestViableFunction(CandidateSet, Fn->getLocStart(), Best)) { 3811 case OR_Success: 3812 return Best->Function; --- 455 unchanged lines hidden (view full) --- 4268 // evaluates to a class object of type ���cv T���, then the set of 4269 // candidate functions includes at least the function call 4270 // operators of T. The function call operators of T are obtained by 4271 // ordinary lookup of the name operator() in the context of 4272 // (E).operator(). 4273 OverloadCandidateSet CandidateSet; 4274 DeclarationName OpName = Context.DeclarationNames.getCXXOperatorName(OO_Call); 4275 DeclContext::lookup_const_iterator Oper, OperEnd; | 3842 if (ArgumentDependentLookup) 3843 AddArgumentDependentLookupCandidates(UnqualifiedName, Args, NumArgs, 3844 CandidateSet); 3845 3846 OverloadCandidateSet::iterator Best; 3847 switch (BestViableFunction(CandidateSet, Fn->getLocStart(), Best)) { 3848 case OR_Success: 3849 return Best->Function; --- 455 unchanged lines hidden (view full) --- 4305 // evaluates to a class object of type ���cv T���, then the set of 4306 // candidate functions includes at least the function call 4307 // operators of T. The function call operators of T are obtained by 4308 // ordinary lookup of the name operator() in the context of 4309 // (E).operator(). 4310 OverloadCandidateSet CandidateSet; 4311 DeclarationName OpName = Context.DeclarationNames.getCXXOperatorName(OO_Call); 4312 DeclContext::lookup_const_iterator Oper, OperEnd; |
4276 for (llvm::tie(Oper, OperEnd) = Record->getDecl()->lookup(Context, OpName); | 4313 for (llvm::tie(Oper, OperEnd) = Record->getDecl()->lookup(OpName); |
4277 Oper != OperEnd; ++Oper) 4278 AddMethodCandidate(cast<CXXMethodDecl>(*Oper), Object, Args, NumArgs, 4279 CandidateSet, /*SuppressUserConversions=*/false); 4280 4281 // C++ [over.call.object]p2: 4282 // In addition, for each conversion function declared in T of the 4283 // form 4284 // --- 187 unchanged lines hidden (view full) --- 4472 // overload resolution mechanism (13.3). 4473 // FIXME: look in base classes. 4474 DeclarationName OpName = Context.DeclarationNames.getCXXOperatorName(OO_Arrow); 4475 OverloadCandidateSet CandidateSet; 4476 const RecordType *BaseRecord = Base->getType()->getAsRecordType(); 4477 4478 DeclContext::lookup_const_iterator Oper, OperEnd; 4479 for (llvm::tie(Oper, OperEnd) | 4314 Oper != OperEnd; ++Oper) 4315 AddMethodCandidate(cast<CXXMethodDecl>(*Oper), Object, Args, NumArgs, 4316 CandidateSet, /*SuppressUserConversions=*/false); 4317 4318 // C++ [over.call.object]p2: 4319 // In addition, for each conversion function declared in T of the 4320 // form 4321 // --- 187 unchanged lines hidden (view full) --- 4509 // overload resolution mechanism (13.3). 4510 // FIXME: look in base classes. 4511 DeclarationName OpName = Context.DeclarationNames.getCXXOperatorName(OO_Arrow); 4512 OverloadCandidateSet CandidateSet; 4513 const RecordType *BaseRecord = Base->getType()->getAsRecordType(); 4514 4515 DeclContext::lookup_const_iterator Oper, OperEnd; 4516 for (llvm::tie(Oper, OperEnd) |
4480 = BaseRecord->getDecl()->lookup(Context, OpName); 4481 Oper != OperEnd; ++Oper) | 4517 = BaseRecord->getDecl()->lookup(OpName); Oper != OperEnd; ++Oper) |
4482 AddMethodCandidate(cast<CXXMethodDecl>(*Oper), Base, 0, 0, CandidateSet, 4483 /*SuppressUserConversions=*/false); 4484 4485 ExprOwningPtr<Expr> BasePtr(this, Base); 4486 4487 // Perform overload resolution. 4488 OverloadCandidateSet::iterator Best; 4489 switch (BestViableFunction(CandidateSet, OpLoc, Best)) { --- 94 unchanged lines hidden --- | 4518 AddMethodCandidate(cast<CXXMethodDecl>(*Oper), Base, 0, 0, CandidateSet, 4519 /*SuppressUserConversions=*/false); 4520 4521 ExprOwningPtr<Expr> BasePtr(this, Base); 4522 4523 // Perform overload resolution. 4524 OverloadCandidateSet::iterator Best; 4525 switch (BestViableFunction(CandidateSet, OpLoc, Best)) { --- 94 unchanged lines hidden --- |