[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Driver / wasm64-unknown-unknown.cpp
blob9ee4a1b566d028aff2c77d5d68e8fed72bde64dd
1 // RUN: %clang -target wasm64-unknown-unknown -### %s -emit-llvm-only -c 2>&1 \
2 // RUN: | FileCheck %s -check-prefix=ECHO
3 // RUN: %clang -target wasm64-unknown-unknown %s -emit-llvm -S -o - \
4 // RUN: | FileCheck %s
5 // RUN: %clang -target wasm64-unknown-unknown %s -emit-llvm -S -pthread -o - \
6 // RUN: | FileCheck %s -check-prefix=THREADS
8 // ECHO: {{.*}} "-cc1" {{.*}}wasm64-unknown-unknown.c
10 typedef __builtin_va_list va_list;
11 typedef __SIZE_TYPE__ size_t;
12 typedef __PTRDIFF_TYPE__ ptrdiff_t;
14 extern "C" {
16 // CHECK: @align_c = hidden global i32 1
17 int align_c = __alignof(char);
19 // CHECK: @align_s = hidden global i32 2
20 int align_s = __alignof(short);
22 // CHECK: @align_i = hidden global i32 4
23 int align_i = __alignof(int);
25 // CHECK: @align_l = hidden global i32 8
26 int align_l = __alignof(long);
28 // CHECK: @align_ll = hidden global i32 8
29 int align_ll = __alignof(long long);
31 // CHECK: @align_p = hidden global i32 8
32 int align_p = __alignof(void *);
34 // CHECK: @align_f = hidden global i32 4
35 int align_f = __alignof(float);
37 // CHECK: @align_d = hidden global i32 8
38 int align_d = __alignof(double);
40 // CHECK: @align_ld = hidden global i32 16
41 int align_ld = __alignof(long double);
43 // CHECK: @align_vl = hidden global i32 8
44 int align_vl = __alignof(va_list);
46 // CHECK: _GNU_SOURCEdefined
47 #ifdef _GNU_SOURCE
48 void _GNU_SOURCEdefined() {}
49 #endif
51 // THREADS: _REENTRANTdefined
52 // CHECK: _REENTRANTundefined
53 #ifdef _REENTRANT
54 void _REENTRANTdefined() {}
55 #else
56 void _REENTRANTundefined() {}
57 #endif
59 // Check types
61 // CHECK: signext i8 @check_char()
62 char check_char() { return 0; }
64 // CHECK: signext i16 @check_short()
65 short check_short() { return 0; }
67 // CHECK: i32 @check_int()
68 int check_int() { return 0; }
70 // CHECK: i64 @check_long()
71 long check_long() { return 0; }
73 // CHECK: i64 @check_longlong()
74 long long check_longlong() { return 0; }
76 // CHECK: zeroext i8 @check_uchar()
77 unsigned char check_uchar() { return 0; }
79 // CHECK: zeroext i16 @check_ushort()
80 unsigned short check_ushort() { return 0; }
82 // CHECK: i32 @check_uint()
83 unsigned int check_uint() { return 0; }
85 // CHECK: i64 @check_ulong()
86 unsigned long check_ulong() { return 0; }
88 // CHECK: i64 @check_ulonglong()
89 unsigned long long check_ulonglong() { return 0; }
91 // CHECK: i64 @check_size_t()
92 size_t check_size_t() { return 0; }
94 // CHECK: float @check_float()
95 float check_float() { return 0; }
97 // CHECK: double @check_double()
98 double check_double() { return 0; }
100 // CHECK: fp128 @check_longdouble()
101 long double check_longdouble() { return 0; }
104 template <int>
105 void Switch();
106 template <>
107 void Switch<4>();
108 template <>
109 void Switch<8>();
110 template <>
111 void Switch<16>();
113 void check_pointer_size() {
114 // CHECK: SwitchILi8
115 Switch<sizeof(void *)>();
117 // CHECK: SwitchILi8
118 Switch<sizeof(long long)>();
120 // CHECK: SwitchILi8
121 Switch<sizeof(va_list)>();