Benjamin Kramer | af082c3 | 2012-07-12 08:20:49 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck -strict-whitespace %s |
Jordan Rose | bbe0175 | 2012-07-20 18:50:51 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck -check-prefix=CHECK-MACHINE %s |
Benjamin Kramer | af082c3 | 2012-07-12 08:20:49 +0000 | [diff] [blame] | 3 | |
| 4 | struct Foo { |
| 5 | int bar; |
| 6 | }; |
| 7 | |
Jordan Rose | bbe0175 | 2012-07-20 18:50:51 +0000 | [diff] [blame] | 8 | // PR13312 |
Benjamin Kramer | af082c3 | 2012-07-12 08:20:49 +0000 | [diff] [blame] | 9 | void test1() { |
| 10 | struct Foo foo; |
| 11 | (&foo)☃>bar = 42; |
| 12 | // CHECK: error: expected ';' after expression |
| 13 | // Make sure we emit the fixit right in front of the snowman. |
Benjamin Kramer | c7bd9fb | 2012-07-12 08:34:31 +0000 | [diff] [blame] | 14 | // CHECK: {{^ \^}} |
| 15 | // CHECK: {{^ ;}} |
Jordan Rose | bbe0175 | 2012-07-20 18:50:51 +0000 | [diff] [blame] | 16 | |
| 17 | // CHECK-MACHINE: fix-it:"{{.*}}fixit-unicode.c":{11:9-11:9}:";" |
| 18 | } |
| 19 | |
| 20 | |
| 21 | int printf(const char *, ...); |
| 22 | void test2() { |
| 23 | printf("∆: %d", 1L); |
| 24 | // CHECK: warning: format specifies type 'int' but the argument has type 'long' |
| 25 | // Don't crash emitting a fixit after the delta. |
| 26 | // CHECK: printf(" |
| 27 | // CHECK: : %d", 1L); |
| 28 | // Unfortunately, we can't actually check the location of the printed fixit, |
| 29 | // because different systems will render the delta differently (either as a |
| 30 | // character, or as <U+2206>.) The fixit should line up with the %d regardless. |
| 31 | |
| 32 | // CHECK-MACHINE: fix-it:"{{.*}}fixit-unicode.c":{23:16-23:18}:"%ld" |
Benjamin Kramer | af082c3 | 2012-07-12 08:20:49 +0000 | [diff] [blame] | 33 | } |