Introduce multi_subscript_operation
This adds class multi_subscript_operation, which implements MULTI_SUBSCRIPT. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class multi_subscript_operation): New. * eval.c (multi_subscript_operation::evaluate): New method.
This commit is contained in:
parent
085734dd95
commit
821e72d775
@ -1,3 +1,8 @@
|
||||
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* expop.h (class multi_subscript_operation): New.
|
||||
* eval.c (multi_subscript_operation::evaluate): New method.
|
||||
|
||||
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* eval.c (objc_msgcall_operation::evaluate): New method.
|
||||
|
13
gdb/eval.c
13
gdb/eval.c
@ -2472,8 +2472,21 @@ objc_msgcall_operation::evaluate (struct type *expect_type,
|
||||
args.size () + 3));
|
||||
}
|
||||
|
||||
value *
|
||||
multi_subscript_operation::evaluate (struct type *expect_type,
|
||||
struct expression *exp,
|
||||
enum noside noside)
|
||||
{
|
||||
value *arg1 = std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
|
||||
std::vector<operation_up> &values = std::get<1> (m_storage);
|
||||
value **argvec = XALLOCAVEC (struct value *, values.size ());
|
||||
for (int ix = 0; ix < values.size (); ++ix)
|
||||
argvec[ix] = values[ix]->evaluate_with_coercion (exp, noside);
|
||||
return eval_multi_subscript (expect_type, exp, noside, arg1,
|
||||
gdb::make_array_view (argvec, values.size ()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct value *
|
||||
evaluate_subexp_standard (struct type *expect_type,
|
||||
|
16
gdb/expop.h
16
gdb/expop.h
@ -1966,6 +1966,22 @@ using dynamic_cast_operation = cxx_cast_operation<UNOP_DYNAMIC_CAST,
|
||||
using reinterpret_cast_operation = cxx_cast_operation<UNOP_REINTERPRET_CAST,
|
||||
value_reinterpret_cast>;
|
||||
|
||||
/* Multi-dimensional subscripting. */
|
||||
class multi_subscript_operation
|
||||
: public tuple_holding_operation<operation_up, std::vector<operation_up>>
|
||||
{
|
||||
public:
|
||||
|
||||
using tuple_holding_operation::tuple_holding_operation;
|
||||
|
||||
value *evaluate (struct type *expect_type,
|
||||
struct expression *exp,
|
||||
enum noside noside) override;
|
||||
|
||||
enum exp_opcode opcode () const override
|
||||
{ return MULTI_SUBSCRIPT; }
|
||||
};
|
||||
|
||||
} /* namespace expr */
|
||||
|
||||
#endif /* EXPOP_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user