diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-11-26 05:54:23 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-11-26 05:54:23 +0000 |
commit | f6b89691d2fdb88b97edabbe5f390fb2919c8f0a (patch) | |
tree | c62e9154e801f8ccf9d0a3eae07fb0d0372d0faa /lib/Sema/SemaExpr.cpp | |
parent | 209223677766854ca507972fefd4fe55b9f7e4f5 (diff) |
Move the overloading logic of Sema::ActOnCallExpr to a separate function
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60093 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index fdd5732cc5..a6e1611dc3 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1294,39 +1294,13 @@ ActOnCallExpr(ExprTy *fn, SourceLocation LParenLoc, } } - // If we have a set of overloaded functions, perform overload - // resolution to pick the function. if (Ovl) { - OverloadCandidateSet CandidateSet; - AddOverloadCandidates(Ovl, Args, NumArgs, CandidateSet); - OverloadCandidateSet::iterator Best; - switch (BestViableFunction(CandidateSet, Best)) { - case OR_Success: - { - // Success! Let the remainder of this function build a call to - // the function selected by overload resolution. - FDecl = Best->Function; - Expr *NewFn = new DeclRefExpr(FDecl, FDecl->getType(), - Fn->getSourceRange().getBegin()); - delete Fn; - Fn = NewFn; - } - break; - - case OR_No_Viable_Function: - Diag(Fn->getSourceRange().getBegin(), - diag::err_ovl_no_viable_function_in_call) - << Ovl->getDeclName() << (unsigned)CandidateSet.size() - << Fn->getSourceRange(); - PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false); + Fn = ResolveOverloadedCallFn(Fn, Ovl, LParenLoc, Args, NumArgs, CommaLocs, + RParenLoc); + if (!Fn) return true; - case OR_Ambiguous: - Diag(Fn->getSourceRange().getBegin(), diag::err_ovl_ambiguous_call) - << Ovl->getDeclName() << Fn->getSourceRange(); - PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true); - return true; - } + // Fall through and build the call to Fn. } if (getLangOptions().CPlusPlus && Fn->getType()->isRecordType()) |