]> granicus.if.org Git - clang/commitdiff
the scope checker does work with objc methods, add testcase.
authorChris Lattner <sabre@nondot.org>
Sat, 18 Apr 2009 22:37:38 +0000 (22:37 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 18 Apr 2009 22:37:38 +0000 (22:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69487 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/SemaObjC/scope-check.m

index 9cc7c6bf6b7316b24a45fa7f9ac3c374427bff8b..abc508916fff754b2bf257094dc0fd5f48028381 100644 (file)
@@ -2908,11 +2908,6 @@ Sema::DeclPtrTy Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclPtrTy D) {
 
 
 /// TODO: statement expressions, for (int x[n]; ;), case.
-/// TODO: check the body of an objc method.
-
-// TODO: Consider wording like: "branching bypasses declaration of
-// variable-length"
-
 
 /// JumpScopeChecker - This object is used by Sema to diagnose invalid jumps
 /// into VLA and other protected scopes.  For example, this rejects:
index fb9bd4570dda3e79132cf40869b5dfa89f3947b9..6659562bab034c2efa11be13687628de1944cde5 100644 (file)
@@ -44,8 +44,6 @@ L3: ;
   } @catch (C *c) { // expected-note {{jump bypasses initialization of @catch block}}
   L8: ;
   }
-  
-  
 }
 
 void test2(int a) {
@@ -62,3 +60,18 @@ void test3() {
   blargh: ;
   } @catch (...) {}
 }
+
+@interface Greeter
++ (void) hello;
+@end
+
+@implementation Greeter
++ (void) hello {
+
+  @try {
+    goto blargh;     // expected-error {{illegal goto into protected scope}}
+  } @catch (...) {   // expected-note {{jump bypasses initialization of @catch block}}
+  blargh: ;
+  }
+}
+@end