aboutsummaryrefslogtreecommitdiff
path: root/gdb/rust-exp.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:27 -0700
commit11dd3dce4427792a89a851b8ed290b3c8124f282 (patch)
tree0f1ad5bed3c9bb0d431254120da71bbb62608b6c /gdb/rust-exp.h
parent6fab435953629ec50e2c367a0fbe305e4e5abf3f (diff)
downloadgdb-11dd3dce4427792a89a851b8ed290b3c8124f282.zip
gdb-11dd3dce4427792a89a851b8ed290b3c8124f282.tar.gz
gdb-11dd3dce4427792a89a851b8ed290b3c8124f282.tar.bz2
Introduce rust_unop_ind_operation
This adds class rust_unop_ind_operation, which implements UNOP_IND for Rust. Rust requires a special case here to handle trait objects. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * rust-lang.c (eval_op_rust_ind): No longer static. Add "opcode" parameter. (rust_evaluate_subexp): Update. * rust-exp.h (class rust_unop_ind_operation): New.
Diffstat (limited to 'gdb/rust-exp.h')
-rw-r--r--gdb/rust-exp.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/gdb/rust-exp.h b/gdb/rust-exp.h
index cce1fd9..d16f921 100644
--- a/gdb/rust-exp.h
+++ b/gdb/rust-exp.h
@@ -33,6 +33,11 @@ extern struct value *eval_op_rust_array (struct type *expect_type,
enum exp_opcode opcode,
struct value *ncopies,
struct value *elt);
+extern struct value *eval_op_rust_ind (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside,
+ enum exp_opcode opcode,
+ struct value *value);
namespace expr
{
@@ -42,6 +47,26 @@ using rust_unop_compl_operation = unop_operation<UNOP_COMPLEMENT,
using rust_array_operation = binop_operation<OP_RUST_ARRAY,
eval_op_rust_array>;
+/* The Rust indirection operation. */
+class rust_unop_ind_operation
+ : public unop_ind_operation
+{
+public:
+
+ using unop_ind_operation::unop_ind_operation;
+
+ value *evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside) override
+ {
+ if (noside != EVAL_NORMAL)
+ return unop_ind_operation::evaluate (expect_type, exp, noside);
+
+ value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+ return eval_op_rust_ind (expect_type, exp, noside, UNOP_IND, arg1);
+ }
+};
+
} /* namespace expr */
#endif /* RUST_EXP_H */