[MS] Fix 'this' type when calling virtual methods with inalloca
authorReid Kleckner <rnk@google.com>
Wed, 7 Sep 2016 15:15:51 +0000 (15:15 +0000)
committerReid Kleckner <rnk@google.com>
Wed, 7 Sep 2016 15:15:51 +0000 (15:15 +0000)
commit034e7270015f58d689e859085f55687a797d5ba2
treef87eebd13a31832ad27d3c7332f6de388b1ac543
parentbdd576dbb0fe4934c216819645787a563bff0914
[MS] Fix 'this' type when calling virtual methods with inalloca

If the virtual method comes from a secondary vtable, then the type of
the 'this' parameter should be i8*, and not a pointer to the complete
class. In the MS ABI, the 'this' parameter on entry points to the vptr
containing the virtual method that was called, so we use i8* instead of
the normal type. We had a mismatch where the CGFunctionInfo of the call
didn't match the CGFunctionInfo of the declaration, and this resulted in
some assertions, but now both sides agree the type of 'this' is i8*.

Fixes one issue raised in PR30293

llvm-svn: 280815
clang/lib/CodeGen/CGExprCXX.cpp
clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp