From: Pengfei Wang Date: Thu, 9 May 2019 08:09:21 +0000 (+0000) Subject: Bugfix for nullptr check by klocwork X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f30ca6ec43f5f87d51f9bfbbc8281432092b24dc;p=llvm 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360317 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/LiveDebugVariables.cpp b/lib/CodeGen/LiveDebugVariables.cpp index 65d30717752..648d3eefc2a 100644 --- a/lib/CodeGen/LiveDebugVariables.cpp +++ b/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);