[PATCH] D157429: [NFC] [Clang] Fix static analyzer concern

Elizabeth Andrews via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 8 12:30:44 PDT 2023


eandrews created this revision.
eandrews added reviewers: aaron.ballman, tahonermann.
Herald added subscribers: manas, ASDenysPetrov, dkrupp, donat.nagy, Szelethus, a.sidorin, baloghadamsoftware.
Herald added a reviewer: NoQ.
Herald added a project: All.
eandrews requested review of this revision.

Fix static analyzer concern about potential null value dereference. findBackingIvar() dereferences Prop. PR checks that Prop exists before calling the function.


https://reviews.llvm.org/D157429

Files:
  clang/lib/Analysis/BodyFarm.cpp


Index: clang/lib/Analysis/BodyFarm.cpp
===================================================================
--- clang/lib/Analysis/BodyFarm.cpp
+++ clang/lib/Analysis/BodyFarm.cpp
@@ -806,7 +806,7 @@
 
   if (!IVar) {
     Prop = MD->findPropertyDecl();
-    IVar = findBackingIvar(Prop);
+    IVar = Prop? findBackingIvar(Prop) : nullptr;
   }
 
   if (!IVar || !Prop)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157429.548317.patch
Type: text/x-patch
Size: 369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230808/42b67a8c/attachment.bin>


More information about the cfe-commits mailing list