Add the "thunk" attribute to MS ABI virtual member pointers
authorReid Kleckner <reid@kleckner.net>
Wed, 21 Jan 2015 22:18:17 +0000 (22:18 +0000)
committerReid Kleckner <reid@kleckner.net>
Wed, 21 Jan 2015 22:18:17 +0000 (22:18 +0000)
commit9da94483395fa1023a577be19811a250666cd7cd
tree12b6c189f343f127b9b7eec238742016ae257253
parentf9a30ddcc0d3b33ef4bb2eff6f43557974c39e03
Add the "thunk" attribute to MS ABI virtual member pointers

This attribute implies indicates that the function musttail calls
another function and returns whatever it returns. The return type of the
thunk is meaningless, as the thunk can dynamically call different
functions with different return types. So long as the callers bitcast
the thunk with the correct type, behavior is well defined.

This attribute was necessary to fix PR20944, where the indirect call
combiner noticed that the thunk returned void and replaced the results
of the indirect call instruction with undef.

Over-the-shoulder reviewed by David Majnemer.

llvm-svn: 226707
clang/lib/CodeGen/MicrosoftCXXABI.cpp
clang/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp