[PATCH] D86854: [CodeGen] Make sure the EH cleanup for block captures is conditional when the block literal is in a conditional context

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 30 14:15:56 PDT 2020


erik.pilkington created this revision.
erik.pilkington added reviewers: ahatanak, rjmccall.
Herald added subscribers: danielkiss, ributzka, dexonsmith, jkorous.
erik.pilkington requested review of this revision.

Previously, clang was crashing on the attached test because the EH cleanup for the block capture was incorrectly emitted under the assumption that the expression wasn't conditionally evaluated. This was because before D81624 <https://reviews.llvm.org/D81624>, `pushLifetimeExtendedDestroy` was mainly used with C++ automatic lifetime extension (i.e. `const T &x = tmp();`), where a conditionally evaluated expression wasn't possible. Now that we're using this path for block captures, we need to handle this case.

rdar://66250047


https://reviews.llvm.org/D86854

Files:
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGenObjC/arc-blocks-exceptions.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86854.288871.patch
Type: text/x-patch
Size: 6255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200830/f145a92d/attachment.bin>


More information about the cfe-commits mailing list