[clang] 3b652fc - [analyzer] Fix static code analysis concerns
via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 7 07:58:52 PDT 2022
Author: Soumi Manna
Date: 2022-10-07T16:58:37+02:00
New Revision: 3b652fc6d6447aae91c9e8c35815eed19245757d
URL: https://github.com/llvm/llvm-project/commit/3b652fc6d6447aae91c9e8c35815eed19245757d
DIFF: https://github.com/llvm/llvm-project/commit/3b652fc6d6447aae91c9e8c35815eed19245757d.diff
LOG: [analyzer] Fix static code analysis concerns
ProcessMemberDtor(), ProcessDeleteDtor(), and ProcessAutomaticObjDtor():
Fix static analyzer warnings with suspicious dereference of pointer
'Pred' in function call before NULL checks - NFCI
Differential Revision: https://reviews.llvm.org/D135290
Added:
Modified:
clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
Removed:
################################################################################
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index b1514a5473f5e..f6b6de73796e2 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -1378,10 +1378,10 @@ void ExprEngine::ProcessAutomaticObjDtor(const CFGAutomaticObjDtor Dtor,
"Prepare for object destruction");
PreImplicitCall PP(DtorDecl, varDecl->getLocation(), LCtx, &PT);
Pred = Bldr.generateNode(PP, state, Pred);
- Bldr.takeNodes(Pred);
if (!Pred)
return;
+ Bldr.takeNodes(Pred);
VisitCXXDestructor(varType, Region, Dtor.getTriggerStmt(),
/*IsBase=*/false, Pred, Dst, CallOpts);
@@ -1452,10 +1452,10 @@ void ExprEngine::ProcessDeleteDtor(const CFGDeleteDtor Dtor,
"Prepare for object destruction");
PreImplicitCall PP(getDtorDecl(DTy), DE->getBeginLoc(), LCtx, &PT);
Pred = Bldr.generateNode(PP, State, Pred);
- Bldr.takeNodes(Pred);
if (!Pred)
return;
+ Bldr.takeNodes(Pred);
VisitCXXDestructor(DTy, ArgR, DE, /*IsBase=*/false, Pred, Dst, CallOpts);
}
@@ -1528,10 +1528,10 @@ void ExprEngine::ProcessMemberDtor(const CFGMemberDtor D,
"Prepare for object destruction");
PreImplicitCall PP(DtorDecl, Member->getLocation(), LCtx, &PT);
Pred = Bldr.generateNode(PP, State, Pred);
- Bldr.takeNodes(Pred);
if (!Pred)
return;
+ Bldr.takeNodes(Pred);
VisitCXXDestructor(T, FieldVal.getAsRegion(), CurDtor->getBody(),
/*IsBase=*/false, Pred, Dst, CallOpts);
More information about the cfe-commits
mailing list