brintos

brintos / llvm-project-archived public Read only

0
0
Text · 939 B · 1443131 Raw
41 lines · c
1// RUN: %clang_cc1 -emit-llvm -o -  %s -fpascal-strings -fwchar-type=short -fno-signed-wchar | FileCheck %s2 3#include <stddef.h>4 5extern void abort (void);6 7typedef unsigned short UInt16;8 9typedef UInt16 UniChar;10 11int main(int argc, char* argv[])12{13 14        char st[] = "\pfoo";            // pascal string15        UniChar wt[] = L"\pbar";        // pascal Unicode string16	UniChar wt1[] = L"\p";17	UniChar wt2[] = L"\pgorf";18 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 ();27        28        return 0;29}30 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]33 34 35// PR8856 - -fshort-wchar makes wchar_t be unsigned.36// CHECK: @test237// CHECK: store volatile i32 1, ptr %isUnsigned38void test2(void) {39  volatile int isUnsigned = (wchar_t)-1 > (wchar_t)0;40}41