On 2/26/20 8:43 AM, Iain Sandoe wrote:
This is the second in the series to bring the GCC implementation into line
with the current standard.
2020-02-26 Iain Sandoe <[email protected]>
* coroutines.cc (struct param_info): Keep track of params
that are references, and cache the original type and whether
the DTOR is trivial.
(build_actor_fn): Handle param copies always, and adjust the
handling for references.
(register_param_uses): Only handle uses here.
(classtype_has_non_deleted_copy_ctor): New.
(morph_fn_to_coro): Adjust param copy handling to match n4849
by reordering ahead of the promise CTOR and always making a
frame copy, even if the param is unused in the coroutine body.
Ok, modulo a couple of changes:
@@ -1742,6 +1742,11 @@ struct param_info
tree field_id;
vec<tree *> *body_uses;
tree frame_type;
+ tree orig_type;
+ bool by_ref;
+ bool rv_ref;
+ bool pt_ref;
+ bool trivial_dtor;
};
Can you comment the fields here?
+bool
+classtype_has_non_deleted_copy_ctor (tree t)
+{
+ if (CLASSTYPE_LAZY_COPY_CTOR (t))
+ lazily_declare_fn (sfk_copy_constructor, t);
+ for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
+ if (copy_fn_p (*iter) && !DECL_DELETED_FN (*iter))
+ return true;
+ return false;
+}
Please put this in class.c next to the non deleted move ctor variant.
Needs a comment.
Ok with those changes, no need to re-review.
nathan
--
Nathan Sidwell