summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/vtable-layout.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-03-10 06:51:42 +0000
committerAnders Carlsson <andersca@mac.com>2010-03-10 06:51:42 +0000
commit6039661c20eb6345c9d7dc1abd644183ebc91063 (patch)
tree977623e3944ea541737167559eb06f6db82c2c2d /test/CodeGenCXX/vtable-layout.cpp
parentbecb8d5a6ab5103393eac5344ae69bcb860601dd (diff)
Don't accidentally mark some functions in construction vtables as unused. Also land the test for a previous checkin, now that it's correct.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98139 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/vtable-layout.cpp')
-rw-r--r--test/CodeGenCXX/vtable-layout.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp
index a65af6ed33..de6010ceaf 100644
--- a/test/CodeGenCXX/vtable-layout.cpp
+++ b/test/CodeGenCXX/vtable-layout.cpp
@@ -1036,3 +1036,59 @@ struct C : A, virtual V, B {
void C::g() { }
}
+
+namespace Test26 {
+
+// Test that we generate the right number of entries in the C-in-D construction vtable, and that
+// we don't mark A::a as unused.
+
+struct A {
+ virtual void a();
+};
+
+struct B {
+ virtual void c();
+};
+
+struct C : virtual A {
+ virtual void b();
+};
+
+// CHECK: Vtable for 'Test26::D' (15 entries).
+// CHECK-NEXT: 0 | vbase_offset (8)
+// CHECK-NEXT: 1 | vbase_offset (8)
+// CHECK-NEXT: 2 | vbase_offset (0)
+// CHECK-NEXT: 3 | vcall_offset (0)
+// CHECK-NEXT: 4 | offset_to_top (0)
+// CHECK-NEXT: 5 | Test26::D RTTI
+// CHECK-NEXT: -- (Test26::B, 0) vtable address --
+// CHECK-NEXT: -- (Test26::D, 0) vtable address --
+// CHECK-NEXT: 6 | void Test26::B::c()
+// CHECK-NEXT: 7 | void Test26::D::d()
+// CHECK-NEXT: 8 | vcall_offset (0)
+// CHECK-NEXT: 9 | vbase_offset (0)
+// CHECK-NEXT: 10 | vcall_offset (0)
+// CHECK-NEXT: 11 | offset_to_top (-8)
+// CHECK-NEXT: 12 | Test26::D RTTI
+// CHECK-NEXT: -- (Test26::A, 8) vtable address --
+// CHECK-NEXT: -- (Test26::C, 8) vtable address --
+// CHECK-NEXT: 13 | void Test26::A::a()
+// CHECK-NEXT: 14 | void Test26::C::b()
+
+// CHECK: Construction vtable for ('Test26::C', 8) in 'Test26::D' (7 entries).
+// CHECK-NEXT: 0 | vcall_offset (0)
+// CHECK-NEXT: 1 | vbase_offset (0)
+// CHECK-NEXT: 2 | vcall_offset (0)
+// CHECK-NEXT: 3 | offset_to_top (0)
+// CHECK-NEXT: 4 | Test26::C RTTI
+// CHECK-NEXT: -- (Test26::A, 8) vtable address --
+// CHECK-NEXT: -- (Test26::C, 8) vtable address --
+// CHECK-NEXT: 5 | void Test26::A::a()
+// CHECK-NEXT: 6 | void Test26::C::b()
+class D : virtual B, virtual C {
+ virtual void d();
+};
+void D::d() { }
+
+
+} \ No newline at end of file