/* Use the await_ready() call to test if we need to suspend. */
tree ready_cond = TREE_VEC_ELT (awaiter_calls, 0); /* await_ready(). */
+
+ /* We will resume (or continue) at the following index. */
+ tree resume_idx = build_int_cst (short_unsigned_type_node, data->index);
+ tree r = cp_build_init_expr (data->resume_idx, resume_idx);
+ finish_expr_stmt (r);
+
/* Convert to bool, if necessary. */
if (TREE_CODE (TREE_TYPE (ready_cond)) != BOOLEAN_TYPE)
ready_cond = cp_convert (boolean_type_node, ready_cond,
ready_cond = invert_truthvalue_loc (loc, ready_cond);
finish_if_stmt_cond (ready_cond, susp_if);
- tree susp_idx = build_int_cst (short_unsigned_type_node, data->index);
- tree r = cp_build_init_expr (data->resume_idx, susp_idx);
- finish_expr_stmt (r);
-
/* Find out what we have to do with the awaiter's suspend method.
[expr.await]
(5.1) If the result of await-ready is false, the coroutine is considered
tree cont = build_address (data->corocont);
tree final_susp = build_int_cst (integer_type_node, is_final ? 1 : 0);
- susp_idx = build_int_cst (integer_type_node, data->index);
+ resume_idx = build_int_cst (integer_type_node, data->index);
tree sw = begin_switch_stmt ();
r = build_call_expr_internal_loc (loc, IFN_CO_YIELD, integer_type_node, 5,
- susp_idx, final_susp, r_l, d_l,
+ resume_idx, final_susp, r_l, d_l,
data->coro_fp);
finish_switch_cond (r, sw);
finish_case_label (loc, integer_zero_node, NULL_TREE); /* case 0: */