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