[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 16 10:39:04 PDT 2022
ziqingluo-90 added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp:313-315
+ // Under ARC, blocks are retained and released automatically:
+ if (isArcManagedBlock(Referred, Ctx))
+ return false;
----------------
NoQ wrote:
> Aha ok, it sounds like we can no longer be sure that the block is on the stack at this point, did I get it right?
>
> In this case I think it's more productive to have the block's memory space be `UnknownSpaceRegion` from the start, so that it fell through the memory space check, both here and at other call sites of `isArcManagedBlock()` (so it can be removed), and in any other code that relies on memory spaces (so this mistake is never made again).
//" ..., did I get it right?"// Yes.
This suggestion makes sense to me. To my understanding, I need to modify the symbolic execution engine to address it. So shall I do it in a new patch?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131009/new/
https://reviews.llvm.org/D131009
More information about the cfe-commits
mailing list