diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-09-08 07:16:20 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-09-08 07:16:20 +0000 |
commit | 639b8d05dd2432f0609774f7963b5780dd5366e1 (patch) | |
tree | de4121f4117db133f5da18d62912166d624fa12e /clang/test/Lexer | |
parent | 3e41a5bb3176c2163f1646f313e91c9674658e77 (diff) | |
download | bcm5719-llvm-639b8d05dd2432f0609774f7963b5780dd5366e1.tar.gz bcm5719-llvm-639b8d05dd2432f0609774f7963b5780dd5366e1.zip |
When a bad UTF-8 encoding or bogus escape sequence is encountered in a
string literal, produce a diagnostic pointing at the erroneous character
range, not at the start of the literal.
llvm-svn: 163459
Diffstat (limited to 'clang/test/Lexer')
-rw-r--r-- | clang/test/Lexer/string-literal-errors.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/Lexer/string-literal-errors.cpp b/clang/test/Lexer/string-literal-errors.cpp new file mode 100644 index 00000000000..be574c2a557 --- /dev/null +++ b/clang/test/Lexer/string-literal-errors.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck -strict-whitespace %s + +void foo() { + (void)"\q \u123z \x \U \U123 \U12345 \u123 \xyzzy \777 \U" + // CHECK: {{^ \(void\)"\\q \\u123z \\x \\U \\U123 \\U12345 \\u123 \\xyzzy \\777 \\U"$}} + // + // (void)"\q \u123z \x \U \U123 \U12345 \u123 \xyzzy \777 \U" + // CHECK: {{^ \^~$}} + // CHECK: {{^ \^~~~~$}} + // CHECK: {{^ \^~$}} + // CHECK: {{^ \^~$}} + // CHECK: {{^ \^~~~~$}} + // CHECK: {{^ \^~~~~~~$}} + // CHECK: {{^ \^~~~~$}} + // CHECK: {{^ \^~$}} + // CHECK: {{^ \^~~~$}} + // CHECK: {{^ \^~$}} + + "123 \x \z"; + // CHECK: {{^ "123 \\x \\z";$}} + // + // "123 \x \z"; + // CHECK: {{^ \^~$}} + // CHECK: {{^ \^~$}} +} |