diff mbox series

[C++] overloaded operator fns [2/N]

Message ID dac4a417-0203-576d-99a2-de598da41ae8@acm.org
State New
Headers show
Series [C++] overloaded operator fns [2/N] | expand

Commit Message

Nathan Sidwell Oct. 31, 2017, 2:38 p.m. UTC
This patch removes cp_operator_id(C) and cp_assignment_operator_id(C), 
replacing them with a singlle ovl_op_identifier(A,C) macro.  There's 
also OVL_OP_INFO(A,C) to get at the other information.  The 
implementation of that macro will change later in this patch series, so 
don't freak on the (A ? assop_ary : op_ary) idiom.

nathan
diff mbox series

Patch

2017-10-31  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (ovl_op_identifier): New.
	(assign_op_identifier, call_op_identifier): Adjust.
	(cp_operator_id, cp_assignment_operator_ide): Delete.
	(SET_OVERLOADED_OPERATOR_CODE): Delete.
	(OVL_OP_INFO): New.
	* call.c (op_error): Use OVL_OP_INFO.
	(build_conditional_expr_1): Use ovl_op_identifier.
	(build_new_op_1): Use OVL_OP_INFO & ovl_op_identifier.
	(build_op_delete_call): Likewise.
	* class.c (type_requires_array_cookie): Use ovl_op_identifier.
	* decl.c (duplicate_decls): Directly copy operator code.
	(builtin_function_1): Do not set operator code.
	(build_library_fn): Directly set operator code.
	(push_cp_library_fn): Use ovl_op_identifier.
	(grok_op_properties): Directly set operator code.
	* decl2.c (maybe_warn_sized_delete): Use ovl_op_identifier.
	* error.c (dump_expr): Use OVL_OP_INFO.
	(op_to_string): Add assop arg. Use OVL_OP_INFO.
	(assop_to_string): Delete.
	(args_to_string): Adjust.
	* init.c (build_new_1): Use ovl_op_identifier.
	* mangle.c (write_unqualified_name): Use OVL_OP_INFO.
	(write_expression): Likewise.
	* method.c (synthesized_method_walk): Use ovl_op_identifier.
	(implicitly_declare_fn): Use assign_op_identifier. Directly set
	operator code.
	* name-lookup.c (get_class_binding): Use assign_op_identifier.
	* parser.c (cp_parser_operator): Use ovl_op_identifier.
	(cp_parser_omp_clause_reduction): Likewise.
	* semantics.c (omp_reduction_id): Likewise.
	* typeck.c (cxx_sizeof_or_alignof_type): Use OVL_OP_INFO.

	libcc1/
	* libcp1plugin.cc (plugin_build_decl): Use ovl_op_identifier.
	Directly set operator code.
	(plugin_build_dependent_expr): Use ovl_op_identifier.

