[llvm] r360317 - Bugfix for nullptr check by klocwork
Pengfei Wang via llvm-commits
llvm-commits at lists.llvm.org
Thu May 9 01:09:22 PDT 2019
Author: pengfei
Date: Thu May 9 01:09:21 2019
New Revision: 360317
URL: http://llvm.org/viewvc/llvm-project?rev=360317&view=rev
Log:
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
Modified:
llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp
Modified: llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp?rev=360317&r1=360316&r2=360317&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp Thu May 9 01:09:21 2019
@@ -504,7 +504,8 @@ static void printExtendedName(raw_ostrea
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);
More information about the llvm-commits
mailing list