[PATCH] D58514: Avoid needlessly copying blocks that initialize or are assigned to local auto variables to the heap
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 14 13:41:32 PDT 2019
rjmccall added a comment.
In D58514#1429758 <https://reviews.llvm.org/D58514#1429758>, @wuhao5 wrote:
> > Can I ask why you want a weak reference to a block in the first place? It seems basically useless — blocks can certainly appear in reference cycles, but I don't know why you'd ever try to break that cycle with the block instead of somewhere else.
>
> The simplified version:
>
> auto b = ^{
>
> if (check) {
> dispatch_after(queue, 1, b);
> } else {
> // done.
> }
>
> };
> dispatch_after(queue, 1, b);
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.
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