aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-11-26 06:01:48 +0000
committerDouglas Gregor <dgregor@apple.com>2008-11-26 06:01:48 +0000
commit0a39668d6adf1d709985eef149136a80372f5032 (patch)
tree6b428ea7d43fe302cc3a8d993023ea8895f649ee /lib/Sema/SemaOverload.cpp
parentf6b89691d2fdb88b97edabbe5f390fb2919c8f0a (diff)
Tweak the new ResolveOverloadedCallFn to just return a FunctionDecl. It makes ActOnCallExpr simpler
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60094 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r--lib/Sema/SemaOverload.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 14e0f44c87..c6b028456f 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -2967,24 +2967,20 @@ Sema::ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType,
/// (which eventually refers to the set of overloaded functions in
/// Ovl) and the call arguments Args/NumArgs, attempt to resolve the
/// function call down to a specific function. If overload resolution
-/// succeeds, returns an expression that refers to a specific function
-/// and deletes Fn. Otherwise, emits diagnostics, deletes all of the
+/// succeeds, returns the function declaration produced by overload
+/// resolution. Otherwise, emits diagnostics, deletes all of the
/// arguments and Fn, and returns NULL.
-Expr *Sema::ResolveOverloadedCallFn(Expr *Fn, OverloadedFunctionDecl *Ovl,
- SourceLocation LParenLoc,
- Expr **Args, unsigned NumArgs,
- SourceLocation *CommaLocs,
- SourceLocation RParenLoc) {
+FunctionDecl *Sema::ResolveOverloadedCallFn(Expr *Fn, OverloadedFunctionDecl *Ovl,
+ SourceLocation LParenLoc,
+ Expr **Args, unsigned NumArgs,
+ SourceLocation *CommaLocs,
+ SourceLocation RParenLoc) {
OverloadCandidateSet CandidateSet;
AddOverloadCandidates(Ovl, Args, NumArgs, CandidateSet);
OverloadCandidateSet::iterator Best;
switch (BestViableFunction(CandidateSet, Best)) {
- case OR_Success: {
- Expr *NewFn = new DeclRefExpr(Best->Function, Best->Function->getType(),
- Fn->getSourceRange().getBegin());
- Fn->Destroy(Context);
- return NewFn;
- }
+ case OR_Success:
+ return Best->Function;
case OR_No_Viable_Function:
Diag(Fn->getSourceRange().getBegin(),