================ @@ -173,19 +173,36 @@ static bool ResumeStmtCanThrow(const Stmt *S) { return false; } +static bool AwaitSuspendStmtCanThrow(const Stmt *S) { + return ResumeStmtCanThrow(S); +} + // Emit suspend expression which roughly looks like: // // auto && x = CommonExpr(); // if (!x.await_ready()) { // llvm_coro_save(); -// x.await_suspend(...); (*) +// llvm_coro_await_suspend(&x, frame, wrapper) (*) // llvm_coro_suspend(); (**) // } // x.await_resume(); // // where the result of the entire expression is the result of x.await_resume() // -// (*) If x.await_suspend return type is bool, it allows to veto a suspend: +// (*) llvm_coro_await_suspend_{void, bool, handle} is lowered to +// wrapper(&x, frame) when it's certain not to interfere with +// coroutine transform. await_suspend expression is +// asynchronous to the coroutine body and not all analyses +// and transformations can handle it correctly at the moment. +// +// Wrapper function encapsulates x.await_suspend(...) call and looks like: +// +// auto __await_suspend_wrapper(auto& awaiter, void* frame) { +// std::coroutine_handle<> handle(frame); +// return awaiter.await_suspend(handle); +// } +// +// If x.await_suspend return type is bool, it allows to veto a suspend: ---------------- ChuanqiXu9 wrote:
```suggestion // (**) If x.await_suspend return type is bool, it allows to veto a suspend: ``` https://github.com/llvm/llvm-project/pull/79712 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits