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 | 99dcbff1542f37a17952cd34d9c8ef022e28663a (patch) | |
tree | bae2d6acb310bf600e6090571c3d27b9efdaf1a3 /clang/lib/Sema/SemaExpr.cpp | |
parent | 3336b1f06b68f3cb9e9c9601b3139160d82f84d8 (diff) | |
download | bcm5719-llvm-99dcbff1542f37a17952cd34d9c8ef022e28663a.tar.gz bcm5719-llvm-99dcbff1542f37a17952cd34d9c8ef022e28663a.zip |
Move the overloading logic of Sema::ActOnCallExpr to a separate function
llvm-svn: 60093
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index fdd5732cc51..a6e1611dc31 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/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()) |