| 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 |
void bar(int x); |
| 5 |
|
| 6 |
void f(void) { |
| 7 |
@try { } |
| 8 |
@finally { } |
| 9 |
@autoreleasepool { } |
| 10 |
|
| 11 |
// Provide a fixit when we are parsing a standalone statement |
| 12 |
@tr { }; // expected-error {{unexpected '@' in program}} |
| 13 |
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:4-[[@LINE-1]]:6}:"try" |
| 14 |
@finaly { }; // expected-error {{unexpected '@' in program}} |
| 15 |
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:4-[[@LINE-1]]:10}:"finally" |
| 16 |
@autorelpool { }; // expected-error {{unexpected '@' in program}} |
| 17 |
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:4-[[@LINE-1]]:15}:"autoreleasepool" |
| 18 |
|
| 19 |
// Ensure that no fixit is given when parsing expressions |
| 20 |
// CHECK-NOT: fix-it |
| 21 |
id thing = @autoreleasepool { }; // expected-error {{unexpected '@' in program}} |
| 22 |
(void)@tr { }; // expected-error {{unexpected '@' in program}} |
| 23 |
bar(@final { }); // expected-error {{unexpected '@' in program}} |
| 24 |
for(@auto;;) { } // expected-error {{unexpected '@' in program}} |
| 25 |
[@try]; // expected-error {{unexpected '@' in program}} |
| 26 |
} |