| 1 | // RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.10.0 -verify -fobjc-exceptions %s |
| 2 | // RUN: not %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.10.0 -fdiagnostics-parseable-fixits -fobjc-exceptions %s 2>&1 | FileCheck %s |
| 3 | |
| 4 | // rdar://19669565 |
| 5 | |
| 6 | void bar(int x); |
| 7 | |
| 8 | void f() { |
| 9 | @try { } |
| 10 | @finally { } |
| 11 | @autoreleasepool { } |
| 12 | |
| 13 | // Provide a fixit when we are parsing a standalone statement |
| 14 | @tr { }; // expected-error {{unexpected '@' in program}} |
| 15 | // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:4-[[@LINE-1]]:6}:"try" |
| 16 | @finaly { }; // expected-error {{unexpected '@' in program}} |
| 17 | // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:4-[[@LINE-1]]:10}:"finally" |
| 18 | @autorelpool { }; // expected-error {{unexpected '@' in program}} |
| 19 | // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:4-[[@LINE-1]]:15}:"autoreleasepool" |
| 20 | |
| 21 | // Ensure that no fixit is given when parsing expressions |
| 22 | // CHECK-NOT: fix-it |
| 23 | id thing = @autoreleasepool { }; // expected-error {{unexpected '@' in program}} |
| 24 | (void)@tr { }; // expected-error {{unexpected '@' in program}} |
| 25 | bar(@final { }); // expected-error {{unexpected '@' in program}} |
| 26 | for(@auto;;) { } // expected-error {{unexpected '@' in program}} |
| 27 | [@try]; // expected-error {{unexpected '@' in program}} |
| 28 | } |
| 29 | |