public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/autopar_devel] coroutines: Remove up some unused values.
@ 2020-08-22 21:45 Giuliano Belinassi
0 siblings, 0 replies; only message in thread
From: Giuliano Belinassi @ 2020-08-22 21:45 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:f2932f44783c5fce37dcf79db0f5434b2aad2c11
commit f2932f44783c5fce37dcf79db0f5434b2aad2c11
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Sun May 31 19:20:43 2020 +0100
coroutines: Remove up some unused values.
The build_new_method_call allows us to inspect the
function decl used. In most cases, this is not used
and we can just set the parm to NULL.
gcc/cp/ChangeLog:
* coroutines.cc (build_co_await): Remove unused
variable.
(finish_co_await_expr): Likewise.
(finish_co_yield_expr): Likewise; revise comment.
Diff:
---
gcc/cp/coroutines.cc | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
index c4df488ac02..f3cf242b4f1 100644
--- a/gcc/cp/coroutines.cc
+++ b/gcc/cp/coroutines.cc
@@ -696,9 +696,8 @@ build_co_await (location_t loc, tree a, suspend_point_kind suspend_kind)
tree o;
if (MAYBE_CLASS_TYPE_P (TREE_TYPE (a)))
{
- tree overload = NULL_TREE;
o = build_new_op (loc, CO_AWAIT_EXPR, LOOKUP_NORMAL, a, NULL_TREE,
- NULL_TREE, &overload, tf_warning_or_error);
+ NULL_TREE, NULL, tf_warning_or_error);
/* If no viable functions are found, o is a. */
if (!o || o == error_mark_node)
o = a;
@@ -873,19 +872,18 @@ finish_co_await_expr (location_t kw, tree expr)
if (at_meth)
{
/* try to build a = p.await_transform (e). */
- tree at_fn = NULL_TREE;
vec<tree, va_gc> *args = make_tree_vector_single (expr);
a = build_new_method_call (get_coroutine_promise_proxy (
current_function_decl),
at_meth, &args, NULL_TREE, LOOKUP_NORMAL,
- &at_fn, tf_warning_or_error);
+ NULL, tf_warning_or_error);
/* As I read the section.
We saw an await_transform method, so it's mandatory that we replace
expr with p.await_transform (expr), therefore if the method call fails
(presumably, we don't have suitable arguments) then this part of the
process fails. */
- if (!at_fn || a == error_mark_node)
+ if (a == error_mark_node)
return error_mark_node;
}
@@ -945,19 +943,19 @@ finish_co_yield_expr (location_t kw, tree expr)
if (!y_meth || y_meth == error_mark_node)
return error_mark_node;
- tree yield_fn = NULL_TREE;
+ /* [expr.yield] / 1
+ Let e be the operand of the yield-expression and p be an lvalue naming
+ the promise object of the enclosing coroutine, then the yield-expression
+ is equivalent to the expression co_await p.yield_value(e).
+ build p.yield_value(e): */
vec<tree, va_gc> *args = make_tree_vector_single (expr);
- tree yield_call = build_new_method_call (
- get_coroutine_promise_proxy (current_function_decl), y_meth, &args,
- NULL_TREE, LOOKUP_NORMAL, &yield_fn, tf_warning_or_error);
-
- if (!yield_fn || yield_call == error_mark_node)
- return error_mark_node;
+ tree yield_call = build_new_method_call
+ (get_coroutine_promise_proxy (current_function_decl), y_meth, &args,
+ NULL_TREE, LOOKUP_NORMAL, NULL, tf_warning_or_error);
- /* So now we have the type of p.yield_value (e).
- Now we want to build co_await p.yield_value (e).
+ /* Now build co_await p.yield_value (e).
Noting that for co_yield, there is no evaluation of any potential
- promise transform_await(). */
+ promise transform_await(), so we call build_co_await directly. */
tree op = build_co_await (kw, yield_call, CO_YIELD_SUSPEND_POINT);
if (op != error_mark_node)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-22 21:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 21:45 [gcc/devel/autopar_devel] coroutines: Remove up some unused values Giuliano Belinassi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).