diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-12 17:03:29 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-12 17:03:29 +0000 |
commit | 454006d625f9f5f48cd80096f1afa0f5985ec25e (patch) | |
tree | 45f968e75b3b2894dca525a44cd973daed0c12c0 | |
parent | 3be17941f1edff4843692066f9d33d438a517612 (diff) |
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
-rw-r--r-- | include/clang/Parse/Scope.h | 6 | ||||
-rw-r--r-- | test/SemaObjC/super.m | 14 |
2 files changed, 13 insertions, 7 deletions
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; } + + |