Index: gcc/cp/call.c
===================================================================
--- gcc/cp/call.c	(revision 254263)
+++ gcc/cp/call.c	(working copy)
@@ -4620,12 +4620,8 @@  static void
 op_error (location_t loc, enum tree_code code, enum tree_code code2,
 	  tree arg1, tree arg2, tree arg3, bool match)
 {
-  const char *opname;
-
-  if (code == MODIFY_EXPR)
-    opname = assignment_operator_name_info[code2].name;
-  else
-    opname = operator_name_info[code].name;
+  bool assop = code == MODIFY_EXPR;
+  const char *opname = OVL_OP_INFO (assop, assop ? code2 : code)->name;
 
   switch (code)
     {
@@ -5184,7 +5180,7 @@  build_conditional_expr_1 (location_t loc
       add_builtin_candidates (&candidates,
 			      COND_EXPR,
 			      NOP_EXPR,
-			      cp_operator_id (COND_EXPR),
+			      ovl_op_identifier (false, COND_EXPR),
 			      args,
 			      LOOKUP_NORMAL, complain);
 
@@ -5574,7 +5570,6 @@  build_new_op_1 (location_t loc, enum tre
 {
   struct z_candidate *candidates = 0, *cand;
   vec<tree, va_gc> *arglist;
-  tree fnname;
   tree args[3];
   tree result = NULL_TREE;
   bool result_valid_p = false;
@@ -5591,14 +5586,13 @@  build_new_op_1 (location_t loc, enum tre
       || error_operand_p (arg3))
     return error_mark_node;
 
-  if (code == MODIFY_EXPR)
+  bool ismodop = code == MODIFY_EXPR;
+  if (ismodop)
     {
       code2 = TREE_CODE (arg3);
       arg3 = NULL_TREE;
-      fnname = cp_assignment_operator_id (code2);
     }
-  else
-    fnname = cp_operator_id (code);
+  tree fnname = ovl_op_identifier (ismodop, ismodop ? code2 : code);
 
   arg1 = prep_operand (arg1);
 
@@ -5793,7 +5787,7 @@  build_new_op_1 (location_t loc, enum tre
 		? G_("no %<%D(int)%> declared for postfix %qs,"
 		     " trying prefix operator instead")
 		: G_("no %<%D(int)%> declared for postfix %qs");
-	      permerror (loc, msg, fnname, operator_name_info[code].name);
+	      permerror (loc, msg, fnname, OVL_OP_INFO (false, code)->name);
 	    }
 
 	  if (!flag_permissive)
@@ -6205,7 +6199,7 @@  build_op_delete_call (enum tree_code cod
 
   type = strip_array_types (TREE_TYPE (TREE_TYPE (addr)));
 
-  fnname = cp_operator_id (code);
+  fnname = ovl_op_identifier (false, code);
 
   if (CLASS_TYPE_P (type)
       && COMPLETE_TYPE_P (complete_type (type))
@@ -6434,7 +6428,7 @@  build_op_delete_call (enum tree_code cod
 
   if (complain & tf_error)
     error ("no suitable %<operator %s%> for %qT",
-	   operator_name_info[(int)code].name, type);
+	   OVL_OP_INFO (false, code)->name, type);
   return error_mark_node;
 }
 
Index: gcc/cp/class.c
===================================================================
--- gcc/cp/class.c	(revision 254263)
+++ gcc/cp/class.c	(working copy)
@@ -5304,7 +5304,7 @@  type_requires_array_cookie (tree type)
      the array to the deallocation function, so we will need to store
      a cookie.  */
   fns = lookup_fnfields (TYPE_BINFO (type),
-			 cp_operator_id (VEC_DELETE_EXPR),
+			 ovl_op_identifier (false, VEC_DELETE_EXPR),
 			 /*protect=*/0);
   /* If there are no `operator []' members, or the lookup is
      ambiguous, then we don't need a cookie.  */
Index: gcc/cp/cp-tree.h
===================================================================
--- gcc/cp/cp-tree.h	(revision 254263)
+++ gcc/cp/cp-tree.h	(working copy)
@@ -245,24 +245,14 @@  extern GTY(()) tree cp_global_trees[CPTI
    then deletes the entire object.  */
 #define deleting_dtor_identifier	cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER]
 
-#define assign_op_identifier (cp_assignment_operator_id (NOP_EXPR))
-#define call_op_identifier (cp_operator_id (CALL_EXPR))
+#define ovl_op_identifier(ISASS, CODE)  (OVL_OP_INFO(ISASS, CODE)->identifier)
+#define assign_op_identifier (ovl_op_identifier (true, NOP_EXPR))
+#define call_op_identifier (ovl_op_identifier (false, CALL_EXPR))
 /* The name used for conversion operators -- but note that actual
    conversion functions use special identifiers outside the identifier
    table.  */
 #define conv_op_identifier		cp_global_trees[CPTI_CONV_OP_IDENTIFIER]
 
-/* The name of the identifier used internally to represent operator CODE.  */
-#define cp_operator_id(CODE) \
-  (operator_name_info[(int) (CODE)].identifier)
-
-/* The name of the identifier used to represent assignment operator CODE,
-   both simple (i.e., operator= with CODE == NOP_EXPR) and compound (e.g.,
-   operator+= with CODE == PLUS_EXPR).  Includes copy and move assignment.
-   Use copy_fn_p() to test specifically for copy assignment.  */
-#define cp_assignment_operator_id(CODE)				\
-  (assignment_operator_name_info[(int) (CODE)].identifier)
-
 #define delta_identifier		cp_global_trees[CPTI_DELTA_IDENTIFIER]
 #define in_charge_identifier		cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER]
 /* The name of the parameter that contains a pointer to the VTT to use
@@ -2810,10 +2800,6 @@  struct GTY(()) lang_decl {
 #define SET_VAR_HAD_UNKNOWN_BOUND(NODE) \
   (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.unknown_bound_p = true)
 
-/* Set the overloaded operator code for NODE to CODE.  */
-#define SET_OVERLOADED_OPERATOR_CODE(NODE, CODE) \
-  (LANG_DECL_FN_CHECK (NODE)->operator_code = (CODE))
-
 /* True iff decl NODE is for an overloaded operator.  */
 #define DECL_OVERLOADED_OPERATOR_P(NODE)		\
   IDENTIFIER_ANY_OP_P (DECL_NAME (NODE))
@@ -5506,6 +5492,12 @@  extern GTY(()) operator_name_info_t oper
 extern GTY(()) operator_name_info_t assignment_operator_name_info
   [(int) MAX_TREE_CODES];
 
+/* Given an ass_op_p boolean and a tree code, return a pointer to its
+   overloaded operator info.  */
+#define OVL_OP_INFO(IS_ASS_P, TREE_CODE)			\
+  (((IS_ASS_P) ? assignment_operator_name_info : operator_name_info)	\
+   + (TREE_CODE))
+
 /* A type-qualifier, or bitmask therefore, using the TYPE_QUAL
    constants.  */
 
Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c	(revision 254263)
+++ gcc/cp/decl.c	(working copy)
@@ -1922,8 +1922,8 @@  next_arg:;
       DECL_OVERRIDE_P (newdecl) |= DECL_OVERRIDE_P (olddecl);
       DECL_THIS_STATIC (newdecl) |= DECL_THIS_STATIC (olddecl);
       if (DECL_OVERLOADED_OPERATOR_P (olddecl))
-	SET_OVERLOADED_OPERATOR_CODE
-	  (newdecl, DECL_OVERLOADED_OPERATOR_CODE (olddecl));
+	DECL_OVERLOADED_OPERATOR_CODE (newdecl)
+	  = DECL_OVERLOADED_OPERATOR_CODE (olddecl);
       new_defines_function = DECL_INITIAL (newdecl) != NULL_TREE;
 
       /* Optionally warn about more than one declaration for the same
@@ -4359,7 +4359,6 @@  builtin_function_1 (tree decl, tree cont
   retrofit_lang_decl (decl);
 
   DECL_ARTIFICIAL (decl) = 1;
-  SET_OVERLOADED_OPERATOR_CODE (decl, ERROR_MARK);
   SET_DECL_LANGUAGE (decl, lang_c);
   /* Runtime library routines are, by definition, available in an
      external shared object.  */
@@ -4447,7 +4446,7 @@  build_library_fn (tree name, enum tree_c
   DECL_EXTERNAL (fn) = 1;
   TREE_PUBLIC (fn) = 1;
   DECL_ARTIFICIAL (fn) = 1;
-  SET_OVERLOADED_OPERATOR_CODE (fn, operator_code);
+  DECL_OVERLOADED_OPERATOR_CODE (fn) = operator_code;
   SET_DECL_LANGUAGE (fn, lang_c);
   /* Runtime library routines are, by definition, available in an
      external shared object.  */
@@ -4512,9 +4511,8 @@  static tree
 push_cp_library_fn (enum tree_code operator_code, tree type,
 		    int ecf_flags)
 {
-  tree fn = build_cp_library_fn (cp_operator_id (operator_code),
-				 operator_code,
-				 type, ecf_flags);
+  tree fn = build_cp_library_fn (ovl_op_identifier (false, operator_code),
+				 operator_code, type, ecf_flags);
   pushdecl (fn);
   if (flag_tm)
     apply_tm_attr (fn, get_identifier ("transaction_safe"));
@@ -12938,7 +12936,7 @@  grok_op_properties (tree decl, bool comp
       }
     while (0);
   gcc_assert (operator_code != MAX_TREE_CODES);
-  SET_OVERLOADED_OPERATOR_CODE (decl, operator_code);
+  DECL_OVERLOADED_OPERATOR_CODE (decl) = operator_code;
 
   if (operator_code == NEW_EXPR || operator_code == VEC_NEW_EXPR
       || operator_code == DELETE_EXPR || operator_code == VEC_DELETE_EXPR)
@@ -13111,7 +13109,7 @@  grok_op_properties (tree decl, bool comp
 	      gcc_unreachable ();
 	    }
 
-	  SET_OVERLOADED_OPERATOR_CODE (decl, operator_code);
+	  DECL_OVERLOADED_OPERATOR_CODE (decl) = operator_code;
 
 	  if ((operator_code == POSTINCREMENT_EXPR
 	       || operator_code == POSTDECREMENT_EXPR)
Index: gcc/cp/decl2.c
===================================================================
--- gcc/cp/decl2.c	(revision 254263)
+++ gcc/cp/decl2.c	(working copy)
@@ -4455,7 +4455,7 @@  maybe_warn_sized_delete (enum tree_code
   tree sized = NULL_TREE;
   tree unsized = NULL_TREE;
 
-  for (ovl_iterator iter (get_global_binding (cp_operator_id (code)));
+  for (ovl_iterator iter (get_global_binding (ovl_op_identifier (false, code)));
        iter; ++iter)
     {
       tree fn = *iter;
Index: gcc/cp/error.c
===================================================================
--- gcc/cp/error.c	(revision 254263)
+++ gcc/cp/error.c	(working copy)
@@ -50,13 +50,12 @@  static cxx_pretty_printer * const cxx_pp
 # define NEXT_CODE(T) (TREE_CODE (TREE_TYPE (T)))
 
 static const char *args_to_string (tree, int);
-static const char *assop_to_string (enum tree_code);
 static const char *code_to_string (enum tree_code);
 static const char *cv_to_string (tree, int);
 static const char *decl_to_string (tree, int);
 static const char *expr_to_string (tree);
 static const char *fndecl_to_string (tree, int);
-static const char *op_to_string	(enum tree_code);
+static const char *op_to_string	(bool, enum tree_code);
 static const char *parm_to_string (int);
 static const char *type_to_string (tree, int);
 
@@ -2230,8 +2229,7 @@  dump_expr (cxx_pretty_printer *pp, tree
 
     case INIT_EXPR:
     case MODIFY_EXPR:
-      dump_binary_op (pp, assignment_operator_name_info[NOP_EXPR].name,
-		      t, flags);
+      dump_binary_op (pp, OVL_OP_INFO (true, NOP_EXPR)->name, t, flags);
       break;
 
     case PLUS_EXPR:
@@ -2255,7 +2253,7 @@  dump_expr (cxx_pretty_printer *pp, tree
     case EQ_EXPR:
     case NE_EXPR:
     case EXACT_DIV_EXPR:
-      dump_binary_op (pp, operator_name_info[TREE_CODE (t)].name, t, flags);
+      dump_binary_op (pp, OVL_OP_INFO (false, TREE_CODE (t))->name, t, flags);
       break;
 
     case CEIL_DIV_EXPR:
@@ -2386,14 +2384,14 @@  dump_expr (cxx_pretty_printer *pp, tree
     case TRUTH_NOT_EXPR:
     case PREDECREMENT_EXPR:
     case PREINCREMENT_EXPR:
-      dump_unary_op (pp, operator_name_info [TREE_CODE (t)].name, t, flags);
+      dump_unary_op (pp, OVL_OP_INFO (false, TREE_CODE (t))->name, t, flags);
       break;
 
     case POSTDECREMENT_EXPR:
     case POSTINCREMENT_EXPR:
       pp_cxx_left_paren (pp);
       dump_expr (pp, TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
-      pp_cxx_ws_string (pp, operator_name_info[TREE_CODE (t)].name);
+      pp_cxx_ws_string (pp, OVL_OP_INFO (false, TREE_CODE (t))->name);
       pp_cxx_right_paren (pp);
       break;
 
@@ -2656,7 +2654,7 @@  dump_expr (cxx_pretty_printer *pp, tree
 
     case REALPART_EXPR:
     case IMAGPART_EXPR:
-      pp_cxx_ws_string (pp, operator_name_info[TREE_CODE (t)].name);
+      pp_cxx_ws_string (pp, OVL_OP_INFO (false, TREE_CODE (t))->name);
       pp_cxx_whitespace (pp);
       dump_expr (pp, TREE_OPERAND (t, 0), flags);
       break;
@@ -3136,9 +3134,9 @@  parm_to_string (int p)
 }
 
 static const char *
-op_to_string (enum tree_code p)
+op_to_string (bool assop, enum tree_code p)
 {
-  tree id = operator_name_info[p].identifier;
+  tree id = ovl_op_identifier (assop, p);
   return id ? IDENTIFIER_POINTER (id) : M_("<unknown>");
 }
 
@@ -3180,13 +3178,6 @@  type_to_string (tree typ, int verbose)
 }
 
 static const char *
-assop_to_string (enum tree_code p)
-{
-  tree id = assignment_operator_name_info[(int) p].identifier;
-  return id ? IDENTIFIER_POINTER (id) : M_("{unknown}");
-}
-
-static const char *
 args_to_string (tree p, int verbose)
 {
   int flags = 0;
@@ -4044,9 +4035,9 @@  cp_printer (pretty_printer *pp, text_inf
     case 'E': result = expr_to_string (next_tree);		break;
     case 'F': result = fndecl_to_string (next_tree, verbose);	break;
     case 'L': result = language_to_string (next_lang);		break;
-    case 'O': result = op_to_string (next_tcode);		break;
+    case 'O': result = op_to_string (false, next_tcode);	break;
     case 'P': result = parm_to_string (next_int);		break;
-    case 'Q': result = assop_to_string (next_tcode);		break;
+    case 'Q': result = op_to_string (true, next_tcode);		break;
     case 'S': result = subst_to_string (next_tree);		break;
     case 'T': result = type_to_string (next_tree, verbose);	break;
     case 'V': result = cv_to_string (next_tree, verbose);	break;
Index: gcc/cp/init.c
===================================================================
--- gcc/cp/init.c	(revision 254263)
+++ gcc/cp/init.c	(working copy)
@@ -3055,7 +3055,7 @@  build_new_1 (vec<tree, va_gc> **placemen
   tree fnname;
   tree fns;
 
-  fnname = cp_operator_id (array_p ? VEC_NEW_EXPR : NEW_EXPR);
+  fnname = ovl_op_identifier (false, array_p ? VEC_NEW_EXPR : NEW_EXPR);
 
   member_new_p = !globally_qualified_p
 		 && CLASS_TYPE_P (elt_type)
Index: gcc/cp/mangle.c
===================================================================
--- gcc/cp/mangle.c	(revision 254263)
+++ gcc/cp/mangle.c	(working copy)
@@ -1345,13 +1345,10 @@  write_unqualified_name (tree decl)
 	}
       else if (DECL_OVERLOADED_OPERATOR_P (decl))
 	{
-	  operator_name_info_t *oni;
-	  if (DECL_ASSIGNMENT_OPERATOR_P (decl))
-	    oni = assignment_operator_name_info;
-	  else
-	    oni = operator_name_info;
-
-	  write_string (oni[DECL_OVERLOADED_OPERATOR_CODE (decl)].mangled_name);
+	  const char *mangled_name
+	    = (OVL_OP_INFO (DECL_ASSIGNMENT_OPERATOR_P (decl),
+	       DECL_OVERLOADED_OPERATOR_CODE (decl))->mangled_name);
+	  write_string (mangled_name);
 	}
       else if (UDLIT_OPER_P (DECL_NAME (decl)))
 	write_literal_operator_name (DECL_NAME (decl));
@@ -3064,8 +3061,8 @@  write_expression (tree expr)
   else if (TREE_CODE (expr) == MODOP_EXPR)
     {
       enum tree_code subop = TREE_CODE (TREE_OPERAND (expr, 1));
-      const char *name = (assignment_operator_name_info[(int) subop]
-			  .mangled_name);
+      const char *name = OVL_OP_INFO (true, subop)->mangled_name;
+
       write_string (name);
       write_expression (TREE_OPERAND (expr, 0));
       write_expression (TREE_OPERAND (expr, 2));
@@ -3090,7 +3087,7 @@  write_expression (tree expr)
       if (NEW_EXPR_USE_GLOBAL (expr))
 	write_string ("gs");
 
-      write_string (operator_name_info[(int) code].mangled_name);
+      write_string (OVL_OP_INFO (false, code)->mangled_name);
 
       for (t = placement; t; t = TREE_CHAIN (t))
 	write_expression (TREE_VALUE (t));
@@ -3130,7 +3127,7 @@  write_expression (tree expr)
       if (DELETE_EXPR_USE_GLOBAL (expr))
 	write_string ("gs");
 
-      write_string (operator_name_info[(int) code].mangled_name);
+      write_string (OVL_OP_INFO (false, code)->mangled_name);
 
       write_expression (TREE_OPERAND (expr, 0));
     }
@@ -3195,7 +3192,7 @@  write_expression (tree expr)
 
 	  if (TREE_CODE (ob) == ARROW_EXPR)
 	    {
-	      write_string (operator_name_info[(int)code].mangled_name);
+	      write_string (OVL_OP_INFO (false, code)->mangled_name);
 	      ob = TREE_OPERAND (ob, 0);
 	      write_expression (ob);
 	    }
@@ -3212,7 +3209,7 @@  write_expression (tree expr)
 	}
 
       /* If it wasn't any of those, recursively expand the expression.  */
-      name = operator_name_info[(int) code].mangled_name;
+      name = OVL_OP_INFO (false, code)->mangled_name;
 
       /* We used to mangle const_cast and static_cast like a C cast.  */
       if (code == CONST_CAST_EXPR
@@ -3221,7 +3218,7 @@  write_expression (tree expr)
 	  if (abi_warn_or_compat_version_crosses (6))
 	    G.need_abi_warning = 1;
 	  if (!abi_version_at_least (6))
-	    name = operator_name_info[CAST_EXPR].mangled_name;
+	    name = OVL_OP_INFO (false, CAST_EXPR)->mangled_name;
 	}
 
       if (name == NULL)
@@ -3322,7 +3319,7 @@  write_expression (tree expr)
 		  if (i == 0)
 		    {
 		      int fcode = TREE_INT_CST_LOW (operand);
-		      write_string (operator_name_info[fcode].mangled_name);
+		      write_string (OVL_OP_INFO (false, fcode)->mangled_name);
 		      continue;
 		    }
 		  else if (code == BINARY_LEFT_FOLD_EXPR)
Index: gcc/cp/method.c
===================================================================
--- gcc/cp/method.c	(revision 254263)
+++ gcc/cp/method.c	(working copy)
@@ -1703,12 +1703,12 @@  synthesized_method_walk (tree ctype, spe
 	{
 	  /* Unlike for base ctor/op=/dtor, for operator delete it's fine
 	     to have a null fn (no class-specific op delete).  */
-	  fn = locate_fn_flags (ctype, cp_operator_id (DELETE_EXPR),
+	  fn = locate_fn_flags (ctype, ovl_op_identifier (false, DELETE_EXPR),
 				ptr_type_node, flags, tf_none);
 	  if (fn && fn == error_mark_node)
 	    {
 	      if (complain & tf_error)
-		locate_fn_flags (ctype, cp_operator_id (DELETE_EXPR),
+		locate_fn_flags (ctype, ovl_op_identifier (false, DELETE_EXPR),
 				 ptr_type_node, flags, complain);
 	      if (deleted_p)
 		*deleted_p = true;
@@ -2008,7 +2008,7 @@  implicitly_declare_fn (special_function_
 	  || kind == sfk_move_assignment)
 	{
 	  return_type = build_reference_type (type);
-	  name = cp_assignment_operator_id (NOP_EXPR);
+	  name = assign_op_identifier;
 	}
       else
 	name = ctor_identifier;
@@ -2078,7 +2078,7 @@  implicitly_declare_fn (special_function_
 
   if (!IDENTIFIER_CDTOR_P (name))
     /* Assignment operator.  */
-    SET_OVERLOADED_OPERATOR_CODE (fn, NOP_EXPR);
+    DECL_OVERLOADED_OPERATOR_CODE (fn) = NOP_EXPR;
   else if (IDENTIFIER_CTOR_P (name))
     DECL_CXX_CONSTRUCTOR_P (fn) = true;
   else
Index: gcc/cp/name-lookup.c
===================================================================
--- gcc/cp/name-lookup.c	(revision 254263)
+++ gcc/cp/name-lookup.c	(working copy)
@@ -1299,7 +1299,7 @@  get_class_binding (tree klass, tree name
 	  if (CLASSTYPE_LAZY_DESTRUCTOR (klass))
 	    lazily_declare_fn (sfk_destructor, klass);
 	}
-      else if (name == cp_assignment_operator_id (NOP_EXPR))
+      else if (name == assign_op_identifier)
 	{
 	  if (CLASSTYPE_LAZY_COPY_ASSIGN (klass))
 	    lazily_declare_fn (sfk_copy_assignment, klass);
Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c	(revision 254263)
+++ gcc/cp/parser.c	(working copy)
@@ -15006,7 +15006,7 @@  cp_parser_operator (cp_parser* parser)
      operator token.  */
   if (op != ERROR_MARK)
     {
-      id = assop ? cp_assignment_operator_id (op) : cp_operator_id (op);
+      id = ovl_op_identifier (assop, op);
       if (!consumed)
 	cp_lexer_consume_token (parser->lexer);
     }
@@ -32588,21 +32588,21 @@  cp_parser_omp_clause_reduction (cp_parse
 	    code = MIN_EXPR;
 	  else if (strcmp (p, "max") == 0)
 	    code = MAX_EXPR;
-	  else if (id == cp_operator_id (PLUS_EXPR))
+	  else if (id == ovl_op_identifier (false, PLUS_EXPR))
 	    code = PLUS_EXPR;
-	  else if (id == cp_operator_id (MULT_EXPR))
+	  else if (id == ovl_op_identifier (false, MULT_EXPR))
 	    code = MULT_EXPR;
-	  else if (id == cp_operator_id (MINUS_EXPR))
+	  else if (id == ovl_op_identifier (false, MINUS_EXPR))
 	    code = MINUS_EXPR;
-	  else if (id == cp_operator_id (BIT_AND_EXPR))
+	  else if (id == ovl_op_identifier (false, BIT_AND_EXPR))
 	    code = BIT_AND_EXPR;
-	  else if (id == cp_operator_id (BIT_IOR_EXPR))
+	  else if (id == ovl_op_identifier (false, BIT_IOR_EXPR))
 	    code = BIT_IOR_EXPR;
-	  else if (id == cp_operator_id (BIT_XOR_EXPR))
+	  else if (id == ovl_op_identifier (false, BIT_XOR_EXPR))
 	    code = BIT_XOR_EXPR;
-	  else if (id == cp_operator_id (TRUTH_ANDIF_EXPR))
+	  else if (id == ovl_op_identifier (false, TRUTH_ANDIF_EXPR))
 	    code = TRUTH_ANDIF_EXPR;
-	  else if (id == cp_operator_id (TRUTH_ORIF_EXPR))
+	  else if (id == ovl_op_identifier (false, TRUTH_ORIF_EXPR))
 	    code = TRUTH_ORIF_EXPR;
 	  id = omp_reduction_id (code, id, NULL_TREE);
 	  tree scope = parser->scope;
Index: gcc/cp/semantics.c
===================================================================
--- gcc/cp/semantics.c	(revision 254263)
+++ gcc/cp/semantics.c	(working copy)
@@ -5099,7 +5099,7 @@  omp_reduction_id (enum tree_code reducti
     case BIT_IOR_EXPR:
     case TRUTH_ANDIF_EXPR:
     case TRUTH_ORIF_EXPR:
-      reduction_id = cp_operator_id (reduction_code);
+      reduction_id = ovl_op_identifier (false, reduction_code);
       break;
     case MIN_EXPR:
       p = "min";
Index: gcc/cp/typeck.c
===================================================================
--- gcc/cp/typeck.c	(revision 254263)
+++ gcc/cp/typeck.c	(working copy)
@@ -1562,7 +1562,7 @@  cxx_sizeof_or_alignof_type (tree type, e
       if (complain)
 	pedwarn (input_location, OPT_Wpointer_arith, 
 		 "invalid application of %qs to a member function", 
-		 operator_name_info[(int) op].name);
+		 OVL_OP_INFO (false, op)->name);
       else
 	return error_mark_node;
       value = size_one_node;
Index: libcc1/libcp1plugin.cc
===================================================================
--- libcc1/libcp1plugin.cc	(revision 254263)
+++ libcc1/libcp1plugin.cc	(working copy)
@@ -1346,12 +1346,7 @@  plugin_build_decl (cc1_plugin::connectio
 	    }
 
 	  if (opcode != ERROR_MARK)
-	    {
-	      if (assop)
-		identifier = cp_assignment_operator_id (opcode);
-	      else
-		identifier = cp_operator_id (opcode);
-	    }
+	    identifier = ovl_op_identifier (assop, opcode);
 	}
       decl = build_lang_decl_loc (loc, code, identifier, sym_type);
       /* FIXME: current_lang_name is lang_name_c while compiling an
@@ -1410,19 +1405,14 @@  plugin_build_decl (cc1_plugin::connectio
 	  DECL_DECLARED_INLINE_P (decl) = 1;
 	  DECL_INITIAL (decl) = error_mark_node;
 	}
-      if (ctor || dtor)
-	{
-	  if (ctor)
-	    DECL_CXX_CONSTRUCTOR_P (decl) = 1;
-	  if (dtor)
-	    DECL_CXX_DESTRUCTOR_P (decl) = 1;
-	}
-      else
-	{
-	  if ((sym_flags & GCC_CP_FLAG_SPECIAL_FUNCTION)
-	      && opcode != ERROR_MARK)
-	    SET_OVERLOADED_OPERATOR_CODE (decl, opcode);
-	}
+
+      if (ctor)
+	DECL_CXX_CONSTRUCTOR_P (decl) = 1;
+      else if (dtor)
+	DECL_CXX_DESTRUCTOR_P (decl) = 1;
+      else if ((sym_flags & GCC_CP_FLAG_SPECIAL_FUNCTION)
+	       && opcode != ERROR_MARK)
+	DECL_OVERLOADED_OPERATOR_CODE (decl) = opcode;
     }
   else if (RECORD_OR_UNION_CODE_P (code))
     {
@@ -2649,12 +2639,7 @@  plugin_build_dependent_expr (cc1_plugin:
       gcc_assert (convop || !conv_type);
 
       if (opcode != ERROR_MARK)
-	{
-	  if (assop)
-	    identifier = cp_assignment_operator_id (opcode);
-	  else
-	    identifier = cp_operator_id (opcode);
-	}
+	identifier = ovl_op_identifier (assop, opcode);
 
       gcc_assert (identifier);
     }