[clang] bc38793 - Change debuginfo check for addHeapAllocSiteMetadata
Arthur Eubanks via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 9 11:01:51 PDT 2020
Author: Arthur Eubanks
Date: 2020-06-09T11:01:06-07:00
New Revision: bc38793852c0552337bae54961eb14fb0bacf356
URL: https://github.com/llvm/llvm-project/commit/bc38793852c0552337bae54961eb14fb0bacf356
DIFF: https://github.com/llvm/llvm-project/commit/bc38793852c0552337bae54961eb14fb0bacf356.diff
LOG: Change debuginfo check for addHeapAllocSiteMetadata
Summary:
Move check inside of addHeapAllocSiteMetadata().
Change check to DebugInfo <= DebugLineTablesOnly.
Reviewers: akhuang
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81481
Added:
Modified:
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/CodeGen/CGExprCXX.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 1737154d179a..65d513c8cf05 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2149,6 +2149,9 @@ llvm::DIType *CGDebugInfo::getOrCreateStandaloneType(QualType D,
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);
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index d018443858bd..d59aa6ce0fb9 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -1639,8 +1639,7 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) {
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());
More information about the cfe-commits
mailing list