[cfe-commits] r101046 - in /cfe/trunk: include/clang/Parse/Scope.h test/SemaObjC/super.m

Chris Lattner sabre at nondot.org
Mon Apr 12 10:03:29 PDT 2010


Author: lattner
Date: Mon Apr 12 12:03:29 2010
New Revision: 101046

URL: http://llvm.org/viewvc/llvm-project?rev=101046&view=rev
Log:
fix rdar://7852959 - Use of super within a block is actually ok.
(aka, Fariborz was right ;-)


Modified:
    cfe/trunk/include/clang/Parse/Scope.h
    cfe/trunk/test/SemaObjC/super.m

Modified: cfe/trunk/include/clang/Parse/Scope.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Scope.h?rev=101046&r1=101045&r2=101046&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Scope.h (original)
+++ cfe/trunk/include/clang/Parse/Scope.h Mon Apr 12 12:03:29 2010
@@ -246,12 +246,6 @@
       // If this scope is an objc method scope, then we succeed.
       if (S->getFlags() & ObjCMethodScope)
         return true;
-      
-      // If we've scanned up the scope chain and find out that we're in some
-      // other body scope (e.g. a block), we fail even if it is ultimately
-      // contained in an ObjC method body.
-      if (S->getFlags() & FnScope)
-        return false;
     }
     return false;
   }

Modified: cfe/trunk/test/SemaObjC/super.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/super.m?rev=101046&r1=101045&r2=101046&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/super.m (original)
+++ cfe/trunk/test/SemaObjC/super.m Mon Apr 12 12:03:29 2010
@@ -1,4 +1,7 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
+
+void takevoidptr(void*);
+
 
 @interface Foo
 - iMethod;
@@ -7,6 +10,7 @@
 
 @interface A
 + superClassMethod;
+- (void)instanceMethod;
 @end
 
 @interface B : A
@@ -18,6 +22,12 @@
 
 - (void)instanceMethod {
   [super iMethod]; // expected-warning{{'A' may not respond to 'iMethod')}}
+  
+  // Use of super in a block is ok and does codegen to the right thing.
+  // rdar://7852959
+  takevoidptr(^{
+    [super instanceMethod];
+  });
 }
 
 + classMethod {
@@ -71,3 +81,5 @@
   id X[] = { [ super superClassMethod] };
   return 0;
 }
+
+





More information about the cfe-commits mailing list