[CodeGen] Do not push a destructor cleanup for a struct that doesn't
authorAkira Hatanaka <ahatanaka@apple.com>
Wed, 18 Apr 2018 23:33:15 +0000 (23:33 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Wed, 18 Apr 2018 23:33:15 +0000 (23:33 +0000)
commit4ce0e5a892bcd313fa574898903a1034a4a07fc2
tree1505cf1a6576b4f732ffc0778647b6ecb5880e49
parent54a33d7a27516e71b31dc2d0934a40893c53d917
[CodeGen] Do not push a destructor cleanup for a struct that doesn't
have a non-trivial destructor.

This fixes a bug introduced in r328731 where CodeGen emits calls to
synthesized destructors for non-trivial C structs in C++ mode when the
struct passed to EmitCallArg doesn't have a non-trivial destructor.
Under Microsoft's ABI, ASTContext::isParamDestroyedInCallee currently
always returns true, so it's necessary to check whether the struct has a
non-trivial destructor before pushing a cleanup in EmitCallArg.

This fixes PR37146.

llvm-svn: 330304
clang/lib/CodeGen/CGCall.cpp
clang/test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp