blob: 626fc99f15fb0b8d2af7d126a1fa5573e7c4205b [file] [log] [blame]
Fariborz Jahanian64a80342010-05-28 19:40:48 +00001// RUN: %clang_cc1 -emit-llvm -o - %s -fpascal-strings -fshort-wchar | FileCheck %s
Chris Lattner3f59c972010-12-25 23:25:43 +00002// rdar://8020384
3
4#include <stddef.h>
Fariborz Jahanian64a80342010-05-28 19:40:48 +00005
6extern void abort (void);
7
8typedef unsigned short UInt16;
9
10typedef UInt16 UniChar;
11
12int main(int argc, char* argv[])
13{
14
15 char st[] = "\pfoo"; // pascal string
16 UniChar wt[] = L"\pbar"; // pascal Unicode string
17 UniChar wt1[] = L"\p";
18 UniChar wt2[] = L"\pgorf";
19
20 if (st[0] != 3)
21 abort ();
22 if (wt[0] != 3)
23 abort ();
24 if (wt1[0] != 0)
25 abort ();
26 if (wt2[0] != 4)
27 abort ();
28
29 return 0;
30}
31
Eli Friedman64f45a22011-11-01 02:23:42 +000032// CHECK: [i16 3, i16 98, i16 97, i16 114, i16 0]
33// CHECK: [i16 4, i16 103, i16 111, i16 114, i16 102, i16 0]
Chris Lattner3f59c972010-12-25 23:25:43 +000034
35
36// PR8856 - -fshort-wchar makes wchar_t be unsigned.
37// CHECK: @test2
Eli Friedmana40b7f22011-08-12 23:33:52 +000038// CHECK: store volatile i32 1, i32* %isUnsigned
Chris Lattner3f59c972010-12-25 23:25:43 +000039void test2() {
40 volatile int isUnsigned = (wchar_t)-1 > (wchar_t)0;
41}