diff options
author | Anders Carlsson <andersca@mac.com> | 2010-02-13 20:11:51 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-02-13 20:11:51 +0000 |
commit | 6a6cbfc55f16e51e8fa4acaffa122b47cfd9e73f (patch) | |
tree | a0d42f4f667a6dae2c398bfa9cd333725a1ecb17 /clang/test | |
parent | 3dc137d8edc25cc9c059d3f87adaa733f936632e (diff) | |
download | bcm5719-llvm-6a6cbfc55f16e51e8fa4acaffa122b47cfd9e73f.tar.gz bcm5719-llvm-6a6cbfc55f16e51e8fa4acaffa122b47cfd9e73f.zip |
More work on covariant return types. We now handle non-virtual adjustments fine.
llvm-svn: 96114
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGenCXX/vtable-layout.cpp | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/clang/test/CodeGenCXX/vtable-layout.cpp b/clang/test/CodeGenCXX/vtable-layout.cpp index b9054410a90..8c839ef6a11 100644 --- a/clang/test/CodeGenCXX/vtable-layout.cpp +++ b/clang/test/CodeGenCXX/vtable-layout.cpp @@ -78,7 +78,7 @@ void A::f() { } // CHECK-NEXT: 1 | Test3::B RTTI // CHECK-NEXT: -- (Test3::A, 0) vtable address -- // CHECK-NEXT: -- (Test3::B, 0) vtable address -- -// CHECK-NEXT: 2 | void Test3::A::f() +// CHECK-NEXT: 2 | void Test3::B::f() // CHECK-NEXT: 3 | void Test3::B::g() struct B : A { virtual void f(); @@ -106,8 +106,8 @@ void C::g() { } // CHECK-NEXT: -- (Test3::A, 0) vtable address -- // CHECK-NEXT: -- (Test3::B, 0) vtable address -- // CHECK-NEXT: -- (Test3::D, 0) vtable address -- -// CHECK-NEXT: 2 | void Test3::A::f() -// CHECK-NEXT: 3 | void Test3::B::g() +// CHECK-NEXT: 2 | void Test3::D::f() +// CHECK-NEXT: 3 | void Test3::D::g() // CHECK-NEXT: 4 | void Test3::D::h() struct D : B { virtual void f(); @@ -118,6 +118,35 @@ struct D : B { void D::f() { } } +namespace Test4 { + +// Test simple non-virtual result adjustments. + +struct R1 { int r1; }; +struct R2 { int r2; }; +struct R3 : R1, R2 { int r3; }; + +struct A { + virtual R2 *f(); +}; + +// CHECK: Vtable for 'Test4::B' (4 entries). +// CHECK-NEXT: 0 | offset_to_top (0) +// CHECK-NEXT: 1 | Test4::B RTTI +// CHECK-NEXT: -- (Test4::A, 0) vtable address -- +// CHECK-NEXT: -- (Test4::B, 0) vtable address -- +// CHECK-NEXT: 2 | Test4::R3 *Test4::B::f() +// CHECK-NEXT: [return adjustment: 4 non-virtual] +// CHECK-NEXT: 3 | Test4::R3 *Test4::B::f() + +struct B : A { + virtual R3 *f(); +}; + +R3 *B::f() { return 0; } + +} + // For now, just verify this doesn't crash. namespace test0 { struct Obj {}; |