summaryrefslogtreecommitdiffstats
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
parent3edca1ac1aeab40a3396004f00e3c87049cd204a (diff)
downloadbcm5719-llvm-c05aad05324c334b04b63e45a2faf431a17a9405.tar.gz
bcm5719-llvm-c05aad05324c334b04b63e45a2faf431a17a9405.zip
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
-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 65d30717752..648d3eefc2a 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);
OpenPOWER on IntegriCloud