[binutils-gdb] Introduce bool_operation
Tom Tromey
tromey@sourceware.org
Mon Mar 8 14:52:26 GMT 2021
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e6985c5e45ef0693005e21a25d847baf0f93c965
commit e6985c5e45ef0693005e21a25d847baf0f93c965
Author: Tom Tromey <tom@tromey.com>
Date: Mon Mar 8 07:27:57 2021 -0700
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.
Diff:
---
gdb/ChangeLog | 4 ++++
gdb/expop.h | 22 ++++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0633260cb5a..9acaee4c152 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2021-03-08 Tom Tromey <tom@tromey.com>
+
+ * expop.h (class bool_operation): New.
+
2021-03-08 Tom Tromey <tom@tromey.com>
* expop.h (class register_operation): New.
diff --git a/gdb/expop.h b/gdb/expop.h
index a0e00302532..44098b84761 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 */
More information about the Gdb-cvs
mailing list