[PATCH] D131009: [analyzer] Fixing a bug raising false positives of stack block object leaking under ARC

Ziqing Luo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 2 12:20:37 PDT 2022


ziqingluo-90 created this revision.
ziqingluo-90 added reviewers: NoQ, t-rasmud, usama54321, steakhal, vsavchenko, martong, Szelethus.
Herald added subscribers: manas, ASDenysPetrov, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun.
Herald added a project: All.
ziqingluo-90 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

When ARC is enabled, (objective-c) block objects are automatically retained and released thus they do not leak.  
Without ARC, they still can leak from an expiring stack frame like other stack variables.

This patch simply adds the ARC checking condition onto the changes made in https://reviews.llvm.org/D107078 <https://reviews.llvm.org/D107078>.   The checker already checks the same condition for global variables.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131009

Files:
  clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
  clang/test/Analysis/stack-capture-leak-arc.mm
  clang/test/Analysis/stack-capture-leak-no-arc.mm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131009.449371.patch
Type: text/x-patch
Size: 4326 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220802/acd558cb/attachment.bin>


More information about the cfe-commits mailing list