[all-commits] [llvm/llvm-project] b6e143: Reland D80966 [codeview] Put !heapallocsite on cal...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sun Jun 7 13:35:38 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b6e143aa5448bbe29da7b045072e66a31813bced
      https://github.com/llvm/llvm-project/commit/b6e143aa5448bbe29da7b045072e66a31813bced
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-06-07 (Sun, 07 Jun 2020)

  Changed paths:
    M clang/lib/CodeGen/CGCall.cpp
    M clang/lib/CodeGen/CGDebugInfo.cpp
    M clang/lib/CodeGen/CGDebugInfo.h
    M clang/lib/CodeGen/CGExprCXX.cpp
    M clang/lib/CodeGen/CGExprScalar.cpp
    M clang/test/CodeGen/debug-info-codeview-heapallocsite.c
    A clang/test/CodeGenCXX/debug-info-codeview-heapallocsite.cpp

  Log Message:
  -----------
  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




More information about the All-commits mailing list