aboutsummaryrefslogtreecommitdiff
path: root/gdb/expop.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-08 07:27:57 -0700
committerTom Tromey <tom@tromey.com>2021-03-08 07:28:18 -0700
commit8cfd3e95b7624785a47e08b430d49b3d0329a0ee (patch)
treeb67a39b8a602824a4cdc420c141fc897d75cb4f3 /gdb/expop.h
parent09db3700263c5e614768126d000b55e5df28f460 (diff)
downloadgdb-8cfd3e95b7624785a47e08b430d49b3d0329a0ee.zip
gdb-8cfd3e95b7624785a47e08b430d49b3d0329a0ee.tar.gz
gdb-8cfd3e95b7624785a47e08b430d49b3d0329a0ee.tar.bz2
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.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r--gdb/expop.h21
1 files changed, 21 insertions, 0 deletions
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 */