[PATCH] D115219: [C++20] [Coroutines] Mark coroutine done if unhandled_exception throws

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 7 01:03:54 PST 2021


ChuanqiXu added a comment.

In D115219#3175582 <https://reviews.llvm.org/D115219#3175582>, @rjmccall wrote:

> I agree that you shouldn't call `suspend`, but doesn't `coro.end` have the behavior of marking the coroutine done?  Should we just be calling `coro.end` on this path?

@rjmccall great insight! `coro.end` wouldn't marking the coroutine done previously. But its place is perfect to do so. I have added the codes to mark the coroutine as done for `coro.end` in the unwind path. And I have checked the behavior. The exception happened earlier wouldn't run into the path of coro.end exists. So the behavior is satisfying. The only defect might be that the behavior is C++'s semantic. Although, there might be a problem if there is another language also uses switch-resumed ABI one day. I think the current approach is much better at least it has and would generate less code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115219/new/

https://reviews.llvm.org/D115219



More information about the llvm-commits mailing list