blob: 88e4a1e4008aa40aa5a30b0c4e22ef584c3b18bb [file] [log] [blame]
Nico Weber59705ae2010-10-09 00:27:47 +00001// RUN: %clang_cc1 -x c++ -emit-llvm -fshort-wchar %s -o - | FileCheck %s
2// Runs in c++ mode so that wchar_t is available.
Nico Webera0f15b02010-10-06 04:57:26 +00003
4int main() {
5 // This should convert to utf8.
Eric Christopher736a9c22011-08-24 00:33:55 +00006 // CHECK: private unnamed_addr constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1
Nico Webera0f15b02010-10-06 04:57:26 +00007 char b[10] = "\u1120\u0220\U00102030";
8
Eli Friedman64f45a22011-11-01 02:23:42 +00009 // CHECK: private unnamed_addr constant [3 x i16] [i16 65, i16 66, i16 0]
Nico Weber59705ae2010-10-09 00:27:47 +000010 const wchar_t *foo = L"AB";
Nico Webera0f15b02010-10-06 04:57:26 +000011
12 // This should convert to utf16.
Eli Friedman64f45a22011-11-01 02:23:42 +000013 // CHECK: private unnamed_addr constant [5 x i16] [i16 4384, i16 544, i16 -9272, i16 -9168, i16 0]
Nico Weber59705ae2010-10-09 00:27:47 +000014 const wchar_t *bar = L"\u1120\u0220\U00102030";
15
16
17
18 // Should pick second character.
19 // CHECK: store i8 98
20 char c = 'ab';
21
22 // CHECK: store i16 97
23 wchar_t wa = L'a';
24
25 // Should pick second character.
26 // CHECK: store i16 98
27 wchar_t wb = L'ab';
28
29 // -4085 == 0xf00b
30 // CHECK: store i16 -4085
31 wchar_t wc = L'\uF00B';
Nico Webera0f15b02010-10-06 04:57:26 +000032}