This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by erik.pilkington on Aug 30 2020, 2:15 PM.

Details

Summary

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, 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

Diff Detail