aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-03-08 09:47:39 -0700
committerTom Tromey <tromey@adacore.com>2022-03-16 09:28:12 -0600
commit16b6c361546c74aa10287fb88cf0c47c536f9eb3 (patch)
tree76b56fa8a4d045e9d6c9040148c377ad7c4e1b42 /gdb/eval.c
parent879f2aae39e07aac6df72d8c6e25e2b6183fb0e6 (diff)
downloadgdb-16b6c361546c74aa10287fb88cf0c47c536f9eb3.zip
gdb-16b6c361546c74aa10287fb88cf0c47c536f9eb3.tar.gz
gdb-16b6c361546c74aa10287fb88cf0c47c536f9eb3.tar.bz2
Remove eval_op_string
eval_op_string is only used in a single place -- the implementation of string_operation. This patch turns it into the string_operation::evaluate method, removing a bit of extraneous code.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 6ced0b2..b7b8915 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1078,17 +1078,22 @@ eval_op_register (struct type *expect_type, struct expression *exp,
return val;
}
-/* Helper function that implements the body of OP_STRING. */
+namespace expr
+{
-struct value *
-eval_op_string (struct type *expect_type, struct expression *exp,
- enum noside noside, int len, const char *string)
+value *
+string_operation::evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside)
{
+ const std::string &str = std::get<0> (m_storage);
struct type *type = language_string_char_type (exp->language_defn,
exp->gdbarch);
- return value_string (string, len, type);
+ return value_string (str.c_str (), str.size (), type);
}
+} /* namespace expr */
+
/* Helper function that implements the body of OP_OBJC_SELECTOR. */
struct value *