summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/vtable-layout.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-02-16 16:49:35 +0000
committerAnders Carlsson <andersca@mac.com>2010-02-16 16:49:35 +0000
commit69dc04e94872616cebbdd8215d1f5036a8add3f7 (patch)
tree82b0afc55d3716b05c09fd858c0779e5567226c9 /test/CodeGenCXX/vtable-layout.cpp
parent89ad4219e4ed8f025ef2049e7b1ca6af4624d989 (diff)
Handle layout of vtables for virtual bases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96355 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/vtable-layout.cpp')
-rw-r--r--test/CodeGenCXX/vtable-layout.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp
index b714511a38..bb5996707f 100644
--- a/test/CodeGenCXX/vtable-layout.cpp
+++ b/test/CodeGenCXX/vtable-layout.cpp
@@ -395,3 +395,30 @@ struct C : B {
void C::f() { }
}
+
+namespace Test11 {
+
+// Very simple test of vtables for virtual bases.
+struct A1 { int a; };
+struct A2 { int b; };
+
+struct B : A1, virtual A2 {
+ int b;
+};
+
+// CHECK: Vtable for 'Test11::C' (8 entries).
+// CHECK-NEXT: 0 | vbase_offset (24)
+// CHECK-NEXT: 1 | vbase_offset (8)
+// CHECK-NEXT: 2 | offset_to_top (0)
+// CHECK-NEXT: 3 | Test11::C RTTI
+// CHECK-NEXT: -- (Test11::C, 0) vtable address --
+// CHECK-NEXT: 4 | void Test11::C::f()
+// CHECK-NEXT: 5 | vbase_offset (16)
+// CHECK-NEXT: 6 | offset_to_top (-8)
+// CHECK-NEXT: 7 | Test11::C RTTI
+struct C : virtual B {
+ virtual void f();
+};
+void C::f() { }
+
+}