diff options
author | Tom Tromey <tom@tromey.com> | 2021-03-08 07:27:57 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-03-08 07:28:16 -0700 |
commit | e6985c5e45ef0693005e21a25d847baf0f93c965 (patch) | |
tree | 6df4cff2af3d8fe82c77d4ab587f03ca9a89b8d1 /gdb/expop.h | |
parent | 55bdbff857f80da9e3464968f1ada2be3484fcf9 (diff) | |
download | gdb-e6985c5e45ef0693005e21a25d847baf0f93c965.zip gdb-e6985c5e45ef0693005e21a25d847baf0f93c965.tar.gz gdb-e6985c5e45ef0693005e21a25d847baf0f93c965.tar.bz2 |
Introduce bool_operation
This adds class bool_operation, which implements OP_BOOL.
gdb/ChangeLog
2021-03-08 Tom Tromey <tom@tromey.com>
* expop.h (class bool_operation): New.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r-- | gdb/expop.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gdb/expop.h b/gdb/expop.h index a0e0030..44098b8 100644 --- a/gdb/expop.h +++ b/gdb/expop.h @@ -627,6 +627,28 @@ protected: override; }; +class bool_operation + : public tuple_holding_operation<bool> +{ +public: + + using tuple_holding_operation::tuple_holding_operation; + + value *evaluate (struct type *expect_type, + struct expression *exp, + enum noside noside) override + { + struct type *type = language_bool_type (exp->language_defn, exp->gdbarch); + return value_from_longest (type, std::get<0> (m_storage)); + } + + enum exp_opcode opcode () const override + { return OP_BOOL; } + + bool constant_p () const override + { return true; } +}; + } /* namespace expr */ #endif /* EXPOP_H */ |