summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-03-10 19:39:11 +0000
committerAnders Carlsson <andersca@mac.com>2010-03-10 19:39:11 +0000
commit115b4756b5c7940c997d571a6db85eaa7ec732ad (patch)
treedcdc69b9b4745c4fd771b0d03820716878e672b5 /clang/test
parent2734ebd37f0a9468789533cf395a3d088f8a151d (diff)
downloadbcm5719-llvm-115b4756b5c7940c997d571a6db85eaa7ec732ad.tar.gz
bcm5719-llvm-115b4756b5c7940c997d571a6db85eaa7ec732ad.zip
We were mistakenly marking morally virtual bases as being uninteresting. Fix this.
llvm-svn: 98180
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenCXX/vtable-layout.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/vtable-layout.cpp b/clang/test/CodeGenCXX/vtable-layout.cpp
index 19619d0f2b8..2e08df9ed91 100644
--- a/clang/test/CodeGenCXX/vtable-layout.cpp
+++ b/clang/test/CodeGenCXX/vtable-layout.cpp
@@ -1150,4 +1150,71 @@ struct E : D {
virtual void e();
};
void E::e() { }
+
+}
+
+namespace Test28 {
+
+// Check that we do include the vtable for B in the D-in-E construction vtable, since
+// B is a base class of a virtual base (C).
+
+struct A {
+ virtual void a();
+};
+
+struct B {
+ virtual void b();
+};
+
+struct C : A, B {
+ virtual void c();
+};
+
+struct D : virtual C {
+};
+
+// CHECK: Vtable for 'Test28::E' (14 entries).
+// CHECK-NEXT: 0 | vbase_offset (8)
+// CHECK-NEXT: 1 | offset_to_top (0)
+// CHECK-NEXT: 2 | Test28::E RTTI
+// CHECK-NEXT: -- (Test28::D, 0) vtable address --
+// CHECK-NEXT: -- (Test28::E, 0) vtable address --
+// CHECK-NEXT: 3 | void Test28::E::e()
+// CHECK-NEXT: 4 | vcall_offset (8)
+// CHECK-NEXT: 5 | vcall_offset (0)
+// CHECK-NEXT: 6 | vcall_offset (0)
+// CHECK-NEXT: 7 | offset_to_top (-8)
+// CHECK-NEXT: 8 | Test28::E RTTI
+// CHECK-NEXT: -- (Test28::A, 8) vtable address --
+// CHECK-NEXT: -- (Test28::C, 8) vtable address --
+// CHECK-NEXT: 9 | void Test28::A::a()
+// CHECK-NEXT: 10 | void Test28::C::c()
+// CHECK-NEXT: 11 | offset_to_top (-16)
+// CHECK-NEXT: 12 | Test28::E RTTI
+// CHECK-NEXT: -- (Test28::B, 16) vtable address --
+// CHECK-NEXT: 13 | void Test28::B::b()
+
+// CHECK: Construction vtable for ('Test28::D', 0) in 'Test28::E' (13 entries).
+// CHECK-NEXT: 0 | vbase_offset (8)
+// CHECK-NEXT: 1 | offset_to_top (0)
+// CHECK-NEXT: 2 | Test28::D RTTI
+// CHECK-NEXT: -- (Test28::D, 0) vtable address --
+// CHECK-NEXT: 3 | vcall_offset (8)
+// CHECK-NEXT: 4 | vcall_offset (0)
+// CHECK-NEXT: 5 | vcall_offset (0)
+// CHECK-NEXT: 6 | offset_to_top (-8)
+// CHECK-NEXT: 7 | Test28::D RTTI
+// CHECK-NEXT: -- (Test28::A, 8) vtable address --
+// CHECK-NEXT: -- (Test28::C, 8) vtable address --
+// CHECK-NEXT: 8 | void Test28::A::a()
+// CHECK-NEXT: 9 | void Test28::C::c()
+// CHECK-NEXT: 10 | offset_to_top (-16)
+// CHECK-NEXT: 11 | Test28::D RTTI
+// CHECK-NEXT: -- (Test28::B, 16) vtable address --
+// CHECK-NEXT: 12 | void Test28::B::b()
+struct E : D {
+ virtual void e();
+};
+void E::e() { }
+
}
OpenPOWER on IntegriCloud