[PATCH] D39438: [analyzer] Diagnose stack leaks via block captures

Alexander Shaposhnikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 31 14:34:55 PDT 2017


alexshap added inline comments.


================
Comment at: test/Analysis/stack-async-leak.m:60
+  void (^b)(void) = ^void(void) {
+    *p = 1; 
+  };
----------------
NoQ wrote:
> You may enjoy adding an extra note piece (as in D24278) to the offending statement within the block. It might be helpful if it's not obvious which block is being executed or which pointer points to the leaking variable.
> 
> Also it might be a good idea to think about a visitor that would track the block pointer to highlight where it was initialized with a concrete block code.
> 
> Though probably it's not super useful because we're most likely staying within a single function with this checker.
> 
> By the way, do we warn (or want to warn) on returning a block from a function, when this block captures a local variable?
regarding tracking - yeah, i agree, that would be good, although i would prefer to make progress incrementally and add this part later.

>By the way, do we warn (or want to warn) on returning a block from a function, when this >block captures a local variable?
good question - yeah, now we do 


https://reviews.llvm.org/D39438





More information about the cfe-commits mailing list