Introduce objc_selector_operation

This adds class objc_selector_operation, which implements
OP_OBJC_SELECTOR.

gdb/ChangeLog
2021-03-08  Tom Tromey  <tom@tromey.com>

	* eval.c (eval_op_objc_selector): No longer static.
	* c-exp.h (class objc_selector_operation): New.
This commit is contained in:
Tom Tromey
2021-03-08 07:27:57 -07:00
parent 06dc61b9df
commit 09db370026
3 changed files with 31 additions and 1 deletions

View File

@@ -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<std::string>
{
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 */