[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / pascal-wchar-string.c
blob144313181f51cf7aef53ef97381a3ca3d94ba3b9
1 // RUN: %clang_cc1 -emit-llvm -o - %s -fpascal-strings -fwchar-type=short -fno-signed-wchar | FileCheck %s
3 #include <stddef.h>
5 extern void abort (void);
7 typedef unsigned short UInt16;
9 typedef UInt16 UniChar;
11 int main(int argc, char* argv[])
14 char st[] = "\pfoo"; // pascal string
15 UniChar wt[] = L"\pbar"; // pascal Unicode string
16 UniChar wt1[] = L"\p";
17 UniChar wt2[] = L"\pgorf";
19 if (st[0] != 3)
20 abort ();
21 if (wt[0] != 3)
22 abort ();
23 if (wt1[0] != 0)
24 abort ();
25 if (wt2[0] != 4)
26 abort ();
28 return 0;
31 // CHECK: [i16 3, i16 98, i16 97, i16 114, i16 0]
32 // CHECK: [i16 4, i16 103, i16 111, i16 114, i16 102, i16 0]
35 // PR8856 - -fshort-wchar makes wchar_t be unsigned.
36 // CHECK: @test2
37 // CHECK: store volatile i32 1, ptr %isUnsigned
38 void test2(void) {
39 volatile int isUnsigned = (wchar_t)-1 > (wchar_t)0;