[PATCH] D89903: [CodeGen] Crash instead of generating broken code with self-capturing __block var

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 21 16:01:30 PDT 2020


rjmccall added a comment.

We do not actually support allocation failure for a lot of things around blocks.  I don't think the copy-helper functions even have a way to propagate out a failure in copying a field.  I have never seen any code in the wild that would handle `Block_copy` returning a null pointer.  Effectively it is assumed to not happen.

It seems somewhat unlikely to me that anyone would actually write code like your example without copying the block and potentially triggering the `__block` variable to be moved to the heap, which is why I think pre-moving the variable might be acceptable.

With all that said, I agree that crashing and/or just not drilling into the variable is not acceptable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89903



More information about the cfe-commits mailing list