• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -x c++ -triple %itanium_abi_triple -emit-llvm -fwchar-type=short -fno-signed-wchar %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=ITANIUM
2 // RUN: %clang_cc1 -x c++ -triple %ms_abi_triple -emit-llvm -fwchar-type=short -fno-signed-wchar %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=MSABI
3 // Runs in c++ mode so that wchar_t is available.
4 
5 // XFAIL: hexagon
6 // Hexagon aligns arrays of size 8+ bytes to a 64-bit boundary, which fails
7 // the first check line with "align 1".
8 
main()9 int main() {
10   // This should convert to utf8.
11   // CHECK: private unnamed_addr constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1
12   char b[10] = "\u1120\u0220\U00102030";
13 
14   // ITANIUM: private unnamed_addr constant [3 x i16] [i16 65, i16 66, i16 0]
15   // MSABI: linkonce_odr dso_local unnamed_addr constant [3 x i16] [i16 65, i16 66, i16 0]
16   const wchar_t *foo = L"AB";
17 
18   // This should convert to utf16.
19   // ITANIUM: private unnamed_addr constant [5 x i16] [i16 4384, i16 544, i16 -9272, i16 -9168, i16 0]
20   // MSABI: linkonce_odr dso_local unnamed_addr constant [5 x i16] [i16 4384, i16 544, i16 -9272, i16 -9168, i16 0]
21   const wchar_t *bar = L"\u1120\u0220\U00102030";
22 
23 
24 
25   // Should pick second character.
26   // CHECK: store i8 98
27   char c = 'ab';
28 
29   // CHECK: store i16 97
30   wchar_t wa = L'a';
31 
32   // Should pick second character.
33   // CHECK: store i16 98
34   wchar_t wb = L'ab';
35 
36   // -4085 == 0xf00b
37   // CHECK: store i16 -4085
38   wchar_t wc = L'\uF00B';
39 }
40