]> granicus.if.org Git - clang/commitdiff
fix rdar://7852959 - Use of super within a block is actually ok.
authorChris Lattner <sabre@nondot.org>
Mon, 12 Apr 2010 17:03:29 +0000 (17:03 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 12 Apr 2010 17:03:29 +0000 (17:03 +0000)
(aka, Fariborz was right ;-)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101046 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/Scope.h
test/SemaObjC/super.m

index 6d1a93c020ad884308bfa78a814efd2e9ef0172e..d7a0e3583ca5bb85fb99751af5987ebb0b649e53 100644 (file)
@@ -246,12 +246,6 @@ public:
       // 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;
   }
index 88de77c259ad1d743150b8780a3f40086f7eb977..d751d1771945732ba75a1b813c0abf3da7254828 100644 (file)
@@ -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
 
 - (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 @@ int test3() {
   id X[] = { [ super superClassMethod] };
   return 0;
 }
+
+