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