diff options
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/expop.h | 21 |
2 files changed, 25 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9297e8f..cd7ec19 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 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. * c-exp.h (class objc_selector_operation): New. diff --git a/gdb/expop.h b/gdb/expop.h index 0f5b504..9c63f12 100644 --- a/gdb/expop.h +++ b/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 */ |