summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/vtable-layout.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-02-27 04:12:52 +0000
committerAnders Carlsson <andersca@mac.com>2010-02-27 04:12:52 +0000
commit5560969d73e3e72747972d0f0f37ca4e3b042186 (patch)
tree3eccc6128e01119d1c192652097461ca1822aba6 /test/CodeGenCXX/vtable-layout.cpp
parent08c26752efa51fb5dc47bd3382ea21814bd0c5b8 (diff)
Handle vcall offset sharing between destructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97304 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/vtable-layout.cpp')
-rw-r--r--test/CodeGenCXX/vtable-layout.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp
index abf9d13097..e3a0e8aaac 100644
--- a/test/CodeGenCXX/vtable-layout.cpp
+++ b/test/CodeGenCXX/vtable-layout.cpp
@@ -569,3 +569,43 @@ struct D : A, virtual B, virtual C {
void D::f() { }
}
+
+namespace Test16 {
+
+// Test that destructors share vcall offsets.
+
+struct A { virtual ~A(); };
+struct B { virtual ~B(); };
+
+struct C : A, B { virtual ~C(); };
+
+// CHECK: Vtable for 'Test16::D' (15 entries).
+// CHECK-NEXT: 0 | vbase_offset (8)
+// CHECK-NEXT: 1 | offset_to_top (0)
+// CHECK-NEXT: 2 | Test16::D RTTI
+// CHECK-NEXT: -- (Test16::D, 0) vtable address --
+// CHECK-NEXT: 3 | void Test16::D::f()
+// CHECK-NEXT: 4 | Test16::D::~D() [complete]
+// CHECK-NEXT: 5 | Test16::D::~D() [deleting]
+// CHECK-NEXT: 6 | vcall_offset (-8)
+// CHECK-NEXT: 7 | offset_to_top (-8)
+// CHECK-NEXT: 8 | Test16::D RTTI
+// CHECK-NEXT: -- (Test16::A, 8) vtable address --
+// CHECK-NEXT: -- (Test16::C, 8) vtable address --
+// CHECK-NEXT: 9 | Test16::D::~D() [complete]
+// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
+// CHECK-NEXT: 10 | Test16::D::~D() [deleting]
+// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
+// CHECK-NEXT: 11 | offset_to_top (-16)
+// CHECK-NEXT: 12 | Test16::D RTTI
+// CHECK-NEXT: -- (Test16::B, 16) vtable address --
+// CHECK-NEXT: 13 | Test16::D::~D() [complete]
+// CHECK-NEXT: [this adjustment: -8 non-virtual, -24 vcall offset offset]
+// CHECK-NEXT: 14 | Test16::D::~D() [deleting]
+// CHECK-NEXT: [this adjustment: -8 non-virtual, -24 vcall offset offset]
+struct D : virtual C {
+ virtual void f();
+};
+void D::f() { }
+
+}