xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/ms-declspecs.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-pc-win32 %s -emit-llvm -fms-compatibility -o - | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc __declspec(selectany) int x1 = 1;
4*f4a2713aSLionel Sambuc const __declspec(selectany) int x2 = 2;
5*f4a2713aSLionel Sambuc // CHECK: @x1 = weak_odr global i32 1, align 4
6*f4a2713aSLionel Sambuc // CHECK: @x2 = weak_odr constant i32 2, align 4
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc struct __declspec(align(16)) S {
9*f4a2713aSLionel Sambuc   char x;
10*f4a2713aSLionel Sambuc };
11*f4a2713aSLionel Sambuc union { struct S s; } u;
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc // CHECK: @u = {{.*}}zeroinitializer, align 16
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc // CHECK: define void @t3() [[NAKED:#[0-9]+]] {
t3()17*f4a2713aSLionel Sambuc __declspec(naked) void t3() {}
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc // CHECK: define void @t22() [[NUW:#[0-9]+]]
20*f4a2713aSLionel Sambuc void __declspec(nothrow) t22();
t22()21*f4a2713aSLionel Sambuc void t22() {}
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc // CHECK: define void @t2() [[NI:#[0-9]+]] {
t2()24*f4a2713aSLionel Sambuc __declspec(noinline) void t2() {}
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc // CHECK: call void @f20_t() [[NR:#[0-9]+]]
27*f4a2713aSLionel Sambuc __declspec(noreturn) void f20_t(void);
f20(void)28*f4a2713aSLionel Sambuc void f20(void) { f20_t(); }
29*f4a2713aSLionel Sambuc 
30*f4a2713aSLionel Sambuc // CHECK: attributes [[NAKED]] = { naked noinline nounwind{{.*}} }
31*f4a2713aSLionel Sambuc // CHECK: attributes [[NUW]] = { nounwind{{.*}} }
32*f4a2713aSLionel Sambuc // CHECK: attributes [[NI]] = { noinline nounwind{{.*}} }
33*f4a2713aSLionel Sambuc // CHECK: attributes [[NR]] = { noreturn }
34