aboutsummaryrefslogtreecommitdiff
path: root/gdb/rust-exp.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-01-23 12:48:38 -0700
committerTom Tromey <tom@tromey.com>2022-01-23 12:52:44 -0700
commitf10522c0e74e26dee201aedd2582a72d0b876e3e (patch)
tree3532af71c0cbd5d9f744f42921bf4e59ee6505b1 /gdb/rust-exp.h
parent451c003d5fcebbc7b7bc2516d43aede6d02bd501 (diff)
downloadfsf-binutils-gdb-f10522c0e74e26dee201aedd2582a72d0b876e3e.zip
fsf-binutils-gdb-f10522c0e74e26dee201aedd2582a72d0b876e3e.tar.gz
fsf-binutils-gdb-f10522c0e74e26dee201aedd2582a72d0b876e3e.tar.bz2
Simplify some Rust expression-evaluation code
A few Rust operations do a bit of work in their 'evaluate' functions and then call another function -- but are also the only caller. This patch simplifies this code by removing the extra layer. Tested on x86-64 Fedora 34. I'm checking this in.
Diffstat (limited to 'gdb/rust-exp.h')
-rw-r--r--gdb/rust-exp.h39
1 files changed, 3 insertions, 36 deletions
diff --git a/gdb/rust-exp.h b/gdb/rust-exp.h
index 28c28a8..6a24f2c 100644
--- a/gdb/rust-exp.h
+++ b/gdb/rust-exp.h
@@ -33,11 +33,6 @@ 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);
extern struct value *rust_subscript (struct type *expect_type,
struct expression *exp,
enum noside noside, bool for_addr,
@@ -46,16 +41,6 @@ extern struct value *rust_range (struct type *expect_type,
struct expression *exp,
enum noside noside, enum range_flag kind,
struct value *low, struct value *high);
-extern struct value *eval_op_rust_struct_anon (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- int field_number,
- struct value *lhs);
-extern struct value *eval_op_rust_structop (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- struct value *lhs,
- const char *field_name);
namespace expr
{
@@ -75,14 +60,7 @@ public:
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);
- }
+ enum noside noside) override;
};
/* Subscript operator for Rust. */
@@ -174,13 +152,7 @@ public:
value *evaluate (struct type *expect_type,
struct expression *exp,
- enum noside noside) override
- {
- value *lhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
- return eval_op_rust_struct_anon (expect_type, exp, noside,
- std::get<0> (m_storage), lhs);
-
- }
+ enum noside noside) override;
enum exp_opcode opcode () const override
{ return STRUCTOP_ANONYMOUS; }
@@ -196,12 +168,7 @@ public:
value *evaluate (struct type *expect_type,
struct expression *exp,
- enum noside noside) override
- {
- value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
- return eval_op_rust_structop (expect_type, exp, noside, lhs,
- std::get<1> (m_storage).c_str ());
- }
+ enum noside noside) override;
value *evaluate_funcall (struct type *expect_type,
struct expression *exp,