diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-07-20 18:50:51 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-07-20 18:50:51 +0000 |
commit | 9dd82c1d94656932b81146cdf81555347be2486c (patch) | |
tree | e7e007bee56c750ae1e3e92f177b60166bce4948 /clang/test/FixIt/fixit-unicode.c | |
parent | 8c6c8a98b6c407f30fb957c816920f31034743bb (diff) | |
download | bcm5719-llvm-9dd82c1d94656932b81146cdf81555347be2486c.tar.gz bcm5719-llvm-9dd82c1d94656932b81146cdf81555347be2486c.zip |
Re-apply r160319 "Don't crash when emitting fixits following Unicode chars"
This time, make sure we don't try to print fixits with newline characters,
since they don't have a valid column width, and they don't look good anyway.
PR13417 (and originally <rdar://problem/11877454>)
llvm-svn: 160561
Diffstat (limited to 'clang/test/FixIt/fixit-unicode.c')
-rw-r--r-- | clang/test/FixIt/fixit-unicode.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/clang/test/FixIt/fixit-unicode.c b/clang/test/FixIt/fixit-unicode.c index d8e45923362..2af5e08faa4 100644 --- a/clang/test/FixIt/fixit-unicode.c +++ b/clang/test/FixIt/fixit-unicode.c @@ -1,10 +1,11 @@ // RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck -strict-whitespace %s -// PR13312 +// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck -check-prefix=CHECK-MACHINE %s struct Foo { int bar; }; +// PR13312 void test1() { struct Foo foo; (&foo)☃>bar = 42; @@ -12,4 +13,21 @@ void test1() { // Make sure we emit the fixit right in front of the snowman. // CHECK: {{^ \^}} // CHECK: {{^ ;}} + +// CHECK-MACHINE: fix-it:"{{.*}}fixit-unicode.c":{11:9-11:9}:";" +} + + +int printf(const char *, ...); +void test2() { + printf("∆: %d", 1L); +// CHECK: warning: format specifies type 'int' but the argument has type 'long' +// Don't crash emitting a fixit after the delta. +// CHECK: printf(" +// CHECK: : %d", 1L); +// Unfortunately, we can't actually check the location of the printed fixit, +// because different systems will render the delta differently (either as a +// character, or as <U+2206>.) The fixit should line up with the %d regardless. + +// CHECK-MACHINE: fix-it:"{{.*}}fixit-unicode.c":{23:16-23:18}:"%ld" } |