reject invalid jumps among pieces of @try blocks. This seems to work
reasonably well except for the problem that @catches are nested within
each other in the AST, giving the ugly diagnostics in L8.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69477 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjC/scope-check.m b/test/SemaObjC/scope-check.m
index 7a28ebb..0833a16 100644
--- a/test/SemaObjC/scope-check.m
+++ b/test/SemaObjC/scope-check.m
@@ -6,15 +6,46 @@
goto L; // expected-error{{illegal goto into protected scope}}
goto L2; // expected-error{{illegal goto into protected scope}}
goto L3; // expected-error{{illegal goto into protected scope}}
- @try { // expected-note 3 {{jump bypasses initialization of @try block}}
+ @try { // expected-note {{jump bypasses initialization of @try block}}
L: ;
- } @catch (A *x) {
+ } @catch (A *x) { // expected-note {{jump bypasses initialization of @catch block}}
L2: ;
} @catch (B *x) {
} @catch (C *c) {
- } @finally {
+ } @finally {// expected-note {{jump bypasses initialization of @finally block}}
L3: ;
}
+
+ @try {
+ goto L4; // expected-error{{illegal goto into protected scope}}
+ goto L5; // expected-error{{illegal goto into protected scope}}
+ } @catch (C *c) { // expected-note {{jump bypasses initialization of @catch block}}
+ L5: ;
+ goto L6; // expected-error{{illegal goto into protected scope}}
+ } @catch (B *c) { // expected-note {{jump bypasses initialization of @catch block}}
+ L6: ;
+ } @finally { // expected-note {{jump bypasses initialization of @finally block}}
+ L4: ;
+ }
+
+
+ @try { // expected-note 2 {{jump bypasses initialization of @try block}}
+ L7: ;
+ } @catch (C *c) {
+ goto L7; // expected-error{{illegal goto into protected scope}}
+ } @finally {
+ goto L7; // expected-error{{illegal goto into protected scope}}
+ }
+
+ goto L8; // expected-error{{illegal goto into protected scope}}
+ @try {
+ } @catch (A *c) { // expected-note {{jump bypasses initialization of @catch block}}
+ } @catch (B *c) { // expected-note {{jump bypasses initialization of @catch block}}
+ } @catch (C *c) { // expected-note {{jump bypasses initialization of @catch block}}
+ L8: ;
+ }
+
+
}
void test2(int a) {