xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/wchar-const.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o - -triple i386-pc-win32 | FileCheck %s --check-prefix=CHECK-WIN
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-apple-darwin | FileCheck %s --check-prefix=CHECK-DAR
3*f4a2713aSLionel Sambuc // This should pass for any endianness combination of host and target.
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc // This bit is taken from Sema/wchar.c so we can avoid the wchar.h include.
6*f4a2713aSLionel Sambuc typedef __WCHAR_TYPE__ wchar_t;
7*f4a2713aSLionel Sambuc #if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
8*f4a2713aSLionel Sambuc   || defined(_M_X64) || defined(SHORT_WCHAR)
9*f4a2713aSLionel Sambuc   #define WCHAR_T_TYPE unsigned short
10*f4a2713aSLionel Sambuc #elif defined(__sun) || defined(__AuroraUX__)
11*f4a2713aSLionel Sambuc   #define WCHAR_T_TYPE long
12*f4a2713aSLionel Sambuc #else /* Solaris or AuroraUX. */
13*f4a2713aSLionel Sambuc   #define WCHAR_T_TYPE int
14*f4a2713aSLionel Sambuc #endif
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc // CHECK-DAR: private unnamed_addr constant [18 x i32] [i32 84,
18*f4a2713aSLionel Sambuc // CHECK-WIN: private unnamed_addr constant [18 x i16] [i16 84,
19*f4a2713aSLionel Sambuc extern void foo(const wchar_t* p);
20*f4a2713aSLionel Sambuc int main (int argc, const char * argv[])
21*f4a2713aSLionel Sambuc {
22*f4a2713aSLionel Sambuc  foo(L"This is some text");
23*f4a2713aSLionel Sambuc  return 0;
24*f4a2713aSLionel Sambuc }
25