[PATCH] D81481: Change debuginfo check for addHeapAllocSiteMetadata

Arthur Eubanks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 9 10:25:28 PDT 2020


aeubanks created this revision.
aeubanks added a reviewer: akhuang.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Move check inside of addHeapAllocSiteMetadata().
Change check to DebugInfo <= DebugLineTablesOnly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81481

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGExprCXX.cpp


Index: clang/lib/CodeGen/CGExprCXX.cpp
===================================================================
--- clang/lib/CodeGen/CGExprCXX.cpp
+++ clang/lib/CodeGen/CGExprCXX.cpp
@@ -1639,8 +1639,7 @@
       EmitNewDeleteCall(*this, allocator, allocatorType, allocatorArgs);
 
     // Set !heapallocsite metadata on the call to operator new.
-    if (CGM.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo &&
-        getDebugInfo())
+    if (getDebugInfo())
       if (auto *newCall = dyn_cast<llvm::CallBase>(RV.getScalarVal()))
         getDebugInfo()->addHeapAllocSiteMetadata(newCall, allocType,
                                                  E->getExprLoc());
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2149,6 +2149,9 @@
 void CGDebugInfo::addHeapAllocSiteMetadata(llvm::CallBase *CI,
                                            QualType AllocatedTy,
                                            SourceLocation Loc) {
+  if (CGM.getCodeGenOpts().getDebugInfo() <=
+      codegenoptions::DebugLineTablesOnly)
+    return;
   llvm::MDNode *node;
   if (AllocatedTy->isVoidType())
     node = llvm::MDNode::get(CGM.getLLVMContext(), None);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81481.269580.patch
Type: text/x-patch
Size: 1303 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200609/2d59e4cc/attachment-0001.bin>


More information about the cfe-commits mailing list