[clang] [ClangIR] Support bool-returning await_suspend (PR #227527)
Aman Maurya via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 12 21:46:28 PDT 2026
================
@@ -662,16 +662,21 @@ emitSuspendExpression(CIRGenFunction &cgf, CGCoroData &coro,
// and coro.suspend here, that should be done as part of lowering this
// to LLVM dialect (or some other MLIR dialect)
- // A invalid suspendRet indicates "void returning await_suspend"
- mlir::Value suspendRet = cgf.emitScalarExpr(s.getSuspendExpr());
-
- // Veto suspension if requested by bool returning await_suspend.
- if (suspendRet) {
- cgf.cgm.errorNYI("Veto await_suspend");
+ if (s.getSuspendReturnType() ==
+ CoroutineSuspendExpr::SuspendReturnType::SuspendBool) {
+ mlir::Value suspendRet = cgf.evaluateExprAsBool(s.getSuspendExpr());
+ // Veto suspension if requested by bool returning await_suspend.
+ builder.createCondition(suspendRet);
----------------
amanmaurya92 wrote:
@bcardosolopes and @Andres-Salamanca I implemented the suggested `cir.coro.suspend_point(%cond)` design
https://github.com/llvm/llvm-project/pull/227527
More information about the cfe-commits
mailing list