diff options
author | Tom Tromey <tromey@adacore.com> | 2023-08-29 10:51:33 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-08-31 10:56:07 -0600 |
commit | 4bea97df59d505e1e74876b94cd3f99a42f742d9 (patch) | |
tree | 3384ba06b8af21bbcd0d7dabbacbe0dc575d8a84 /gdb/eval.c | |
parent | 79771b88bf22d7b4499363ba8a2dbd6a534deb98 (diff) | |
download | gdb-4bea97df59d505e1e74876b94cd3f99a42f742d9.zip gdb-4bea97df59d505e1e74876b94cd3f99a42f742d9.tar.gz gdb-4bea97df59d505e1e74876b94cd3f99a42f742d9.tar.bz2 |
Remove eval_op_ternop
eval_op_ternop is only used by the implementation of
ternop_slice_operation. While working on another series, it was
convenient for me to merge this function into its only caller.
Reviewed-by: Kevin Buettner <kevinb@redhat.com>
Diffstat (limited to 'gdb/eval.c')
-rw-r--r-- | gdb/eval.c | 29 |
1 files changed, 17 insertions, 12 deletions
@@ -1155,6 +1155,23 @@ string_operation::evaluate (struct type *expect_type, return value_string (str.c_str (), str.size (), type); } +struct value * +ternop_slice_operation::evaluate (struct type *expect_type, + struct expression *exp, + enum noside noside) +{ + struct value *array + = std::get<0> (m_storage)->evaluate (nullptr, exp, noside); + struct value *low + = std::get<1> (m_storage)->evaluate (nullptr, exp, noside); + struct value *upper + = std::get<2> (m_storage)->evaluate (nullptr, exp, noside); + + int lowbound = value_as_long (low); + int upperbound = value_as_long (upper); + return value_slice (array, lowbound, upperbound - lowbound + 1); +} + } /* namespace expr */ /* Helper function that implements the body of OP_OBJC_SELECTOR. */ @@ -1169,18 +1186,6 @@ eval_op_objc_selector (struct type *expect_type, struct expression *exp, lookup_child_selector (exp->gdbarch, sel)); } -/* A helper function for TERNOP_SLICE. */ - -struct value * -eval_op_ternop (struct type *expect_type, struct expression *exp, - enum noside noside, - struct value *array, struct value *low, struct value *upper) -{ - int lowbound = value_as_long (low); - int upperbound = value_as_long (upper); - return value_slice (array, lowbound, upperbound - lowbound + 1); -} - /* A helper function for STRUCTOP_STRUCT. */ struct value * |