diff options
author | Seth Cantrell <seth.cantrell@gmail.com> | 2012-04-17 20:06:03 +0000 |
---|---|---|
committer | Seth Cantrell <seth.cantrell@gmail.com> | 2012-04-17 20:06:03 +0000 |
commit | e9a3b76ba589a8a884e978273beaed0d97cf9861 (patch) | |
tree | 8f799617cda9007a9fd144549cff86f5cb769445 /test | |
parent | 54881cb78e2c9054188c002c012b72175429e79b (diff) |
Nicer display of unprintable source, and fix caret display for non-ascii text
Unprintable source in diagnostics is transformed to a printable form and then
displayed with reversed colors if possible. Unprintable characters are
displayed as <U+NNNN> while bytes that do not represent valid characters are
shown as <XX>.
Column adjustments to diagnostic carets, highlighted ranges, and fixups are
made both for characters escaped as above and for characters which are
printable but take up more than a single column.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154946 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Misc/message-length.c | 3 | ||||
-rw-r--r-- | test/Misc/unprintable.c | 16 | ||||
-rw-r--r-- | test/Misc/wrong-encoding.c | 16 |
3 files changed, 33 insertions, 2 deletions
diff --git a/test/Misc/message-length.c b/test/Misc/message-length.c index 3e69b6a206..a6f4f44e6b 100644 --- a/test/Misc/message-length.c +++ b/test/Misc/message-length.c @@ -27,9 +27,8 @@ void a_very_long_line(int *ip, float *FloatPointer) { #pragma STDC CX_LIMITED_RANGE // some long comment text and a brace, eh {} - // CHECK: FILE:23:78 -// CHECK: {{^ ...// some long comment text and a brace, eh {} }} +// CHECK: {{^ ...// some long comment text and a brace, eh {}}} struct A { int x; }; void h(struct A *a) { diff --git a/test/Misc/unprintable.c b/test/Misc/unprintable.c new file mode 100644 index 0000000000..860503e63c --- /dev/null +++ b/test/Misc/unprintable.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 %s 2>&1 | FileCheck -strict-whitespace %s + +int main() { + int i; + if((i==/*👿*/1)); + +// CHECK: {{^ if\(\(i==/\*<U\+1F47F>\*/1\)\);}} + +// CHECK: {{^ ~\^~~~~~~~~~~~~~~~}} +// CHECK: {{^ ~ \^ ~}} + + /* 👿 */ "👿berhund"; + +// CHECK: {{^ /\* <U\+1F47F> \*/ "<U\+1F47F>berhund";}} +// CHECK: {{^ \^~~~~~~~~~~~~~~~~~}} +}
\ No newline at end of file diff --git a/test/Misc/wrong-encoding.c b/test/Misc/wrong-encoding.c new file mode 100644 index 0000000000..bd1cf3dc02 --- /dev/null +++ b/test/Misc/wrong-encoding.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck -strict-whitespace %s + +void foo() { + + "§Ã"; // ø +// CHECK: {{^ "<A7><C3>"; // <F8>}} +// CHECK: {{^ \^}} + + /* þ« */ const char *d = "¥"; + +// CHECK: {{^ /\* <FE><AB> \*/ const char \*d = "<A5>";}} +// CHECK: {{^ \^}} + +// CHECK: {{^ "<A7><C3>"; // <F8>}} +// CHECK: {{^ \^~~~~~~~~~}} +} |