This is an archive of the discontinued LLVM Phabricator instance.

Call objc_retainBlock before passing a block as a variadic argument
ClosedPublic

Authored by ahatanak on Dec 12 2019, 12:48 PM.

Details

Summary

Copy the block to the heap before passing it to the callee in case the block escapes in the callee.

rdar://problem/55683462

Diff Detail

Event Timeline

ahatanak created this revision.Dec 12 2019, 12:48 PM

Patch looks good, but could you describe this behavior in the ARC documentation?

ahatanak updated this revision to Diff 233851.Dec 13 2019, 12:38 PM

Explain why this change is needed in ARC documentation.

rjmccall accepted this revision.Dec 13 2019, 12:51 PM
rjmccall added inline comments.
clang/docs/AutomaticReferenceCounting.rst
1866

"to a non-block pointer type (such as `id`)", please. Otherwise looks good. I didn't realize that this conversion behavior wasn't documented at all, so thank you for adding it.

This revision is now accepted and ready to land.Dec 13 2019, 12:51 PM
ahatanak marked an inline comment as done.Dec 13 2019, 12:53 PM
ahatanak added inline comments.
clang/docs/AutomaticReferenceCounting.rst
1866

I thought it was documented too and searched for it, but couldn't find it anywhere in the ARC doc.

This revision was automatically updated to reflect the committed changes.