]> git.ipfire.org Git - thirdparty/gcc.git/commit
coroutines: Collect the function body rewrite code.
authorIain Sandoe <iain@sandoe.co.uk>
Tue, 30 Jun 2020 06:26:51 +0000 (07:26 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Tue, 30 Jun 2020 07:22:05 +0000 (08:22 +0100)
commit9252a208f485eed2757d601657facfa0aee6cd21
tree88960f669da6a9ea2fe21c4af5a0bb380a155c09
parent3b7272a2f7333905a4cd2caedff27c1fbec95f09
coroutines: Collect the function body rewrite code.

The standard describes a rewrite of the body of the user-authored
function (which wraps it in a try-catch block and provides the
initial and final suspend expressions).  The exact arrangement of
this was still in flux right up until the DIS and as a consequence
was a bit of a moving target.

The net result was a fragmented implementation of the parts of
the rewrite which is now impeding progress in fixing other issues.

This patch collates the rewrite action into a single function and
carries this out earlier.

gcc/cp/ChangeLog:

* coroutines.cc (expand_one_await_expression): Remove
code dealing with initial suspend.
(build_actor_fn): Remove code special-casing initial
and final suspend. Handle the final suspend and marking
of the coroutine as done.
(coro_rewrite_function_body): New.
(bind_expr_find_in_subtree): Remove.
(coro_body_contains_bind_expr_p): Remove.
(morph_fn_to_coro): Split the rewrite of the original
function into coro_rewrite_function_body and call it.
gcc/cp/coroutines.cc