}
}
-tree
+static tree
copy_fndecl_with_name (tree fn, tree name)
{
/* Copy the function. */
return clone;
}
+/* FN is an operator function, create a variant for CODE. */
+
+tree
+copy_operator_fn (tree fn, tree_code code)
+{
+ return copy_fndecl_with_name (fn, ovl_op_identifier (code));
+}
+
/* FN is a constructor or destructor. Clone the declaration to create
a specialized in-charge or not-in-charge version, as indicated by
NAME. */
/* Build the clones of FN, return the number of clones built. These
will be inserted onto DECL_CHAIN of FN. */
-unsigned
-build_clones (tree fn)
+static unsigned
+build_cdtor_clones (tree fn)
{
unsigned count = 0;
CLASSTYPE_MEMBER_VEC. */
void
-clone_function_decl (tree fn, bool update_methods)
+clone_cdtor (tree fn, bool update_methods)
{
/* Avoid inappropriate cloning. */
if (DECL_CHAIN (fn)
&& DECL_CLONED_FUNCTION_P (DECL_CHAIN (fn)))
return;
- unsigned count = build_clones (fn);
+ unsigned count = build_cdtor_clones (fn);
/* Note that this is an abstract function that is never emitted. */
DECL_ABSTRACT_P (fn) = true;
/* While constructors can be via a using declaration, at this point
we no longer need to know that. */
for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
- clone_function_decl (*iter, /*update_methods=*/true);
+ clone_cdtor (*iter, /*update_methods=*/true);
if (tree dtor = CLASSTYPE_DESTRUCTOR (t))
- clone_function_decl (dtor, /*update_methods=*/true);
+ clone_cdtor (dtor, /*update_methods=*/true);
}
/* Deduce noexcept for a destructor DTOR. */
extern tree missing_abi_tags (tree);
extern void fixup_type_variants (tree);
extern void fixup_attribute_variants (tree);
-extern tree copy_fndecl_with_name (tree, tree);
-extern void clone_function_decl (tree, bool);
+extern void clone_cdtor (tree, bool);
+extern tree copy_operator_fn (tree, tree_code code);
extern void adjust_clone_args (tree);
extern void deduce_noexcept_on_destructor (tree);
extern bool uniquely_derived_from_p (tree, tree);
comparison operator function. --end note] */
if (kind == sfk_comparison)
{
- fn = copy_fndecl_with_name (pattern_fn, ovl_op_identifier (EQ_EXPR));
+ fn = copy_operator_fn (pattern_fn, EQ_EXPR);
DECL_ARTIFICIAL (fn) = 1;
TREE_TYPE (fn) = change_return_type (boolean_type_node, TREE_TYPE (fn));
return fn;
maybe_add_class_template_decl_list (type, fn, /*friend_p=*/0);
if (DECL_MAYBE_IN_CHARGE_CDTOR_P (fn))
/* Create appropriate clones. */
- clone_function_decl (fn, /*update_methods=*/true);
+ clone_cdtor (fn, /*update_methods=*/true);
return fn;
}
If it isn't, that'll be handled by
clone_constructors_and_destructors. */
if (PRIMARY_TEMPLATE_P (gen_tmpl))
- clone_function_decl (r, /*update_methods=*/false);
+ clone_cdtor (r, /*update_methods=*/false);
}
else if ((complain & tf_error) != 0
&& IDENTIFIER_ANY_OP_P (DECL_NAME (r))
instantiating the template clones. */
if (tree chain = DECL_CHAIN (gen_tmpl))
if (DECL_P (chain) && DECL_CLONED_FUNCTION_P (chain))
- clone_function_decl (fndecl, /*update_methods=*/false);
+ clone_cdtor (fndecl, /*update_methods=*/false);
if (!access_ok)
{
reversal. */
tree save = DECL_CHAIN (decl);
DECL_CHAIN (decl) = NULL_TREE;
- clone_function_decl (decl, /*update_methods=*/true);
+ clone_cdtor (decl, /*update_methods=*/true);
gcc_assert (TYPE_FIELDS (current_class_type) == decl);
TYPE_FIELDS (current_class_type)
= nreverse (TYPE_FIELDS (current_class_type));