rewrite the goto scope checking code to be more efficient, simpler,
produce better diagnostics, and be more correct in ObjC cases (fixing
rdar://6803963).

An example is that we now diagnose:

int test1(int x) {
  goto L;
  int a[x];
  int b[x];
  L:
  return sizeof a;
}

with:

scope-check.c:15:3: error: illegal goto into protected scope
  goto L;
  ^
scope-check.c:17:7: note: scope created by variable length array
  int b[x];
      ^
scope-check.c:16:7: note: scope created by variable length array
  int a[x];
      ^

instead of just saying "invalid jump".  An ObjC example is:

void test1() {
  goto L;
  @try {
L: ;
  } @finally {
  }
}

t.m:6:3: error: illegal goto into protected scope
  goto L;
  ^
t.m:7:3: note: scope created by @try block
  @try {
  ^

There are a whole ton of fixme's for stuff to do, but I believe that this
is a monotonic improvement over what we had.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69437 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjC/scope-check-try-catch.m b/test/SemaObjC/scope-check-try-catch.m
index d28cc85..fbec254 100644
--- a/test/SemaObjC/scope-check-try-catch.m
+++ b/test/SemaObjC/scope-check-try-catch.m
@@ -2,11 +2,11 @@
 
 @class A, B, C;
 
-void f() {
-  goto L; // expected-error{{illegal jump}}
-  goto L2; // expected-error{{illegal jump}}
-  goto L3; // expected-error{{illegal jump}}
-  @try {
+void test1() {
+  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 {{scope created by @try block}}
 L: ;
   } @catch (A *x) {
 L2: ;
@@ -17,9 +17,17 @@
   }
 }
 
-void f0(int a) {
+void test2(int a) {
   if (a) goto L0;
   @try {} @finally {}
  L0:
   return;
 }
+
+// rdar://6803963
+void test3() {
+  @try {
+    goto blargh;
+  blargh: ;
+  } @catch (...) {}
+}