[PATCH] D58514: Avoid needlessly copying blocks that initialize or are assigned to local auto variables to the heap

Hao Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 19 13:34:07 PDT 2019


wuhao5 added a comment.

In D58514#1435296 <https://reviews.llvm.org/D58514#1435296>, @rjmccall wrote:

> In D58514#1435228 <https://reviews.llvm.org/D58514#1435228>, @wuhao5 wrote:
>
> > > Okay, so really just a block self-reference.  We could really just add a feature for that that would avoid both the complexity and the expense of the self-capture dance.
> >
> > Is there a plan to cover this case? or is it a legitimate use case that Clang should handle?
>
>
> You are currently relying on something that ARC doesn't guarantee, so the client code should be fixed to explicitly copy the block.  I think we would be happy to consider a proposal in the long run to allow blocks to self-reference more easily, which will effectively bypass the problem.


I am not sure if I follow here - is it not that the weak pointer holds a block that's in the stack but is supposed to be in the heap?


Repository:
  rC Clang

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

https://reviews.llvm.org/D58514





More information about the cfe-commits mailing list