[clang] 6a4779c - [NFC] Fix static analyzer concern
Elizabeth Andrews via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 8 13:28:26 PDT 2023
Author: Elizabeth Andrews
Date: 2023-08-08T13:28:15-07:00
New Revision: 6a4779cc235c171f7a5049726f58e14a2cc4e6c8
URL: https://github.com/llvm/llvm-project/commit/6a4779cc235c171f7a5049726f58e14a2cc4e6c8
DIFF: https://github.com/llvm/llvm-project/commit/6a4779cc235c171f7a5049726f58e14a2cc4e6c8.diff
LOG: [NFC] Fix static analyzer concern
Fix static analyzer concern about potential null value
dereference. findBackingIvar() dereferences Prop. PR
checks that Prop exists before calling the function.
Differential Revision: https://reviews.llvm.org/D157429
Added:
Modified:
clang/lib/Analysis/BodyFarm.cpp
Removed:
################################################################################
diff --git a/clang/lib/Analysis/BodyFarm.cpp b/clang/lib/Analysis/BodyFarm.cpp
index b989b8422cfc82..13ec9b65c9f0b2 100644
--- a/clang/lib/Analysis/BodyFarm.cpp
+++ b/clang/lib/Analysis/BodyFarm.cpp
@@ -806,7 +806,7 @@ static Stmt *createObjCPropertyGetter(ASTContext &Ctx,
if (!IVar) {
Prop = MD->findPropertyDecl();
- IVar = findBackingIvar(Prop);
+ IVar = Prop ? findBackingIvar(Prop) : nullptr;
}
if (!IVar || !Prop)
More information about the cfe-commits
mailing list