[PATCH] D98688: [-Wcalled-once-parameter] Harden analysis in terms of block use

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 17 23:44:01 PDT 2021


vsavchenko added inline comments.


================
Comment at: clang/test/SemaObjC/warn-called-once.m:861
   // We consider captures by blocks as escapes
-  [self indirect_call:(^{
+  [self indirect_call:(^{ // expected-note{{previous call is here}}
           callback();
----------------
NoQ wrote:
> What would it take to move this note to the `callback();` line? It would be great to do so because blocks are often huge and `^` is often hard to notice.
It will be tricky not to say more.  We will need to store the call after we finish analyzing the block.  The tricky part is that technically it might not have any "calls", but simply escapes.
If one day we track aliases of our parameters (and the capturing block is an alias), then such blocks might be called multiple times on different paths and we'll need to report the call site of the block for sure.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98688/new/

https://reviews.llvm.org/D98688



More information about the cfe-commits mailing list