brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 2a25c7f Raw
100 lines · plain
1// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -fsyntax-only -verify -fobjc-exceptions -Wno-objc-root-class %s2 3@class A, B, C;4 5void test1(void) {6  goto L; // expected-error{{cannot jump}}7  goto L2; // expected-error{{cannot jump}}8  goto L3; // expected-error{{cannot jump}}9  @try {   // expected-note {{jump bypasses initialization of @try block}}10L: ;11  } @catch (A *x) { // expected-note {{jump bypasses initialization of @catch block}}12L2: ;13  } @catch (B *x) {14  } @catch (C *c) {15  } @finally {// expected-note {{jump bypasses initialization of @finally block}}16L3: ;17  }18 19  @try {20    goto L4; // expected-error{{cannot jump}}21    goto L5; // expected-error{{cannot jump}}22  } @catch (C *c) { // expected-note {{jump bypasses initialization of @catch block}}23  L5: ;24    goto L6; // expected-error{{cannot jump}}25  } @catch (B *c) { // expected-note {{jump bypasses initialization of @catch block}}26  L6: ;27  } @finally { // expected-note {{jump bypasses initialization of @finally block}}28  L4: ;29  }30 31 32  @try { // expected-note 2 {{jump bypasses initialization of @try block}}33  L7: ;34  } @catch (C *c) {35    goto L7; // expected-error{{cannot jump}}36  } @finally {37    goto L7; // expected-error{{cannot jump}}38  }39 40  goto L8;  // expected-error{{cannot jump}}41  @try {42  } @catch (A *c) {43  } @catch (B *c) {44  } @catch (C *c) { // expected-note {{jump bypasses initialization of @catch block}}45  L8: ;46  }47  id X;48  goto L9;    // expected-error{{cannot jump}}49  @synchronized (X)  // expected-note {{jump bypasses initialization of @synchronized block}}50  {51  L9:52    ;53  }54}55 56void test2(int a) {57  if (a) goto L0;58  @try {} @finally {}59 L0:60  return;61}62 63void test3(void) {64  @try {65    goto blargh;66  blargh: ;67  } @catch (...) {}68}69 70@interface Greeter71+ (void) hello;72@end73 74@implementation Greeter75+ (void) hello {76 77  @try {78    goto blargh;     // expected-error {{cannot jump}}79  } @catch (...) {   // expected-note {{jump bypasses initialization of @catch block}}80  blargh: ;81  }82}83 84+ (void)meth2 {85    int n; void *P;86    goto L0;     // expected-error {{cannot jump}}87    typedef int A[n];  // expected-note {{jump bypasses initialization of VLA typedef}}88  L0:89 90    goto L1;      // expected-error {{cannot jump}}91    A b, c[10];        // expected-note 2 {{jump bypasses initialization of variable length array}}92  L1:93    goto L2;     // expected-error {{cannot jump}}94    A d[n];      // expected-note {{jump bypasses initialization of variable length array}}95  L2:96    return;97}98 99@end100