2012-05-01 14:13:13 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
|
|
|
|
|
|
|
|
struct S {
|
|
|
|
S() {}
|
|
|
|
~S() {}
|
|
|
|
} s;
|
|
|
|
|
2013-02-27 08:06:04 +08:00
|
|
|
// CHECK: define internal void [[INIT_s:@.*global_var.*]] [[NUW:#[0-9]+]]
|
2012-09-25 17:53:18 +08:00
|
|
|
// CHECK: %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc %struct.S* @"\01??0S@@QAE@XZ"
|
2012-05-01 14:13:13 +08:00
|
|
|
// CHECK: call i32 @atexit(void ()* @"__dtor_\01?s@@3US@@A")
|
|
|
|
// CHECK: ret void
|
|
|
|
|
2013-02-27 08:06:04 +08:00
|
|
|
// CHECK: define internal void @"__dtor_\01?s@@3US@@A"() [[NUW]] {
|
2012-07-12 17:50:54 +08:00
|
|
|
// CHECK: call x86_thiscallcc void @"\01??1S@@QAE@XZ"
|
2012-05-01 14:13:13 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
|
|
|
|
// Force WeakODRLinkage by using templates
|
|
|
|
class A {
|
|
|
|
public:
|
|
|
|
A() {}
|
|
|
|
~A() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
class B {
|
|
|
|
public:
|
|
|
|
static A foo;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T> A B<T>::foo;
|
|
|
|
|
|
|
|
void force_usage() {
|
|
|
|
(void)B<int>::foo; // (void) - force usage
|
|
|
|
}
|
|
|
|
|
2013-02-27 08:06:04 +08:00
|
|
|
// CHECK: define internal void [[INIT_foo:@.*global_var.*]] [[NUW]]
|
2012-09-25 17:53:18 +08:00
|
|
|
// CHECK: %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc %class.A* @"\01??0A@@QAE@XZ"
|
2012-05-01 14:13:13 +08:00
|
|
|
// CHECK: call i32 @atexit(void ()* [[FOO_DTOR:@"__dtor_.*foo@.*]])
|
|
|
|
// CHECK: ret void
|
|
|
|
|
2012-09-25 16:00:39 +08:00
|
|
|
// CHECK: define linkonce_odr x86_thiscallcc %class.A* @"\01??0A@@QAE@XZ"
|
2012-05-01 14:13:13 +08:00
|
|
|
|
2012-07-12 17:50:54 +08:00
|
|
|
// CHECK: define linkonce_odr x86_thiscallcc void @"\01??1A@@QAE@XZ"
|
2012-05-01 14:13:13 +08:00
|
|
|
|
|
|
|
// CHECK: define internal void [[FOO_DTOR]]
|
2012-07-12 17:50:54 +08:00
|
|
|
// CHECK: call x86_thiscallcc void @"\01??1A@@QAE@XZ"{{.*}}foo
|
2012-05-01 14:13:13 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
|
2013-02-27 08:06:04 +08:00
|
|
|
// CHECK: define internal void @_GLOBAL__I_a() [[NUW]] {
|
2012-05-01 14:13:13 +08:00
|
|
|
// CHECK: call void [[INIT_s]]
|
|
|
|
// CHECK: call void [[INIT_foo]]
|
|
|
|
// CHECK: ret void
|
2013-02-20 15:22:19 +08:00
|
|
|
|
2013-02-27 08:06:04 +08:00
|
|
|
// CHECK: attributes [[NUW]] = { nounwind }
|