HomePhabricator

Reland D80966 [codeview] Put !heapallocsite on calls to operator new

Authored by MaskRay on Jun 7 2020, 1:35 PM.

Description

Reland D80966 [codeview] Put !heapallocsite on calls to operator new

With a change to use CGM.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo
instead of getDebugInfo(),
to fix Profile-<arch> :: instrprof-gcov-multithread_fork.test

See CodeGenModule::CodeGenModule, EmitGcovArcs || EmitGcovNotes can
set clang::CodeGen::CodeGenModule::DebugInfo.


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.

Differential Revision: https://reviews.llvm.org/D80966