[llvm-branch-commits] [cfe-branch] r118585 - in /cfe/branches/Apple/whitney: lib/Sema/SemaCodeComplete.cpp lib/Sema/SemaExpr.cpp test/CodeCompletion/call.cpp test/SemaCXX/overload-call.cpp
Daniel Dunbar
daniel at zuster.org
Tue Nov 9 09:33:13 PST 2010
Author: ddunbar
Date: Tue Nov 9 11:33:12 2010
New Revision: 118585
URL: http://llvm.org/viewvc/llvm-project?rev=118585&view=rev
Log:
Merge r118508:
--
Author: Douglas Gregor <dgregor at apple.com>
Date: Tue Nov 9 16:13:15 2010 +0000
Handle overload resolution when calling an overloaded function set
with, e.g., (&f)(a, b, c). Fixes PR8013.
Modified:
cfe/branches/Apple/whitney/lib/Sema/SemaCodeComplete.cpp
cfe/branches/Apple/whitney/lib/Sema/SemaExpr.cpp
cfe/branches/Apple/whitney/test/CodeCompletion/call.cpp
cfe/branches/Apple/whitney/test/SemaCXX/overload-call.cpp
Modified: cfe/branches/Apple/whitney/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaCodeComplete.cpp?rev=118585&r1=118584&r2=118585&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaCodeComplete.cpp Tue Nov 9 11:33:12 2010
@@ -3306,6 +3306,10 @@
llvm::SmallVector<ResultCandidate, 8> Results;
Expr *NakedFn = Fn->IgnoreParenCasts();
+ if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(NakedFn))
+ if (UnOp->getOpcode() == UO_AddrOf)
+ NakedFn = UnOp->getSubExpr()->IgnoreParens();
+
if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(NakedFn))
AddOverloadedCallCandidates(ULE, Args, NumArgs, CandidateSet,
/*PartialOverloading=*/ true);
Modified: cfe/branches/Apple/whitney/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaExpr.cpp?rev=118585&r1=118584&r2=118585&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaExpr.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaExpr.cpp Tue Nov 9 11:33:12 2010
@@ -3777,17 +3777,15 @@
// lookup and whether there were any explicitly-specified template arguments.
Expr *NakedFn = Fn->IgnoreParens();
- if (isa<UnresolvedLookupExpr>(NakedFn)) {
- UnresolvedLookupExpr *ULE = cast<UnresolvedLookupExpr>(NakedFn);
- return BuildOverloadedCallExpr(S, Fn, ULE, LParenLoc, Args, NumArgs,
- RParenLoc);
- }
-
NamedDecl *NDecl = 0;
if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(NakedFn))
if (UnOp->getOpcode() == UO_AddrOf)
NakedFn = UnOp->getSubExpr()->IgnoreParens();
+ if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(NakedFn))
+ return BuildOverloadedCallExpr(S, Fn, ULE, LParenLoc, Args, NumArgs,
+ RParenLoc);
+
if (isa<DeclRefExpr>(NakedFn))
NDecl = cast<DeclRefExpr>(NakedFn)->getDecl();
Modified: cfe/branches/Apple/whitney/test/CodeCompletion/call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/CodeCompletion/call.cpp?rev=118585&r1=118584&r2=118585&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/CodeCompletion/call.cpp (original)
+++ cfe/branches/Apple/whitney/test/CodeCompletion/call.cpp Tue Nov 9 11:33:12 2010
@@ -17,12 +17,14 @@
void test() {
f(Y(), 0, 0);
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC1 %s
+ (&f)(Y(), 0, 0);
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: COMPLETION: Pattern : dynamic_cast<<#type#>>(<#expression#>)
// CHECK-CC1: f(N::Y y, <#int ZZ#>)
// CHECK-CC1-NEXT: f(int i, <#int j#>, int k)
// CHECK-CC1-NEXT: f(float x, <#float y#>)
- // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:13 %s -o - | FileCheck -check-prefix=CC2 %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:13 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2-NOT: f(N::Y y, int ZZ)
// CHECK-CC2: f(int i, int j, <#int k#>)
}
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:20:16 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
Modified: cfe/branches/Apple/whitney/test/SemaCXX/overload-call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaCXX/overload-call.cpp?rev=118585&r1=118584&r2=118585&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaCXX/overload-call.cpp (original)
+++ cfe/branches/Apple/whitney/test/SemaCXX/overload-call.cpp Tue Nov 9 11:33:12 2010
@@ -503,3 +503,11 @@
g(W());
}
}
+
+namespace PR8013 {
+ void f(int,int);
+ void f(int,int,int);
+ void g() {
+ (&f)(1,2,3);
+ }
+}
More information about the llvm-branch-commits
mailing list