[PATCH] D28946: [analyzer] Fix memory space for block-captured static locals.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 20 05:22:26 PST 2017


NoQ created this revision.

When a block that is being analyzed as top-level captures static local variables declared in a function (which itself is not being analyzed) surrounding the block, it puts such variables into the unknown memory space, similarly to the stack locals of those functions (that may have been moved to the heap by the time the block starts executing).

However, because blocks don't move such variables to the heap, but capture them by reference instead, we are quite sure that we should put those into the static memspace.

This patch fixes a false positive in MacOSXAPIChecker.


https://reviews.llvm.org/D28946

Files:
  lib/StaticAnalyzer/Core/MemRegion.cpp
  test/Analysis/dispatch-once.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28946.85123.patch
Type: text/x-patch
Size: 4194 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170120/1ad02bcd/attachment.bin>


More information about the cfe-commits mailing list