[PATCH] D49718: [CodeGen][ObjC] Make block copy/dispose helper function exception-safe.

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 24 11:59:59 PDT 2018


ahatanak updated this revision to Diff 157095.
ahatanak marked 2 inline comments as done.
ahatanak added a comment.

Address review comments.

I think I should be able to merge pushBlockObjectRelease and enterByrefCleanup, but the BlockFieldFlags that are passed are different. We set BLOCK_FIELD_IS_WEAK in addition to BLOCK_FIELD_IS_BYREF when isObjCGCWeak() returns true and we are emitting the copy/dispose helper functions, but when enterByrefCleanup is called from EmitAutoVarCleanups, only BLOCK_FIELD_IS_BYREF is set.

In https://reviews.llvm.org/D49718#1173068, @rjmccall wrote:

> I don't think it makes any difference because we shouldn't be emitting cleanup paths when exceptions are disabled.  I don't think there's an intended difference in semantics between those two destructor-cleanup paths, at least.


OK, I see.

If it doesn't make any difference, I think I can push NormalAndEHCleanup unconditionally when copying a BlockObject capture instead of pushing NormalCleanup when EH is disabled. I made that change in the updated patch.


Repository:
  rC Clang

https://reviews.llvm.org/D49718

Files:
  lib/CodeGen/CGBlocks.cpp
  test/CodeGenObjCXX/arc-blocks.mm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49718.157095.patch
Type: text/x-patch
Size: 17197 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180724/afbbd7a3/attachment-0001.bin>


More information about the cfe-commits mailing list