Home | History | Annotate | Download | only in FixIt
      1 // RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck -strict-whitespace %s
      2 // RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck -check-prefix=CHECK-MACHINE %s
      3 
      4 struct Foo {
      5   int bar;
      6 };
      7 
      8 // PR13312
      9 void test1() {
     10   struct Foo foo;
     11   foo.bar = 42
     12 // CHECK: error: non-ASCII characters are not allowed outside of literals and identifiers
     13 // CHECK: {{^              \^}}
     14 // CHECK: error: expected ';' after expression
     15 // Make sure we emit the fixit right in front of the snowman.
     16 // CHECK: {{^              \^}}
     17 // CHECK: {{^              ;}}
     18 
     19 // CHECK-MACHINE: fix-it:"{{.*}}fixit-unicode.c":{[[@LINE-8]]:15-[[@LINE-8]]:18}:""
     20 // CHECK-MACHINE: fix-it:"{{.*}}fixit-unicode.c":{[[@LINE-9]]:15-[[@LINE-9]]:15}:";"
     21 }
     22 
     23 
     24 int printf(const char *, ...);
     25 void test2() {
     26   printf(": %d", 1L);
     27 // CHECK: warning: format specifies type 'int' but the argument has type 'long'
     28 // Don't crash emitting a fixit after the delta.
     29 // CHECK:  printf("
     30 // CHECK: : %d", 1L);
     31 // Unfortunately, we can't actually check the location of the printed fixit,
     32 // because different systems will render the delta differently (either as a
     33 // character, or as <U+2206>.) The fixit should line up with the %d regardless.
     34 
     35 // CHECK-MACHINE: fix-it:"{{.*}}fixit-unicode.c":{[[@LINE-9]]:16-[[@LINE-9]]:18}:"%ld"
     36 }
     37