2017-01-13 06:43:37 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-pc-win32 %s -emit-llvm -fms-compatibility -O2 -disable-llvm-passes -o - | FileCheck %s
|
2012-02-24 06:46:33 +08:00
|
|
|
|
2013-05-20 22:02:37 +08:00
|
|
|
__declspec(selectany) int x1 = 1;
|
|
|
|
const __declspec(selectany) int x2 = 2;
|
2018-02-24 03:30:48 +08:00
|
|
|
// CHECK: @x1 = weak_odr dso_local global i32 1, comdat, align 4
|
|
|
|
// CHECK: @x2 = weak_odr dso_local constant i32 2, comdat, align 4
|
2013-05-20 22:02:37 +08:00
|
|
|
|
2015-04-16 05:50:06 +08:00
|
|
|
// selectany turns extern variable declarations into definitions.
|
2015-04-16 07:04:24 +08:00
|
|
|
__declspec(selectany) int x3;
|
|
|
|
extern __declspec(selectany) int x4;
|
2018-02-24 03:30:48 +08:00
|
|
|
// CHECK: @x3 = weak_odr dso_local global i32 0, comdat, align 4
|
|
|
|
// CHECK: @x4 = weak_odr dso_local global i32 0, comdat, align 4
|
2015-04-16 05:50:06 +08:00
|
|
|
|
2012-06-20 06:09:27 +08:00
|
|
|
struct __declspec(align(16)) S {
|
|
|
|
char x;
|
|
|
|
};
|
|
|
|
union { struct S s; } u;
|
|
|
|
|
|
|
|
// CHECK: @u = {{.*}}zeroinitializer, align 16
|
|
|
|
|
|
|
|
|
2018-02-24 03:30:48 +08:00
|
|
|
// CHECK: define dso_local void @t3() [[NAKED:#[0-9]+]] {
|
2012-02-24 06:46:33 +08:00
|
|
|
__declspec(naked) void t3() {}
|
|
|
|
|
2018-02-24 03:30:48 +08:00
|
|
|
// CHECK: define dso_local void @t22() [[NUW:#[0-9]+]]
|
2012-02-24 06:46:33 +08:00
|
|
|
void __declspec(nothrow) t22();
|
|
|
|
void t22() {}
|
|
|
|
|
2018-02-24 03:30:48 +08:00
|
|
|
// CHECK: define dso_local void @t2() [[NI:#[0-9]+]] {
|
2012-02-24 06:46:33 +08:00
|
|
|
__declspec(noinline) void t2() {}
|
|
|
|
|
2013-02-22 17:10:20 +08:00
|
|
|
// CHECK: call void @f20_t() [[NR:#[0-9]+]]
|
2012-02-24 06:46:33 +08:00
|
|
|
__declspec(noreturn) void f20_t(void);
|
|
|
|
void f20(void) { f20_t(); }
|
2013-02-20 15:22:19 +08:00
|
|
|
|
2015-07-21 06:51:52 +08:00
|
|
|
__declspec(noalias) void noalias_callee(int *x);
|
|
|
|
// CHECK: call void @noalias_callee({{.*}}) [[NA:#[0-9]+]]
|
|
|
|
void noalias_caller(int *x) { noalias_callee(x); }
|
|
|
|
|
2013-02-27 07:08:48 +08:00
|
|
|
// CHECK: attributes [[NAKED]] = { naked noinline nounwind{{.*}} }
|
|
|
|
// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
|
|
|
|
// CHECK: attributes [[NI]] = { noinline nounwind{{.*}} }
|
2013-02-23 05:12:51 +08:00
|
|
|
// CHECK: attributes [[NR]] = { noreturn }
|
2015-11-11 10:13:36 +08:00
|
|
|
// CHECK: attributes [[NA]] = { argmemonly nounwind{{.*}} }
|