aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2025-03-09 15:30:45 -0600
committerTom Tromey <tom@tromey.com>2025-03-10 13:23:57 -0600
commiteb39f6d01e7c74389e71a864f382a2f0d3560cfd (patch)
treeaa80cfde56a3a94ea797ebaa492a7dad40a6d90c /gdb/eval.c
parentcc0fdf9861088cda915dc4a5b60132f67ef3d8db (diff)
downloadbinutils-eb39f6d01e7c74389e71a864f382a2f0d3560cfd.zip
binutils-eb39f6d01e7c74389e71a864f382a2f0d3560cfd.tar.gz
binutils-eb39f6d01e7c74389e71a864f382a2f0d3560cfd.tar.bz2
Remove eval_op_scope
eval_op_scope is very similar to scope_operation::evaluate_for_address. This patch combines the two into a single method of scope_operation. Regression tested on x86-64 Fedora 40. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 457a436..63961cc 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1071,20 +1071,6 @@ is_integral_or_integral_reference (struct type *type)
&& is_integral_type (type->target_type ()));
}
-/* Helper function that implements the body of OP_SCOPE. */
-
-struct value *
-eval_op_scope (struct type *expect_type, struct expression *exp,
- enum noside noside,
- struct type *type, const char *string)
-{
- struct value *arg1 = value_aggregate_elt (type, string, expect_type,
- 0, noside);
- if (arg1 == NULL)
- error (_("There is no field named %s"), string);
- return arg1;
-}
-
/* Helper function that implements the body of OP_VAR_ENTRY_VALUE. */
struct value *
@@ -2615,14 +2601,16 @@ operation::evaluate_for_address (struct expression *exp, enum noside noside)
}
value *
-scope_operation::evaluate_for_address (struct expression *exp,
- enum noside noside)
-{
- value *x = value_aggregate_elt (std::get<0> (m_storage),
- std::get<1> (m_storage).c_str (),
- NULL, 1, noside);
- if (x == NULL)
- error (_("There is no field named %s"), std::get<1> (m_storage).c_str ());
+scope_operation::evaluate_internal (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside,
+ bool want_address)
+{
+ const char *string = std::get<1> (m_storage).c_str ();
+ value *x = value_aggregate_elt (std::get<0> (m_storage), string,
+ expect_type, want_address, noside);
+ if (x == nullptr)
+ error (_("There is no field named %s"), string);
return x;
}