aboutsummaryrefslogtreecommitdiff
path: root/gdb/expop.h
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:28:19 -0700
commite51e26a090053f8f8354692fff6dce20ed2e47ba (patch)
tree9f703afaf461c5eaa05838e8e4b0b3843f89c09f /gdb/expop.h
parent07f724a8c604cdfa1639f757e577dd6eb9caed25 (diff)
downloadgdb-e51e26a090053f8f8354692fff6dce20ed2e47ba.zip
gdb-e51e26a090053f8f8354692fff6dce20ed2e47ba.tar.gz
gdb-e51e26a090053f8f8354692fff6dce20ed2e47ba.tar.bz2
Introduce concat_operation
This adds class concat_operation, which implements BINOP_CONCAT. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class concat_operation): New. * eval.c (eval_op_concat): No longer static. Remove "op" parameter. (evaluate_subexp_standard): Update.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r--gdb/expop.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/gdb/expop.h b/gdb/expop.h
index cbd4d62..16ee30d 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -84,6 +84,10 @@ extern struct value *eval_op_member (struct type *expect_type,
struct expression *exp,
enum noside noside,
struct value *arg1, struct value *arg2);
+extern struct value *eval_op_concat (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside,
+ struct value *arg1, struct value *arg2);
namespace expr
{
@@ -935,6 +939,28 @@ public:
{ return STRUCTOP_MPTR; }
};
+class concat_operation
+ : public maybe_constant_operation<operation_up, operation_up>
+{
+public:
+
+ using maybe_constant_operation::maybe_constant_operation;
+
+ value *evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside) override
+ {
+ value *lhs
+ = std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
+ value *rhs
+ = std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
+ return eval_op_concat (expect_type, exp, noside, lhs, rhs);
+ }
+
+ enum exp_opcode opcode () const override
+ { return BINOP_CONCAT; }
+};
+
} /* namespace expr */
#endif /* EXPOP_H */