diff options
author | John McCall <rjmccall@apple.com> | 2010-11-09 01:18:05 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-11-09 01:18:05 +0000 |
commit | 478382521e966efd996194cbbce0088fbcf4db5c (patch) | |
tree | 1852d6dd631b67ef2e91ad45039af56b9d43fdd5 /clang/test/CodeGenCXX/thunks.cpp | |
parent | f11ea9ce618c6a0407431c2f88abbc6dc34bbc90 (diff) | |
download | bcm5719-llvm-478382521e966efd996194cbbce0088fbcf4db5c.tar.gz bcm5719-llvm-478382521e966efd996194cbbce0088fbcf4db5c.zip |
When re-using a vtable slot for the nearest overridden method, just because
there's no return adjustment from the overridden to the overrider doesn't
mean there isn't a return adjustment from the overrider to the final
overrider. This matters if we're emitting a virtual this-adjustment thunk
because the overrider virtually inherits from the class providing the
nearest overridden method. Do the appropriate return adjustment in this case.
Fixes PR7611.
llvm-svn: 118466
Diffstat (limited to 'clang/test/CodeGenCXX/thunks.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/thunks.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/thunks.cpp b/clang/test/CodeGenCXX/thunks.cpp index ba60385ab6f..238032cc6de 100644 --- a/clang/test/CodeGenCXX/thunks.cpp +++ b/clang/test/CodeGenCXX/thunks.cpp @@ -260,6 +260,25 @@ namespace Test10 { } } +// PR7611 +namespace Test11 { + struct A { virtual A* f(); }; + struct B : virtual A { virtual A* f(); }; + struct C : B { virtual C* f(); }; + C* C::f() { return 0; } + + // The this-adjustment and return-adjustment thunk required when + // C::f appears in a vtable where A is at a nonzero offset from C. + // CHECK: define {{.*}} @_ZTcv0_n24_v0_n32_N6Test111C1fEv( + + // C::f itself. + // CHECK: define {{.*}} @_ZN6Test111C1fEv( + + // The return-adjustment thunk required when C::f appears in a vtable + // where A is at a zero offset from C. + // CHECK: define {{.*}} @_ZTch0_v0_n32_N6Test111C1fEv( +} + /**** The following has to go at the end of the file ****/ // This is from Test5: |