tree traits_class
= lookup_template_class (coro_traits_templ, targ,
- /*in_decl=*/ NULL_TREE,
- /*context=*/ NULL_TREE /*std_node*/,
- /*entering scope=*/ false, tf_warning_or_error);
+ /*in_decl=*/NULL_TREE, /*context=*/NULL_TREE,
+ /*entering scope=*/false, tf_warning_or_error);
if (traits_class == error_mark_node || traits_class == NULL_TREE)
{
TREE_VEC_ELT (targ, 0) = promise_type;
tree handle_type
= lookup_template_class (coro_handle_identifier, targ,
- /* in_decl */ NULL_TREE,
- /* context */ std_node,
- /* entering scope */ false, tf_warning_or_error);
+ /* in_decl=*/NULL_TREE,
+ /* context=*/std_node,
+ /* entering scope=*/false, tf_warning_or_error);
if (handle_type == error_mark_node)
{
{
tree promise_type
= lookup_member (traits_class, coro_promise_type_identifier,
- /* protect */ 1, /*want_type=*/true, tf_warning_or_error);
+ /* protect=*/1, /*want_type=*/true, tf_warning_or_error);
if (promise_type)
promise_type
/* This is arranged in order of prohibitions in the std. */
if (DECL_MAIN_P (fndecl))
{
- // [basic.start.main] 3. The function main shall not be a coroutine.
+ /* [basic.start.main] 3. The function main shall not be a coroutine. */
error_at (kw_loc, "%qs cannot be used in the %<main%> function",
kw_name);
return false;
if (DECL_DECLARED_CONSTEXPR_P (fndecl))
{
- // [dcl.constexpr] 3.3 it shall not be a coroutine.
+ /* [dcl.constexpr] 3.3 it shall not be a coroutine. */
error_at (kw_loc, "%qs cannot be used in a %<constexpr%> function",
kw_name);
cp_function_chain->invalid_constexpr = true;
if (FNDECL_USED_AUTO (fndecl))
{
- // [dcl.spec.auto] 15. A function declared with a return type that uses
- // a placeholder type shall not be a coroutine .
+ /* [dcl.spec.auto] 15. A function declared with a return type that uses
+ a placeholder type shall not be a coroutine. */
error_at (kw_loc,
"%qs cannot be used in a function with a deduced return type",
kw_name);
if (varargs_function_p (fndecl))
{
- // [dcl.fct.def.coroutine] The parameter-declaration-clause of the
- // coroutine shall not terminate with an ellipsis that is not part
- // of a parameter-declaration.
+ /* [dcl.fct.def.coroutine] The parameter-declaration-clause of the
+ coroutine shall not terminate with an ellipsis that is not part
+ of a parameter-declaration. */
error_at (kw_loc,
"%qs cannot be used in a varargs function", kw_name);
return false;
if (DECL_CONSTRUCTOR_P (fndecl))
{
- // [class.ctor] 7. a constructor shall not be a coroutine.
+ /* [class.ctor] 7. a constructor shall not be a coroutine. */
error_at (kw_loc, "%qs cannot be used in a constructor", kw_name);
return false;
}
if (DECL_DESTRUCTOR_P (fndecl))
{
- // [class.dtor] 21. a destructor shall not be a coroutine.
+ /* [class.dtor] 21. a destructor shall not be a coroutine. */
error_at (kw_loc, "%qs cannot be used in a destructor", kw_name);
return false;
}
/* To complete the lookups, we need an instance of 'e' which is built from
'o' according to [expr.await] 3.4. However, we don't want to materialize
'e' here (it might need to be placed in the coroutine frame) so we will
- make a temp placeholder instead. */
+ make a temp placeholder instead. */
tree e_proxy = build_lang_decl (VAR_DECL, NULL_TREE, o_type);
/* I suppose we could check that this is contextually convertible to bool. */
tree at_meth
= lookup_promise_method (current_function_decl,
coro_await_transform_identifier, kw,
- /*musthave=*/ false);
+ /*musthave=*/false);
if (at_meth == error_mark_node)
return error_mark_node;
call for p.yield_value(e). */
tree y_meth = lookup_promise_method (current_function_decl,
coro_yield_value_identifier, kw,
- /*musthave=*/ true);
+ /*musthave=*/true);
if (!y_meth || y_meth == error_mark_node)
return error_mark_node;
tree crv_meth
= lookup_promise_method (current_function_decl,
coro_return_void_identifier, kw,
- /*musthave=*/ true);
+ /*musthave=*/true);
if (!crv_meth || crv_meth == error_mark_node)
return error_mark_node;
tree crv_meth
= lookup_promise_method (current_function_decl,
coro_return_value_identifier, kw,
- /*musthave=*/ true);
+ /*musthave=*/true);
if (!crv_meth || crv_meth == error_mark_node)
return error_mark_node;
/* Implement the suspend, a scope exit without clean ups. */
r = build_call_expr_internal_loc (loc, IFN_CO_SUSPN, void_type_node, 1, susp);
r = coro_build_cvt_void_expr_stmt (r, loc);
- add_stmt (r); // goto ret;
+ add_stmt (r); /* goto ret; */
r = build_case_label (build_int_cst (integer_type_node, 1), NULL_TREE,
create_anon_label_with_ctx (loc, actor));
- add_stmt (r); // case 1:
+ add_stmt (r); /* case 1: */
r = build1_loc (loc, GOTO_EXPR, void_type_node, resume_label);
- add_stmt (r); // goto resume;
+ add_stmt (r); /* goto resume; */
r = build_case_label (NULL_TREE, NULL_TREE,
create_anon_label_with_ctx (loc, actor));
- add_stmt (r); // default:;
+ add_stmt (r); /* default:; */
r = build1_loc (loc, GOTO_EXPR, void_type_node, destroy_label);
- add_stmt (r); // goto destroy;
+ add_stmt (r); /* goto destroy; */
/* part of finish switch. */
SWITCH_STMT_BODY (sw) = pop_stmt_list (SWITCH_STMT_BODY (sw));
in : CO_AWAIT_EXPR (a, e_proxy, o, awr_call_vector, mode)
We no longer need a [it had diagnostic value, maybe?]
We need to replace the promise proxy in all elements
- We need to replace the e_proxy in the awr_call.
- */
+ We need to replace the e_proxy in the awr_call. */
tree coro_frame_type = TREE_TYPE (xform->actor_frame);
tree ah = NULL_TREE;
{
tree ah_m
= lookup_member (coro_frame_type, si->susp_handle_id,
- /*protect*/ 1, /*want_type*/ 0, tf_warning_or_error);
+ /*protect=*/1, /*want_type=*/0, tf_warning_or_error);
ah = build_class_member_access_expr (xform->actor_frame, ah_m, NULL_TREE,
true, tf_warning_or_error);
}
/* Get a reference to the initial suspend var in the frame. */
tree as_m
= lookup_member (coro_frame_type, si->await_field_id,
- /*protect*/ 1, /*want_type*/ 0, tf_warning_or_error);
+ /*protect=*/1, /*want_type=*/0, tf_warning_or_error);
tree as = build_class_member_access_expr (xform->actor_frame, as_m, NULL_TREE,
true, tf_warning_or_error);
tree fld_ref
= lookup_member (lvd->coro_frame_type, local_var.field_id,
- /*protect*/ 1, /*want_type*/ 0,
+ /*protect=*/1, /*want_type=*/0,
tf_warning_or_error);
tree fld_idx = build3_loc (lvd->loc, COMPONENT_REF, TREE_TYPE (lvar),
lvd->actor_frame, fld_ref, NULL_TREE);
if (local_var.field_id == NULL_TREE)
pvar = &DECL_CHAIN (*pvar); /* Wasn't used. */
- *pvar = DECL_CHAIN (*pvar); // discard this one, we replaced it.
+ *pvar = DECL_CHAIN (*pvar); /* discard this one, we replaced it. */
}
*do_subtree = 0; /* We've done the body already. */
/* We will discard this, since it's connected to the original scope
nest. */
tree block = BIND_EXPR_BLOCK (first);
- if (block) // For this to be missing is probably a bug.
+ if (block) /* For this to be missing is probably a bug. */
{
gcc_assert (BLOCK_SUPERCONTEXT (block) == NULL_TREE);
gcc_assert (BLOCK_CHAIN (block) == NULL_TREE);
if (parm.field_id == NULL_TREE)
continue; /* Wasn't used. */
tree fld_ref = lookup_member (coro_frame_type, parm.field_id,
- /*protect*/ 1, /*want_type*/ 0,
+ /*protect=*/1, /*want_type=*/0,
tf_warning_or_error);
tree fld_idx = build3_loc (loc, COMPONENT_REF, TREE_TYPE (arg),
actor_frame, fld_ref, NULL_TREE);
tree return_void = NULL_TREE;
tree rvm
= lookup_promise_method (orig, coro_return_void_identifier, loc,
- /*musthave=*/ false);
+ /*musthave=*/false);
if (rvm && rvm != error_mark_node)
return_void
= build_new_method_call (ap, rvm, NULL, NULL_TREE, LOOKUP_NORMAL, NULL,
branch to the final resume, and fall through to the destroy. */
tree resume_m
= lookup_member (coro_frame_type, get_identifier ("__resume"),
- /*protect*/ 1, /*want_type*/ 0, tf_warning_or_error);
+ /*protect=*/1, /*want_type=*/0, tf_warning_or_error);
tree res_x = build_class_member_access_expr (actor_frame, resume_m, NULL_TREE,
false, tf_warning_or_error);
r = build1 (CONVERT_EXPR, act_des_fn_ptr, integer_zero_node);
/* We need the resume index to work with. */
tree res_idx_m
= lookup_member (coro_frame_type, resume_idx_name,
- /*protect*/ 1, /*want_type*/ 0, tf_warning_or_error);
+ /*protect=*/1, /*want_type=*/0, tf_warning_or_error);
tree res_idx
= build_class_member_access_expr (actor_frame, res_idx_m, NULL_TREE, false,
tf_warning_or_error);
tree suspend_alt = is_final ? coro_final_suspend_identifier
: coro_initial_suspend_identifier;
tree setup_meth = lookup_promise_method (current_function_decl, suspend_alt,
- loc, /*musthave=*/ true);
+ loc, /*musthave=*/true);
if (!setup_meth || setup_meth == error_mark_node)
return error_mark_node;
await-suspend.resume() is evaluated.
(5.1.2) if the type of await-suspend is bool, await-suspend is evaluated,
and the coroutine is resumed if the result is false.
- (5.1.3) Otherwise, await-suspend is evaluated.
- */
+ (5.1.3) Otherwise, await-suspend is evaluated. */
+
tree susp_typ = get_await_suspend_return_type (aw_expr);
tree handle_field_nam;
if (VOID_TYPE_P (susp_typ) || TREE_CODE (susp_typ) == BOOLEAN_TYPE)
/* When register_awaits sees an await, it walks the initializer for
that await looking for temporaries captured by reference and notes
- them in awpts->captured_temps. We only need to take any action
- here if the statement contained any awaits, and any of those had
- temporaries captured by reference in the initializers for their class.
- */
+ them in awpts->captured_temps. We only need to take any action here
+ if the statement contained any awaits, and any of those had temporaries
+ captured by reference in the initializers for their class. */
tree res = cp_walk_tree (stmt, register_awaits, d, &visited);
if (!res && awpts->saw_awaits > 0 && !awpts->captured_temps.is_empty ())
/* As we enter a bind expression - record the vars there and then recurse.
As we exit drop the nest depth.
The bind index is a growing count of how many bind indices we've seen.
- We build a space in the frame for each local var.
- */
+ We build a space in the frame for each local var. */
+
if (TREE_CODE (*stmt) == BIND_EXPR)
{
lvd->bind_indx++;
}
else
{
- namsize += 10; // 'D' followed by an unsigned.
+ namsize += 10; /* 'D' followed by an unsigned. */
buf = (char *) alloca (namsize);
snprintf (buf, namsize, "__%s.%u.%u.D%u", nm, lvd->bind_indx,
lvd->nest_depth, DECL_UID (lvar));
void (*__resume)(_R_frame *);
void (*__destroy)(_R_frame *);
coro1::promise_type __p;
- bool frame_needs_free; // free the coro frame mem if set.
- short __resume_at; // this is where clang puts it - but it's a smaller entity.
+ bool frame_needs_free; free the coro frame mem if set.
+ short __resume_at;
coro1::suspend_never_prt __is;
(maybe) handle_type i_hand;
coro1::suspend_always_prt __fs;
If we encounter a fatal error we might return a now-empty body.
TODO: determine if it would help to restore the original.
determine if looking for more errors in coro_function_valid_p()
- and stashing types is a better solution.
- */
+ and stashing types is a better solution. */
tree newbody = push_stmt_list ();
DECL_SAVED_TREE (orig) = newbody;
2. Otherwise, we call new and the ramp is expected to terminate with an
unhandled exception in the case of failure to allocate.
- The get_return_object_on_allocation_failure() must be a static method.
- */
+ The get_return_object_on_allocation_failure() must be a static method. */
+
tree grooaf_meth
= lookup_promise_method (orig, coro_gro_on_allocation_fail_identifier,
- fn_start, /*musthave=*/ false);
+ fn_start, /*musthave=*/false);
/* The CO_FRAME internal function is a mechanism to allow the middle end
to adjust the allocation in response to optimisations. We provide the
TREE_USED (fn) = 1;
}
tree nth_ns = lookup_qualified_name (std_node, get_identifier ("nothrow"),
- 0, /*complain=*/ true, false);
+ 0, /*complain=*/true, false);
arglist->quick_push (nth_ns);
}
/* The user can (optionally) provide an allocation function in the promise
type, it's not a failure for it to be absent. */
tree fns = lookup_promise_method (orig, nwname, fn_start,
- /*musthave=*/ false);
+ /*musthave=*/false);
tree new_fn = NULL_TREE;
if (fns && fns != error_mark_node)
{
{
fns =lookup_name_real (nwname, 0, 1, /*block_p=*/true, 0, 0);
new_fn = lookup_arg_dependent (nwname, fns, arglist);
- new_fn = build_new_function_call (new_fn, &arglist, /*complain=*/ true);
+ new_fn = build_new_function_call (new_fn, &arglist, /*complain=*/true);
}
tree allocated = build1 (CONVERT_EXPR, coro_frame_ptr, new_fn);
grooaf);
r = coro_build_cvt_void_expr_stmt (r, fn_start);
append_to_statement_list (r, &early_ret_list);
- // We know it's the correct type.
+ /* We know it's the correct type. */
r = DECL_RESULT (orig);
r = build_stmt (fn_start, RETURN_EXPR, r);
TREE_NO_WARNING (r) |= 1;
tree actor_addr = build1 (ADDR_EXPR, act_des_fn_ptr, actor);
tree resume_m
= lookup_member (coro_frame_type, resume_name,
- /*protect*/ 1, /*want_type*/ 0, tf_warning_or_error);
+ /*protect=*/1, /*want_type=*/0, tf_warning_or_error);
tree resume_x = build_class_member_access_expr (deref_fp, resume_m, NULL_TREE,
false, tf_warning_or_error);
r = build2_loc (fn_start, INIT_EXPR, act_des_fn_ptr, resume_x, actor_addr);
tree destroy_addr = build1 (ADDR_EXPR, act_des_fn_ptr, destroy);
tree destroy_m
= lookup_member (coro_frame_type, destroy_name,
- /*protect*/ 1, /*want_type*/ 0, tf_warning_or_error);
+ /*protect=*/1, /*want_type=*/0, tf_warning_or_error);
tree destroy_x
= build_class_member_access_expr (deref_fp, destroy_m, NULL_TREE, false,
tf_warning_or_error);
/* Set up the promise. */
tree promise_m
= lookup_member (coro_frame_type, promise_name,
- /*protect*/ 1, /*want_type*/ 0, tf_warning_or_error);
+ /*protect=*/1, /*want_type=*/0, tf_warning_or_error);
tree p = build_class_member_access_expr (deref_fp, promise_m, NULL_TREE,
false, tf_warning_or_error);
First try to find a constructor with the same parameter list as the
original function (if it has params), failing that find a constructor
- with no parameter list.
- */
+ with no parameter list. */
if (DECL_ARGUMENTS (orig))
{
continue; /* Wasn't used. */
tree fld_ref = lookup_member (coro_frame_type, parm.field_id,
- /*protect*/ 1, /*want_type*/ 0,
+ /*protect=*/1, /*want_type=*/0,
tf_warning_or_error);
tree fld_idx
= build_class_member_access_expr (deref_fp, fld_ref, NULL_TREE,
&& (CLASSTYPE_LAZY_MOVE_CTOR (parm.frame_type)
|| CLASSTYPE_LAZY_MOVE_ASSIGN (parm.frame_type)
|| classtype_has_move_assign_or_move_ctor_p
- (parm.frame_type, /* user-declared */ true)))
+ (parm.frame_type, /*user_declared=*/true)))
p_in = make_tree_vector_single (rvalue (arg));
else
p_in = make_tree_vector_single (arg);
continue;
tree fld_ref = lookup_member (coro_frame_type, cap.field_id,
- /*protect*/ 1, /*want_type*/ 0,
+ /*protect=*/1, /*want_type=*/0,
tf_warning_or_error);
tree fld_idx
= build_class_member_access_expr (deref_fp, fld_ref, NULL_TREE,
&& (CLASSTYPE_LAZY_MOVE_CTOR (cap_type)
|| CLASSTYPE_LAZY_MOVE_ASSIGN (cap_type)
|| classtype_has_move_assign_or_move_ctor_p
- (cap_type, /* user-declared */ true)))
+ (cap_type, /*user_declared=*/true)))
p_in = make_tree_vector_single (rvalue (cap.captured));
else
p_in = make_tree_vector_single (cap.captured);
tree gro_meth = lookup_promise_method (orig,
coro_get_return_object_identifier,
- fn_start, /*musthave=*/ true );
+ fn_start, /*musthave=*/true );
tree get_ro
= build_new_method_call (p, gro_meth, NULL, NULL_TREE, LOOKUP_NORMAL, NULL,
tf_warning_or_error);
if (same_type_p (TREE_TYPE (get_ro), fn_return_type))
{
gro = DECL_RESULT (orig);
- gro_bind_vars = NULL_TREE; // We don't need a separate var.
+ gro_bind_vars = NULL_TREE; /* We don't need a separate var. */
}
else
{
DECL_CONTEXT (gro) = current_scope ();
r = build_stmt (fn_start, DECL_EXPR, gro);
add_stmt (r);
- gro_bind_vars = gro; // We need a temporary var.
+ gro_bind_vars = gro; /* We need a temporary var. */
}
- // init our actual var.
+ /* Initialize our actual var. */
r = build2_loc (fn_start, INIT_EXPR, TREE_TYPE (gro), gro, get_ro);
r = coro_build_cvt_void_expr_stmt (r, fn_start);
add_stmt (r);
/* Initialize the resume_idx_name to 0, meaning "not started". */
tree resume_idx_m
= lookup_member (coro_frame_type, resume_idx_name,
- /*protect*/ 1, /*want_type*/ 0, tf_warning_or_error);
+ /*protect=*/1, /*want_type=*/0, tf_warning_or_error);
tree resume_idx
= build_class_member_access_expr (deref_fp, resume_idx_m, NULL_TREE, false,
tf_warning_or_error);
}
else
{
- // construct the return value with a single GRO param.
+ /* construct the return value with a single GRO param. */
vec<tree, va_gc> *args = make_tree_vector_single (gro);
r = build_special_member_call (DECL_RESULT (orig),
complete_ctor_identifier, &args,
orig_fn_has_outer_bind = true;
tree block = BIND_EXPR_BLOCK (first);
replace_blk = make_node (BLOCK);
- if (block) // missing block is probably an error.
+ if (block) /* missing block is probably an error. */
{
gcc_assert (BLOCK_SUPERCONTEXT (block) == NULL_TREE);
gcc_assert (BLOCK_CHAIN (block) == NULL_TREE);
{
tree ueh_meth
= lookup_promise_method (orig, coro_unhandled_exception_identifier,
- fn_start, /*musthave=*/ true);
+ fn_start, /*musthave=*/true);
/* Build promise.unhandled_exception(); */
tree ueh
= build_new_method_call (p, ueh_meth, NULL, NULL_TREE, LOOKUP_NORMAL,
present. */
tree ueh_meth
= lookup_promise_method (orig, coro_unhandled_exception_identifier,
- fn_start, /*musthave=*/ false);
+ fn_start, /*musthave=*/false);
if (!ueh_meth || ueh_meth == error_mark_node)
warning_at (fn_start, 0, "no member named %qE in %qT",
coro_unhandled_exception_identifier,