1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
3 // See Test9 for test description.
4 // CHECK: @_ZTTN5Test91BE = linkonce_odr unnamed_addr constant
7 // Check that we don't initialize the vtable pointer in A::~A(), since the destructor body is trivial.
13 // CHECK-LABEL: define{{.*}} void @_ZN5Test11AD2Ev
14 // CHECK-NOT: store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTVN5Test11AE, i64 0, i64 2), ptr
23 // Check that we do initialize the vtable pointer in A::~A() since the destructor body isn't trivial.
29 // CHECK-LABEL: define{{.*}} void @_ZN5Test21AD2Ev
30 // CHECK: store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTVN5Test21AE, i32 0, inrange i32 0, i32 2), ptr
39 // Check that we don't initialize the vtable pointer in A::~A(), since the destructor body is trivial
40 // and Field's destructor body is also trivial.
52 // CHECK-LABEL: define{{.*}} void @_ZN5Test31AD2Ev
53 // CHECK-NOT: store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTVN5Test31AE, i32 0, inrange i32 0, i32 2), ptr
62 // Check that we do initialize the vtable pointer in A::~A(), since Field's destructor body
78 // CHECK-LABEL: define{{.*}} void @_ZN5Test41AD2Ev
79 // CHECK: store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTVN5Test41AE, i32 0, inrange i32 0, i32 2), ptr
88 // Check that we do initialize the vtable pointer in A::~A(), since Field's destructor isn't
89 // available in this translation unit.
102 // CHECK-LABEL: define{{.*}} void @_ZN5Test51AD2Ev
103 // CHECK: store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTVN5Test51AE, i32 0, inrange i32 0, i32 2), ptr
112 // Check that we do initialize the vtable pointer in A::~A(), since Field has a member
113 // variable with a non-trivial destructor body.
115 struct NonTrivialDestructorBody
{
116 ~NonTrivialDestructorBody();
120 NonTrivialDestructorBody nonTrivialDestructorBody
;
130 // CHECK-LABEL: define{{.*}} void @_ZN5Test61AD2Ev
131 // CHECK: store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTVN5Test61AE, i32 0, inrange i32 0, i32 2), ptr
140 // Check that we do initialize the vtable pointer in A::~A(), since Field has a base
141 // class with a non-trivial destructor body.
143 struct NonTrivialDestructorBody
{
144 ~NonTrivialDestructorBody();
147 struct Field
: NonTrivialDestructorBody
{ };
156 // CHECK-LABEL: define{{.*}} void @_ZN5Test71AD2Ev
157 // CHECK: store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTVN5Test71AE, i32 0, inrange i32 0, i32 2), ptr
166 // Check that we do initialize the vtable pointer in A::~A(), since Field has a virtual base
167 // class with a non-trivial destructor body.
169 struct NonTrivialDestructorBody
{
170 ~NonTrivialDestructorBody();
173 struct Field
: virtual NonTrivialDestructorBody
{ };
182 // CHECK-LABEL: define{{.*}} void @_ZN5Test81AD2Ev
183 // CHECK: store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTVN5Test81AE, i32 0, inrange i32 0, i32 2), ptr
192 // Check that we emit a VTT for B, even though we don't initialize the vtable pointer in the destructor.
193 struct A
{ virtual ~A () { } };
194 struct B
: virtual A
{};
195 struct C
: virtual B
{