diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/string-literal-short-wstring.c | 14 | ||||
-rw-r--r-- | test/CodeGen/string-literal.c | 11 | ||||
-rw-r--r-- | test/Lexer/c90.c | 4 | ||||
-rw-r--r-- | test/Lexer/wchar.c | 6 |
4 files changed, 34 insertions, 1 deletions
diff --git a/test/CodeGen/string-literal-short-wstring.c b/test/CodeGen/string-literal-short-wstring.c new file mode 100644 index 0000000000..de84953dd3 --- /dev/null +++ b/test/CodeGen/string-literal-short-wstring.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -emit-llvm -fshort-wchar %s -o - | FileCheck %s + +int main() { + // This should convert to utf8. + // CHECK: internal constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1 + char b[10] = "\u1120\u0220\U00102030"; + + // CHECK: private constant [6 x i8] c"A\00B\00\00\00" + void *foo = L"AB"; + + // This should convert to utf16. + // CHECK: private constant [10 x i8] c" \11 \02\C8\DB0\DC\00\00" + void *bar = L"\u1120\u0220\U00102030"; +} diff --git a/test/CodeGen/string-literal.c b/test/CodeGen/string-literal.c index 22a81e7185..457ff6ca7a 100644 --- a/test/CodeGen/string-literal.c +++ b/test/CodeGen/string-literal.c @@ -1,7 +1,16 @@ -// RUN: %clang_cc1 -emit-llvm %s -o - +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s int main() { + // CHECK: internal constant [10 x i8] c"abc\00\00\00\00\00\00\00", align 1 char a[10] = "abc"; + // This should convert to utf8. + // CHECK: internal constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1 + char b[10] = "\u1120\u0220\U00102030"; + + // CHECK: private constant [12 x i8] c"A\00\00\00B\00\00\00\00\00\00\00" void *foo = L"AB"; + + // CHECK: private constant [12 x i8] c"4\12\00\00\0B\F0\10\00\00\00\00\00" + void *bar = L"\u1234\U0010F00B"; } diff --git a/test/Lexer/c90.c b/test/Lexer/c90.c index f191397102..f74135542c 100644 --- a/test/Lexer/c90.c +++ b/test/Lexer/c90.c @@ -27,3 +27,7 @@ void test2() { "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds" "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"; } + +void test3() { + (void)L"\u1234"; // expected-error {{unicode escape sequences are only valid in C99 or C++}} +} diff --git a/test/Lexer/wchar.c b/test/Lexer/wchar.c new file mode 100644 index 0000000000..cbc0c455f8 --- /dev/null +++ b/test/Lexer/wchar.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -fsyntax-only -fshort-wchar -verify %s + +void f() { + (void)L"\U00010000"; // expected-warning {{character unicode escape sequence too long for its type}} +} + |