[PATCH] D82999: [CodeGen] Check the cleanup flag before destructing lifetime-extended temporaries created in conditional expressions
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 2 23:10:53 PDT 2020
rjmccall added a comment.
In D82999#2129417 <https://reviews.llvm.org/D82999#2129417>, @ahatanak wrote:
> In test case `test13` in clang/test/CodeGenCXX/exceptions.cpp, I think you can turn `invoke void @_ZN6test131AC1Ev` into `call void @_ZN6test131AC1Ev`, no? If the false expression throws, there is nothing to clean up in the false expression and also nothing in the true expression has to be cleaned up.
Yes, this is true. It would be possible to enhance Clang's cleanup stack to support this sort of thing — we'd want to be able to mark a cleanup as "currently known inactive" without potentially popping it off the cleanup stack, and then we could have conditional scopes remember the cleanups that were added, deactivate them this way, and then reactivate them after the merge. Swift's cleanup manager supports something similar.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82999/new/
https://reviews.llvm.org/D82999
More information about the cfe-commits
mailing list