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

2019-03-19 Thread Hao Wu via Phabricator via cfe-commits
wuhao5 added a comment. In D58514#1435296 , @rjmccall wrote: > In D58514#1435228 , @wuhao5 wrote: > > > > Okay, so really just a block self-reference. We could really just add a > > > feature for that that would

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

2019-03-19 Thread Hao Wu via Phabricator via cfe-commits
wuhao5 added a comment. > 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

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

2019-03-14 Thread Hao Wu via Phabricator via cfe-commits
wuhao5 added a comment. > 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

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

2019-03-14 Thread Hao Wu via Phabricator via cfe-commits
wuhao5 added a comment. > The specified user model of blocks is that they stay on the stack until they > get copied, and there can be multiple such copies. ARC just automates that > process. So the address of a block is not consistent before you've forced a > copy. > > I tend to agree that

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

2019-03-14 Thread Hao Wu via Phabricator via cfe-commits
wuhao5 added a comment. Hey guys, this is Hao, I am working with Chrome team to sort this issue out. In D58514#1428606 , @rjmccall wrote: > I remember this coming up 7-8 years ago. I intentionally decided against > doing a copy/release when assigning