[cfe-commits] r64653 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaObjCXX/blocks.mm

Douglas Gregor dgregor at apple.com
Mon Feb 16 11:28:42 PST 2009


Author: dgregor
Date: Mon Feb 16 13:28:42 2009
New Revision: 64653

URL: http://llvm.org/viewvc/llvm-project?rev=64653&view=rev
Log:
When inside an Objective-C++ method, name lookup should look into the
interface for ivars before assuming that this is an unresolved
function name.

Fixes <rdar://problem/6590445>.

Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/test/SemaObjCXX/blocks.mm

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=64653&r1=64652&r2=64653&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Feb 16 13:28:42 2009
@@ -565,20 +565,6 @@
   LookupResult Lookup = LookupParsedName(S, SS, Name, LookupOrdinaryName,
                                          false, true, Loc);
 
-  if (getLangOptions().CPlusPlus && (!SS || !SS->isSet()) && 
-      HasTrailingLParen && Lookup.getKind() == LookupResult::NotFound) {
-    // We've seen something of the form
-    //
-    //   identifier(
-    //
-    // and we did not find any entity by the name
-    // "identifier". However, this identifier is still subject to
-    // argument-dependent lookup, so keep track of the name.
-    return Owned(new (Context) UnresolvedFunctionNameExpr(Name,
-                                                          Context.OverloadTy,
-                                                          Loc));
-  }
-
   NamedDecl *D = 0;
   if (Lookup.isAmbiguous()) {
     DiagnoseAmbiguousLookup(Lookup, Name, Loc,
@@ -621,6 +607,21 @@
       return Owned(new (Context) ObjCSuperExpr(Loc, T));
     }
   }
+
+  if (getLangOptions().CPlusPlus && (!SS || !SS->isSet()) && 
+      HasTrailingLParen && D == 0) {
+    // We've seen something of the form
+    //
+    //   identifier(
+    //
+    // and we did not find any entity by the name
+    // "identifier". However, this identifier is still subject to
+    // argument-dependent lookup, so keep track of the name.
+    return Owned(new (Context) UnresolvedFunctionNameExpr(Name,
+                                                          Context.OverloadTy,
+                                                          Loc));
+  }
+
   if (D == 0) {
     // Otherwise, this could be an implicitly declared function reference (legal
     // in C90, extension in C99).

Modified: cfe/trunk/test/SemaObjCXX/blocks.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/blocks.mm?rev=64653&r1=64652&r2=64653&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjCXX/blocks.mm (original)
+++ cfe/trunk/test/SemaObjCXX/blocks.mm Mon Feb 16 13:28:42 2009
@@ -24,3 +24,23 @@
 void foo5(id (^x)(int)) {
   if (x) { }
 }
+
+// <rdar://problem/6590445>
+ at interface Foo {
+    @private
+    void (^_block)(void);
+}
+- (void)bar;
+ at end
+
+namespace N {
+  class X { };      
+  void foo(X);
+}
+
+ at implementation Foo
+- (void)bar {
+    _block();
+    foo(N::X()); // okay
+}
+ at end





More information about the cfe-commits mailing list