summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/vtable-layout.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-02-28 17:59:36 +0000
committerAnders Carlsson <andersca@mac.com>2010-02-28 17:59:36 +0000
commit293126becf78ef56bfaa446385af8a368eb8d1c2 (patch)
treea872e3e825c5e919730833e1a5be3d418b954f7b /test/CodeGenCXX/vtable-layout.cpp
parentdb7b72a82a6834680ccf1eeb51dc57e6d935c655 (diff)
Add another construction vtable test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97401 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/vtable-layout.cpp')
-rw-r--r--test/CodeGenCXX/vtable-layout.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp
index 335eb1cd49..dce7461e04 100644
--- a/test/CodeGenCXX/vtable-layout.cpp
+++ b/test/CodeGenCXX/vtable-layout.cpp
@@ -921,3 +921,46 @@ struct D : virtual A, virtual B, C {
void D::f() { }
}
+
+namespace Test24 {
+
+// Another construction vtable test.
+
+// CHECK: Vtable for 'Test24::D' (10 entries).
+// CHECK-NEXT: 0 | vbase_offset (0)
+// CHECK-NEXT: 1 | vcall_offset (0)
+// CHECK-NEXT: 2 | offset_to_top (0)
+// CHECK-NEXT: 3 | Test24::D RTTI
+// CHECK-NEXT: -- (Test24::A, 0) vtable address --
+// CHECK-NEXT: -- (Test24::B, 0) vtable address --
+// CHECK-NEXT: -- (Test24::D, 0) vtable address --
+// CHECK-NEXT: 4 | void Test24::D::f()
+// CHECK-NEXT: 5 | vbase_offset (-8)
+// CHECK-NEXT: 6 | vcall_offset (-8)
+// CHECK-NEXT: 7 | offset_to_top (-8)
+// CHECK-NEXT: 8 | Test24::D RTTI
+// CHECK-NEXT: -- (Test24::A, 8) vtable address --
+// CHECK-NEXT: -- (Test24::C, 8) vtable address --
+// CHECK-NEXT: 9 | [unused] void Test24::D::f()
+
+// CHECK: Construction vtable for ('Test24::B', 0) in 'Test24::D' (5 entries).
+// CHECK-NEXT: 0 | vbase_offset (0)
+// CHECK-NEXT: 1 | vcall_offset (0)
+// CHECK-NEXT: 2 | offset_to_top (0)
+// CHECK-NEXT: 3 | Test24::B RTTI
+// CHECK-NEXT: -- (Test24::A, 0) vtable address --
+// CHECK-NEXT: -- (Test24::B, 0) vtable address --
+// CHECK-NEXT: 4 | void Test24::A::f()
+
+struct A {
+ virtual void f();
+};
+
+struct B : virtual A { };
+struct C : virtual A { };
+
+struct D : B, C {
+ virtual void f();
+};
+void D::f() { }
+}