summaryrefslogtreecommitdiffstats
path: root/clang/test
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
commit804cf51dcf4270182647f7628eb92d81c5940cc2 (patch)
tree06e5caa4b3d1b72f1bdf19145e25b7fe1a768f3b /clang/test
parent96f0b5f844bf1013ed49b49673b2a95af055e194 (diff)
downloadbcm5719-llvm-804cf51dcf4270182647f7628eb92d81c5940cc2.tar.gz
bcm5719-llvm-804cf51dcf4270182647f7628eb92d81c5940cc2.zip
Don't accidentally mark some functions in construction vtables as unused. Also land the test for a previous checkin, now that it's correct.
llvm-svn: 98139
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenCXX/vtable-layout.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/vtable-layout.cpp b/clang/test/CodeGenCXX/vtable-layout.cpp
index a65af6ed33d..de6010ceaf0 100644
--- a/clang/test/CodeGenCXX/vtable-layout.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud