-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ObjC] Avoid a @try/@finally/@autoreleasepool fixit when parsing an e…
…xpression This patch ensures that the typo fixit for the @try/@finally/@autoreleasepool {} directive is shown only when we're parsing an actual statement where such directives can actually be present. rdar://19669565 Differential Revision: https://reviews.llvm.org/D26916 llvm-svn: 288334
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.10.0 -verify -fobjc-exceptions %s | ||
// RUN: not %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.10.0 -fdiagnostics-parseable-fixits -fobjc-exceptions %s 2>&1 | FileCheck %s | ||
|
||
// rdar://19669565 | ||
|
||
void bar(int x); | ||
|
||
void f() { | ||
@try { } | ||
@finally { } | ||
@autoreleasepool { } | ||
|
||
// Provide a fixit when we are parsing a standalone statement | ||
@tr { }; // expected-error {{unexpected '@' in program}} | ||
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:4-[[@LINE-1]]:6}:"try" | ||
@finaly { }; // expected-error {{unexpected '@' in program}} | ||
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:4-[[@LINE-1]]:10}:"finally" | ||
@autorelpool { }; // expected-error {{unexpected '@' in program}} | ||
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:4-[[@LINE-1]]:15}:"autoreleasepool" | ||
|
||
// Ensure that no fixit is given when parsing expressions | ||
// CHECK-NOT: fix-it | ||
id thing = @autoreleasepool { }; // expected-error {{unexpected '@' in program}} | ||
(void)@tr { }; // expected-error {{unexpected '@' in program}} | ||
bar(@final { }); // expected-error {{unexpected '@' in program}} | ||
for(@auto;;) { } // expected-error {{unexpected '@' in program}} | ||
[@try]; // expected-error {{unexpected '@' in program}} | ||
} |