From: Anders Carlsson Date: Sun, 28 Feb 2010 17:59:36 +0000 (+0000) Subject: Add another construction vtable test. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=293126becf78ef56bfaa446385af8a368eb8d1c2;p=clang Add another construction vtable test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97401 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp index 335eb1cd49..dce7461e04 100644 --- a/test/CodeGenCXX/vtable-layout.cpp +++ b/test/CodeGenCXX/vtable-layout.cpp @@ -921,3 +921,46 @@ struct D : virtual A, virtual B, C { void D::f() { } } + +namespace Test24 { + +// Another construction vtable test. + +// CHECK: Vtable for 'Test24::D' (10 entries). +// CHECK-NEXT: 0 | vbase_offset (0) +// CHECK-NEXT: 1 | vcall_offset (0) +// CHECK-NEXT: 2 | offset_to_top (0) +// CHECK-NEXT: 3 | Test24::D RTTI +// CHECK-NEXT: -- (Test24::A, 0) vtable address -- +// CHECK-NEXT: -- (Test24::B, 0) vtable address -- +// CHECK-NEXT: -- (Test24::D, 0) vtable address -- +// CHECK-NEXT: 4 | void Test24::D::f() +// CHECK-NEXT: 5 | vbase_offset (-8) +// CHECK-NEXT: 6 | vcall_offset (-8) +// CHECK-NEXT: 7 | offset_to_top (-8) +// CHECK-NEXT: 8 | Test24::D RTTI +// CHECK-NEXT: -- (Test24::A, 8) vtable address -- +// CHECK-NEXT: -- (Test24::C, 8) vtable address -- +// CHECK-NEXT: 9 | [unused] void Test24::D::f() + +// CHECK: Construction vtable for ('Test24::B', 0) in 'Test24::D' (5 entries). +// CHECK-NEXT: 0 | vbase_offset (0) +// CHECK-NEXT: 1 | vcall_offset (0) +// CHECK-NEXT: 2 | offset_to_top (0) +// CHECK-NEXT: 3 | Test24::B RTTI +// CHECK-NEXT: -- (Test24::A, 0) vtable address -- +// CHECK-NEXT: -- (Test24::B, 0) vtable address -- +// CHECK-NEXT: 4 | void Test24::A::f() + +struct A { + virtual void f(); +}; + +struct B : virtual A { }; +struct C : virtual A { }; + +struct D : B, C { + virtual void f(); +}; +void D::f() { } +}