aboutsummaryrefslogtreecommitdiff
path: root/libcc1
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2017-10-31 14:39:44 +0000
committerNathan Sidwell <nathan@acm.org>2017-10-31 14:39:44 +0000
commitd59a4e3d9695a1ec012d9b5c33f0b2d9764ed01d (patch)
treedc1df4321c6847d88a2b11efff77e2d138f03f45 /libcc1
parent17644f7c54c1b350048e4d0612c668587c121785 (diff)
[C++ PATCH] overloaded operator fns [2/N]
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg02326.html 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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@254267 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcc1')
-rw-r--r--libcc1/ChangeLog6
-rw-r--r--libcc1/libcp1plugin.cc35
2 files changed, 16 insertions, 25 deletions
diff --git a/libcc1/ChangeLog b/libcc1/ChangeLog
index ea7a1aeb25b..70998bcddac 100644
--- a/libcc1/ChangeLog
+++ b/libcc1/ChangeLog
@@ -1,3 +1,9 @@
+2017-10-31 Nathan Sidwell <nathan@acm.org>
+
+ * libcp1plugin.cc (plugin_build_decl): Use ovl_op_identifier.
+ Directly set operator code.
+ (plugin_build_dependent_expr): Use ovl_op_identifier.
+
2017-10-04 Nathan Sidwell <nathan@acm.org>
* libcp1plugin.cc (supplement_binding): Don't use
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index 12ea4ed84e0..d83521ec176 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -1346,12 +1346,7 @@ plugin_build_decl (cc1_plugin::connection *self,
}
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::connection *self,
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::connection *self,
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);
}