From: Chris Lattner Date: Mon, 12 Apr 2010 17:03:29 +0000 (+0000) Subject: fix rdar://7852959 - Use of super within a block is actually ok. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=454006d625f9f5f48cd80096f1afa0f5985ec25e;p=clang fix rdar://7852959 - Use of super within a block is actually ok. (aka, Fariborz was right ;-) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101046 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Parse/Scope.h b/include/clang/Parse/Scope.h index 6d1a93c020..d7a0e3583c 100644 --- a/include/clang/Parse/Scope.h +++ b/include/clang/Parse/Scope.h @@ -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; } diff --git a/test/SemaObjC/super.m b/test/SemaObjC/super.m index 88de77c259..d751d17719 100644 --- a/test/SemaObjC/super.m +++ b/test/SemaObjC/super.m @@ -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 @@ int test3() { id X[] = { [ super superClassMethod] }; return 0; } + +