Introduce long_const_operation
This adds class long_const_operation, which holds a scalar constant. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class long_const_operation): New. * ax-gdb.c (long_const_operation::do_generate_ax): New method.
This commit is contained in:
parent
d5ab122c48
commit
d336c29e3f
@ -1,3 +1,8 @@
|
|||||||
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* expop.h (class long_const_operation): New.
|
||||||
|
* ax-gdb.c (long_const_operation::do_generate_ax): New method.
|
||||||
|
|
||||||
2021-03-08 Tom Tromey <tom@tromey.com>
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* expop.h (class scope_operation): New.
|
* expop.h (class scope_operation): New.
|
||||||
|
10
gdb/ax-gdb.c
10
gdb/ax-gdb.c
@ -2314,6 +2314,16 @@ scope_operation::do_generate_ax (struct expression *exp,
|
|||||||
error (_("There is no field named %s"), name.c_str ());
|
error (_("There is no field named %s"), name.c_str ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
long_const_operation::do_generate_ax (struct expression *exp,
|
||||||
|
struct agent_expr *ax,
|
||||||
|
struct axs_value *value,
|
||||||
|
struct type *cast_type)
|
||||||
|
{
|
||||||
|
gen_int_literal (ax, value, std::get<1> (m_storage),
|
||||||
|
std::get<0> (m_storage));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This handles the middle-to-right-side of code generation for binary
|
/* This handles the middle-to-right-side of code generation for binary
|
||||||
|
30
gdb/expop.h
30
gdb/expop.h
@ -451,6 +451,36 @@ protected:
|
|||||||
override;
|
override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class long_const_operation
|
||||||
|
: public tuple_holding_operation<struct type *, LONGEST>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
using tuple_holding_operation::tuple_holding_operation;
|
||||||
|
|
||||||
|
value *evaluate (struct type *expect_type,
|
||||||
|
struct expression *exp,
|
||||||
|
enum noside noside) override
|
||||||
|
{
|
||||||
|
return value_from_longest (std::get<0> (m_storage),
|
||||||
|
std::get<1> (m_storage));
|
||||||
|
}
|
||||||
|
|
||||||
|
enum exp_opcode opcode () const override
|
||||||
|
{ return OP_LONG; }
|
||||||
|
|
||||||
|
bool constant_p () const override
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void do_generate_ax (struct expression *exp,
|
||||||
|
struct agent_expr *ax,
|
||||||
|
struct axs_value *value,
|
||||||
|
struct type *cast_type)
|
||||||
|
override;
|
||||||
|
};
|
||||||
|
|
||||||
} /* namespace expr */
|
} /* namespace expr */
|
||||||
|
|
||||||
#endif /* EXPOP_H */
|
#endif /* EXPOP_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user