diff options
author | Anders Carlsson <andersca@mac.com> | 2010-03-10 19:15:26 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-03-10 19:15:26 +0000 |
commit | f2c98ce9819cb7688a86e308f82ee896694a10e5 (patch) | |
tree | 062a2a01efc6b91bce9f86753f60d9b8702546f5 /test/CodeGenCXX/vtable-layout.cpp | |
parent | 957a2b7b227c3558b18ed5f59ddda1a02aea880e (diff) |
Ignore non-interesting bases when emitting construction vtables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98177 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/vtable-layout.cpp')
-rw-r--r-- | test/CodeGenCXX/vtable-layout.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp index 5c783f1f23..19619d0f2b 100644 --- a/test/CodeGenCXX/vtable-layout.cpp +++ b/test/CodeGenCXX/vtable-layout.cpp @@ -1091,3 +1091,63 @@ class D : virtual B, virtual C { void D::d() { } } + +namespace Test27 { + +// Test that we don't generate a secondary vtable for C in the D-in-E vtable, since +// C doesn't have any virtual bases. + +struct A { + virtual void a(); +}; + +struct B { + virtual void b(); +}; + +struct C { + virtual void c(); +}; + +struct D : A, virtual B, C { + virtual void d(); +}; + +// CHECK: Vtable for 'Test27::E' (13 entries). +// CHECK-NEXT: 0 | vbase_offset (16) +// CHECK-NEXT: 1 | offset_to_top (0) +// CHECK-NEXT: 2 | Test27::E RTTI +// CHECK-NEXT: -- (Test27::A, 0) vtable address -- +// CHECK-NEXT: -- (Test27::D, 0) vtable address -- +// CHECK-NEXT: -- (Test27::E, 0) vtable address -- +// CHECK-NEXT: 3 | void Test27::A::a() +// CHECK-NEXT: 4 | void Test27::D::d() +// CHECK-NEXT: 5 | void Test27::E::e() +// CHECK-NEXT: 6 | offset_to_top (-8) +// CHECK-NEXT: 7 | Test27::E RTTI +// CHECK-NEXT: -- (Test27::C, 8) vtable address -- +// CHECK-NEXT: 8 | void Test27::C::c() +// CHECK-NEXT: 9 | vcall_offset (0) +// CHECK-NEXT: 10 | offset_to_top (-16) +// CHECK-NEXT: 11 | Test27::E RTTI +// CHECK-NEXT: -- (Test27::B, 16) vtable address -- +// CHECK-NEXT: 12 | void Test27::B::b() + +// CHECK: Construction vtable for ('Test27::D', 0) in 'Test27::E' (9 entries). +// CHECK-NEXT: 0 | vbase_offset (16) +// CHECK-NEXT: 1 | offset_to_top (0) +// CHECK-NEXT: 2 | Test27::D RTTI +// CHECK-NEXT: -- (Test27::A, 0) vtable address -- +// CHECK-NEXT: -- (Test27::D, 0) vtable address -- +// CHECK-NEXT: 3 | void Test27::A::a() +// CHECK-NEXT: 4 | void Test27::D::d() +// CHECK-NEXT: 5 | vcall_offset (0) +// CHECK-NEXT: 6 | offset_to_top (-16) +// CHECK-NEXT: 7 | Test27::D RTTI +// CHECK-NEXT: -- (Test27::B, 16) vtable address -- +// CHECK-NEXT: 8 | void Test27::B::b() +struct E : D { + virtual void e(); +}; +void E::e() { } +} |