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