diff options
-rw-r--r-- | gcc/cp/class.c | 22 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 4 | ||||
-rw-r--r-- | gcc/cp/method.c | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 4 | ||||
-rw-r--r-- | libcc1/libcp1plugin.cc | 2 |
5 files changed, 22 insertions, 14 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 94a9585..b0cc027 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -4696,7 +4696,7 @@ check_methods (tree t) } } -tree +static tree copy_fndecl_with_name (tree fn, tree name) { /* Copy the function. */ @@ -4804,6 +4804,14 @@ copy_fndecl_with_name (tree fn, tree name) 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. */ @@ -4847,8 +4855,8 @@ build_clone (tree fn, tree 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; @@ -4891,14 +4899,14 @@ build_clones (tree fn) 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; @@ -4998,10 +5006,10 @@ clone_constructors_and_destructors (tree t) /* 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. */ diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 78e8ca4..9b31eaf 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -6450,8 +6450,8 @@ extern void check_abi_tags (tree); 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); diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 2a98907..8fd7052 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -2688,7 +2688,7 @@ implicitly_declare_fn (special_function_kind kind, tree type, 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; @@ -3152,7 +3152,7 @@ lazily_declare_fn (special_function_kind sfk, tree type) 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; } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 618bf68..b6423f7 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13923,7 +13923,7 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain, 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)) @@ -20769,7 +20769,7 @@ instantiate_template_1 (tree tmpl, tree orig_args, tsubst_flags_t complain) 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) { diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc index 00449f4..01aecf0 100644 --- a/libcc1/libcp1plugin.cc +++ b/libcc1/libcp1plugin.cc @@ -1552,7 +1552,7 @@ plugin_build_decl (cc1_plugin::connection *self, 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)); |