Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -emit-llvm -o -  %s -fpascal-strings -fshort-wchar  | FileCheck %s
      2 // rdar://8020384
      3 
      4 #include <stddef.h>
      5 
      6 extern void abort (void);
      7 
      8 typedef unsigned short UInt16;
      9 
     10 typedef UInt16 UniChar;
     11 
     12 int 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 
     32 // 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]
     34 
     35 
     36 // PR8856 - -fshort-wchar makes wchar_t be unsigned.
     37 // CHECK: @test2
     38 // CHECK: store volatile i32 1, i32* %isUnsigned
     39 void test2() {
     40   volatile int isUnsigned = (wchar_t)-1 > (wchar_t)0;
     41 }
     42