aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-08 07:27:57 -0700
committerTom Tromey <tom@tromey.com>2021-03-08 07:27:59 -0700
commit5c2f201e8d6cd3e4d9526d9d2833fa0cbaa93e67 (patch)
tree82ff34ccca543896f1c777bbd311bdf5e94d2fb8 /gdb
parentf871bae1ae5fba3dfbc31e1a6136b6c5ab6a6291 (diff)
downloadgdb-5c2f201e8d6cd3e4d9526d9d2833fa0cbaa93e67.zip
gdb-5c2f201e8d6cd3e4d9526d9d2833fa0cbaa93e67.tar.gz
gdb-5c2f201e8d6cd3e4d9526d9d2833fa0cbaa93e67.tar.bz2
Split out eval_op_concat
This splits BINOP_CONCAT into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * eval.c (eval_op_concat): New function. (evaluate_subexp_standard): Use it.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/eval.c22
2 files changed, 21 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fa52286..7211862 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2021-03-08 Tom Tromey <tom@tromey.com>
+ * eval.c (eval_op_concat): New function.
+ (evaluate_subexp_standard): Use it.
+
+2021-03-08 Tom Tromey <tom@tromey.com>
+
* eval.c (eval_op_objc_selector): New function.
(evaluate_subexp_standard): Use it.
diff --git a/gdb/eval.c b/gdb/eval.c
index b943783..3fc4422 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1309,6 +1309,21 @@ eval_op_objc_selector (struct type *expect_type, struct expression *exp,
lookup_child_selector (exp->gdbarch, sel));
}
+/* Helper function that implements the body of BINOP_CONCAT. */
+
+static struct value *
+eval_op_concat (struct type *expect_type, struct expression *exp,
+ enum noside noside,
+ enum exp_opcode op, struct value *arg1, struct value *arg2)
+{
+ if (noside == EVAL_SKIP)
+ return eval_skip_value (exp);
+ if (binop_user_defined_p (op, arg1, arg2))
+ return value_x_binop (arg1, arg2, op, OP_NULL, noside);
+ else
+ return value_concat (arg1, arg2);
+}
+
struct value *
evaluate_subexp_standard (struct type *expect_type,
struct expression *exp, int *pos,
@@ -2026,12 +2041,7 @@ evaluate_subexp_standard (struct type *expect_type,
case BINOP_CONCAT:
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
- if (noside == EVAL_SKIP)
- return eval_skip_value (exp);
- if (binop_user_defined_p (op, arg1, arg2))
- return value_x_binop (arg1, arg2, op, OP_NULL, noside);
- else
- return value_concat (arg1, arg2);
+ return eval_op_concat (expect_type, exp, noside, op, arg1, arg2);
case BINOP_ASSIGN:
arg1 = evaluate_subexp (nullptr, exp, pos, noside);