diff options
author | Anders Carlsson <andersca@mac.com> | 2010-02-27 21:09:00 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-02-27 21:09:00 +0000 |
commit | 0041a649338112e388df64c39d45849ce48dfe3f (patch) | |
tree | 1e4e70aa1307441ac33608dab42f1a3c9206cb0b /test/CodeGenCXX/vtable-layout.cpp | |
parent | d03a3260a27d1d5168e5eb1dbb736747c477dcbb (diff) |
Add a simple construction vtable test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97344 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/vtable-layout.cpp')
-rw-r--r-- | test/CodeGenCXX/vtable-layout.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp index 75d4143d77..58ce44fed7 100644 --- a/test/CodeGenCXX/vtable-layout.cpp +++ b/test/CodeGenCXX/vtable-layout.cpp @@ -833,3 +833,38 @@ class F : virtual D, virtual E { void F::f() { } } + +namespace Test22 { + +// Very simple construction vtable test. +struct V1 { + int v1; +}; + +struct V2 : virtual V1 { + int v2; +}; + +// CHECK: Vtable for 'Test22::C' (8 entries). +// CHECK-NEXT: 0 | vbase_offset (16) +// CHECK-NEXT: 1 | vbase_offset (12) +// CHECK-NEXT: 2 | offset_to_top (0) +// CHECK-NEXT: 3 | Test22::C RTTI +// CHECK-NEXT: -- (Test22::C, 0) vtable address -- +// CHECK-NEXT: 4 | void Test22::C::f() +// CHECK-NEXT: 5 | vbase_offset (-4) +// CHECK-NEXT: 6 | offset_to_top (-16) +// CHECK-NEXT: 7 | Test22::C RTTI + +// CHECK: Construction vtable for ('Test22::V2', 16) in 'Test22::C' (3 entries). +// CHECK-NEXT: 0 | vbase_offset (-4) +// CHECK-NEXT: 1 | offset_to_top (0) +// CHECK-NEXT: 2 | Test22::V2 RTTI + +struct C : virtual V1, virtual V2 { + int c; + virtual void f(); +}; +void C::f() { } + +} |