From: Tom Tromey Date: Mon, 8 Mar 2021 14:27:57 +0000 (-0700) Subject: Introduce objc_selector_operation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=09db3700263c5e614768126d000b55e5df28f460;p=binutils-gdb.git Introduce objc_selector_operation This adds class objc_selector_operation, which implements OP_OBJC_SELECTOR. gdb/ChangeLog 2021-03-08 Tom Tromey * eval.c (eval_op_objc_selector): No longer static. * c-exp.h (class objc_selector_operation): New. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2b7afb1dd68..9297e8f6e8d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2021-03-08 Tom Tromey + + * eval.c (eval_op_objc_selector): No longer static. + * c-exp.h (class objc_selector_operation): New. + 2021-03-08 Tom Tromey * eval.c: Include c-exp.h. diff --git a/gdb/c-exp.h b/gdb/c-exp.h index a7b11b5a25d..dcb4557b2d5 100644 --- a/gdb/c-exp.h +++ b/gdb/c-exp.h @@ -23,6 +23,10 @@ #include "expop.h" #include "objc-lang.h" +extern struct value *eval_op_objc_selector (struct type *expect_type, + struct expression *exp, + enum noside noside, + const char *sel); namespace expr { @@ -63,6 +67,27 @@ public: { return OP_OBJC_NSSTRING; } }; +class objc_selector_operation + : public tuple_holding_operation +{ +public: + + using tuple_holding_operation::tuple_holding_operation; + + value *evaluate (struct type *expect_type, + struct expression *exp, + enum noside noside) override + { + if (noside == EVAL_SKIP) + return eval_skip_value (exp); + return eval_op_objc_selector (expect_type, exp, noside, + std::get<0> (m_storage).c_str ()); + } + + enum exp_opcode opcode () const override + { return OP_OBJC_SELECTOR; } +}; + }/* namespace expr */ #endif /* C_EXP_H */ diff --git a/gdb/eval.c b/gdb/eval.c index f1553dadbdb..3307c74aa63 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -1298,7 +1298,7 @@ eval_op_string (struct type *expect_type, struct expression *exp, /* Helper function that implements the body of OP_OBJC_SELECTOR. */ -static struct value * +struct value * eval_op_objc_selector (struct type *expect_type, struct expression *exp, enum noside noside, const char *sel)