[codeview] Put !heapallocsite on calls to operator new
authorReid Kleckner <rnk@google.com>
Tue, 2 Jun 2020 00:11:06 +0000 (17:11 -0700)
committerReid Kleckner <rnk@google.com>
Fri, 5 Jun 2020 19:52:38 +0000 (12:52 -0700)
commit672ed5386024ba5cee53e19d637b7920a4889837
treeb8f7cfeb513b70128c9c3072a6c741cedccff2a2
parent7e7ec2b32598083eec0c2a54e04e19f1b7c83594
[codeview] Put !heapallocsite on calls to operator new

Clang marks calls to operator new as heap allocation sites, but the
operator declared at global scope returns a void pointer. There is no
explicit cast in the code, so the compiler has to write down the
allocated type itself.

Also generalize a cast to use CallBase, so that we mark heap alloc sites
when exceptions are enabled.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D80966
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/CodeGen/CGDebugInfo.h
clang/lib/CodeGen/CGExprCXX.cpp
clang/lib/CodeGen/CGExprScalar.cpp
clang/test/CodeGen/debug-info-codeview-heapallocsite.c
clang/test/CodeGenCXX/debug-info-codeview-heapallocsite.cpp [new file with mode: 0644]