aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/mangle.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2017-11-01 14:03:27 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2017-11-01 14:03:27 +0000
commitd6dd9d7f8efcf92c5c70a9e91e99a9719b31cd51 (patch)
tree46fe2615cfcde921d2e8142f94bf117cca7fcf43 /gcc/cp/mangle.c
parent0299d48bad088eccb76cf71de064dbc047b8cf62 (diff)
downloadgcc-d6dd9d7f8efcf92c5c70a9e91e99a9719b31cd51.zip
gcc-d6dd9d7f8efcf92c5c70a9e91e99a9719b31cd51.tar.gz
gcc-d6dd9d7f8efcf92c5c70a9e91e99a9719b31cd51.tar.bz2
[C++ PATCH] overloaded operator fns [6/N]
https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00018.html * cp-tree.h (IDENTIFIER_CP_INDEX): Define. (enum ovl_op_flags): Add OVL_OP_FLAG_AMBIARY. (enum ovl_op_code): New. (struct ovl_op_info): Add ovl_op_code field. (ovl_op_info): Size by OVL_OP_MAX. (ovl_op_mapping, ovl_op_alternate): Declare. (OVL_OP_INFO): Adjust for mapping array. (IDENTIFIER_OVL_OP_INFO): New. * decl.c (ambi_op_p, unary_op_p): Delete. (grok_op_properties): Use IDENTIFIER_OVL_OP_INFO and ovl_op_alternate. * lex.c (ovl_op_info): Adjust and static initialize. (ovl_op_mappings, ovl_op_alternate): Define. (init_operators): Iterate over ovl_op_info array and init mappings & alternate arrays. * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_INFO. * operators.def (DEF_OPERATOR): Remove KIND parm. (DEF_SIMPLE_OPERATOR): Delete. (OPERATOR_TRANSITION): Expand if defined. From-SVN: r254310
Diffstat (limited to 'gcc/cp/mangle.c')
-rw-r--r--gcc/cp/mangle.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 7feb889..27530f9 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1265,30 +1265,8 @@ write_unqualified_id (tree identifier)
write_conversion_operator_name (TREE_TYPE (identifier));
else if (IDENTIFIER_ANY_OP_P (identifier))
{
- const char *mangled_name = NULL;
- bool assop = IDENTIFIER_ASSIGN_OP_P (identifier);
-
- /* Unfortunately, there is no easy way to go from the
- name of the operator back to the corresponding tree
- code. */
- for (unsigned i = 0; i < MAX_TREE_CODES; ++i)
- {
- const ovl_op_info_t *ovl_op = OVL_OP_INFO (assop, i);
-
- if (ovl_op->identifier == identifier)
- {
- /* The ABI says that we prefer binary operator
- names to unary operator names. */
- if (ovl_op->flags == OVL_OP_FLAG_BINARY)
- {
- mangled_name = ovl_op->mangled_name;
- break;
- }
- else if (!mangled_name)
- mangled_name = ovl_op->mangled_name;
- }
- }
- write_string (mangled_name);
+ const ovl_op_info_t *ovl_op = IDENTIFIER_OVL_OP_INFO (identifier);
+ write_string (ovl_op->mangled_name);
}
else if (UDLIT_OPER_P (identifier))
write_literal_operator_name (identifier);