1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fno-use-cxa-atexit -fapple-kext -emit-llvm -o - %s | FileCheck %s
2
3 // CHECK: @_ZN5test01aE = global [[A:%.*]] zeroinitializer
4 // CHECK: @llvm.global_ctors = appending global {{.*}} { i32 65535, void ()* [[CTOR0:@.*]], i8* null }
5 // CHECK: @llvm.global_dtors = appending global {{.*}} { i32 65535, void ()* [[DTOR0:@.*]], i8* null }
6
7 // Check that the base destructor is marked as always_inline when generating
8 // code for kext.
9
10 namespace testBaseDestructor {
11 #pragma clang optimize off
12 struct D {
13 virtual ~D();
14 };
15
~D()16 D::~D() {}
17 #pragma clang optimize on
18 }
19
20 // CHECK: define void @_ZN18testBaseDestructor1DD2Ev({{.*}}) unnamed_addr #[[ATTR0:.*]] align 2 {
21
22 // CHECK: define void @_ZN18testBaseDestructor1DD1Ev({{.*}}) unnamed_addr #[[ATTR1:.*]] align 2 {
23
24 // CHECK: define void @_ZN18testBaseDestructor1DD0Ev({{.*}}) unnamed_addr #[[ATTR1]] align 2 {
25
26 // rdar://11241230
27 namespace test0 {
28 struct A { A(); ~A(); };
29 A a;
30 }
31 // CHECK: define internal void [[CTOR0_:@.*]]()
32 // CHECK: call void @_ZN5test01AC1Ev([[A]]* {{[^,]*}} @_ZN5test01aE)
33 // CHECK-NEXT: ret void
34
35 // CHECK: define internal void [[CTOR0]]()
36 // CHECK: call void [[CTOR0_]]()
37 // CHECK-NEXT: ret void
38
39 // CHECK: define internal void [[DTOR0]]()
40 // CHECK: call void @_ZN5test01AD1Ev([[A]]* @_ZN5test01aE)
41 // CHECK-NEXT: ret void
42
43 // CHECK: attributes #[[ATTR0]] = { alwaysinline nounwind {{.*}} }
44 // CHECK: attributes #[[ATTR1]] = { noinline nounwind {{.*}} }
45