[gcc/devel/c++-modules] Internal api tweak

Nathan Sidwell nathan@gcc.gnu.org
Tue Jun 30 17:22:59 GMT 2020


https://gcc.gnu.org/g:fb0bb1c31d78e9361058877bff5562238d3e67eb

commit fb0bb1c31d78e9361058877bff5562238d3e67eb
Author: Nathan Sidwell <nathan@acm.org>
Date:   Tue Jun 30 10:22:36 2020 -0700

    Internal api tweak
    
            gcc/cp/
            * class.c (copy_fndecl_with_name): Add tree code parm.  Adjust
            callers.

Diff:
---
 ChangeLog.modules |  4 ++++
 gcc/cp/class.c    | 14 ++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/ChangeLog.modules b/ChangeLog.modules
index 56956e5abc3..f6dbda9f70f 100644
--- a/ChangeLog.modules
+++ b/ChangeLog.modules
@@ -1,5 +1,9 @@
 2020-06-30  Nathan Sidwell  <nathan@acm.org>
 
+	gcc/cp/
+	* class.c (copy_fndecl_with_name): Add tree code parm.  Adjust
+	callers.
+
 	libcc1/
 	* libcp1plugin.cc (plugin_build_decl): Adjust.
 
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index b49410398a9..38aed4faf2b 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4708,8 +4708,8 @@ check_methods (tree t)
    OMIT_INHERITED_PARMS_P are relevant if it's a cdtor.  */
 
 static tree
-copy_fndecl_with_name (tree fn, tree name, bool need_vtt_parm_p,
-		       bool omit_inherited_parms_p)
+copy_fndecl_with_name (tree fn, tree name, tree_code code,
+		       bool need_vtt_parm_p, bool omit_inherited_parms_p)
 {
   /* Copy the function.  */
   tree clone = copy_decl (fn);
@@ -4733,10 +4733,11 @@ copy_fndecl_with_name (tree fn, tree name, bool need_vtt_parm_p,
       DECL_VIRTUAL_P (clone) = 0;
       DECL_VINDEX (clone) = NULL_TREE;
     }
-  else if (IDENTIFIER_OVL_OP_P (name))
+
+  if (code != ERROR_MARK)
     {
       /* Set the operator code.  */
-      const ovl_op_info_t *ovl_op = IDENTIFIER_OVL_OP_INFO (name);
+      const ovl_op_info_t *ovl_op = OVL_OP_INFO (false, code);
       DECL_OVERLOADED_OPERATOR_CODE_RAW (clone) = ovl_op->ovl_op_code;
     }
 
@@ -4826,7 +4827,8 @@ copy_fndecl_with_name (tree fn, tree name, bool need_vtt_parm_p,
 tree
 copy_operator_fn (tree fn, tree_code code)
 {
-  return copy_fndecl_with_name (fn, ovl_op_identifier (code), false, false);
+  return copy_fndecl_with_name (fn, ovl_op_identifier (code),
+				code, false, false);
 }
 
 /* FN is a constructor or destructor.  Clone the declaration to create
@@ -4856,7 +4858,7 @@ build_clone (tree fn, tree name, bool need_vtt_parm_p,
     }
   else
     {
-      clone = copy_fndecl_with_name (fn, name,
+      clone = copy_fndecl_with_name (fn, name, ERROR_MARK,
 				     need_vtt_parm_p, omit_inherited_parms_p);
       DECL_CLONED_FUNCTION (clone) = fn;
     }


More information about the Gcc-cvs mailing list