mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-02 23:04:09 +08:00
Introduce complex_operation
This adds class complex_operation, which implements OP_COMPLEX. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class complex_operation): New.
This commit is contained in:
parent
09db370026
commit
8cfd3e95b7
@ -1,3 +1,7 @@
|
||||
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* expop.h (class complex_operation): New.
|
||||
|
||||
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* eval.c (eval_op_objc_selector): No longer static.
|
||||
|
21
gdb/expop.h
21
gdb/expop.h
@ -765,6 +765,27 @@ protected:
|
||||
override;
|
||||
};
|
||||
|
||||
class complex_operation
|
||||
: public maybe_constant_operation<operation_up, operation_up, struct type *>
|
||||
{
|
||||
public:
|
||||
|
||||
using maybe_constant_operation::maybe_constant_operation;
|
||||
|
||||
value *evaluate (struct type *expect_type,
|
||||
struct expression *exp,
|
||||
enum noside noside) override
|
||||
{
|
||||
value *real = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
|
||||
value *imag = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
|
||||
return value_literal_complex (real, imag,
|
||||
std::get<2> (m_storage));
|
||||
}
|
||||
|
||||
enum exp_opcode opcode () const override
|
||||
{ return OP_COMPLEX; }
|
||||
};
|
||||
|
||||
} /* namespace expr */
|
||||
|
||||
#endif /* EXPOP_H */
|
||||
|
Loading…
Reference in New Issue
Block a user