aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugVariables.cpp
diff options
context:
space:
mode:
authorPengfei Wang <pengfei.wang@intel.com>2019-05-09 08:09:21 +0000
committerPengfei Wang <pengfei.wang@intel.com>2019-05-09 08:09:21 +0000
commitc05aad05324c334b04b63e45a2faf431a17a9405 (patch)
treecf61c0bfcf987ee6d3173d4ac8c15a2828fde4df /llvm/lib/CodeGen/LiveDebugVariables.cpp
parent3edca1ac1aeab40a3396004f00e3c87049cd204a (diff)
downloadllvm-c05aad05324c334b04b63e45a2faf431a17a9405.zip
llvm-c05aad05324c334b04b63e45a2faf431a17a9405.tar.gz
llvm-c05aad05324c334b04b63e45a2faf431a17a9405.tar.bz2
Bugfix for nullptr check by klocwork
Klocwork static check: Pointer from call to function `DebugLoc::operator DILocation *() const ` may be NULL and will be dereference in function `printExtendedName``` Patch by Shengchen Kan (skan) Differential Revision: https://reviews.llvm.org/D61715 llvm-svn: 360317
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugVariables.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugVariables.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp
index 65d3071..648d3ee 100644
--- a/llvm/lib/CodeGen/LiveDebugVariables.cpp
+++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp
@@ -504,7 +504,8 @@ static void printExtendedName(raw_ostream &OS, const DINode *Node,
if (!Res.empty())
OS << Res << "," << Line;
- if (auto *InlinedAt = DL->getInlinedAt()) {
+ auto *InlinedAt = DL ? DL->getInlinedAt() : nullptr;
+ if (InlinedAt) {
if (DebugLoc InlinedAtDL = InlinedAt) {
OS << " @[";
printDebugLoc(InlinedAtDL, OS, Ctx);