[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
Wed Mar 13 18:41:23 PDT 2019


rjmccall added a comment.

I remember this coming up 7-8 years ago.  I intentionally decided against doing a copy/release when assigning to `__weak` because if the block wasn't already guaranteed to be copied then it was probably better to crash than to silently assign a value that's about to be deallocated.  Note that copying the block we assign into `wb` doesn't change anything about the block stored in `b`.

I don't know why Chromium is building a weak reference to a block in the first place, but assuming they have a good reason to be doing it, they should fix their code to force a copy before forming a weak reference.


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