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:21 -0700 |
commit | 5b5f5140e1c37f899bf426ea7031548f4bd7e4ca (patch) | |
tree | 4634b027f3aad5319468821c788d38dc040f345f /gdb/expop.h | |
parent | 876469ffa1f52b15dfbc8336b31b908edf95fba6 (diff) | |
download | gdb-5b5f5140e1c37f899bf426ea7031548f4bd7e4ca.zip gdb-5b5f5140e1c37f899bf426ea7031548f4bd7e4ca.tar.gz gdb-5b5f5140e1c37f899bf426ea7031548f4bd7e4ca.tar.bz2 |
Introduce type_operation
This adds class type_operation, which implements OP_TYPE.
gdb/ChangeLog
2021-03-08 Tom Tromey <tom@tromey.com>
* expop.h (class type_operation): New.
* eval.c (eval_op_type): No longer static.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r-- | gdb/expop.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gdb/expop.h b/gdb/expop.h index 4b1d65a..8b7bfbe 100644 --- a/gdb/expop.h +++ b/gdb/expop.h @@ -186,6 +186,9 @@ extern struct value *eval_op_ind (struct type *expect_type, struct expression *exp, enum noside noside, struct value *arg1); +extern struct value *eval_op_type (struct type *expect_type, + struct expression *exp, + enum noside noside, struct type *type); namespace expr { @@ -1420,6 +1423,28 @@ protected: } }; +/* Implement OP_TYPE. */ +class type_operation + : public tuple_holding_operation<struct type *> +{ +public: + + using tuple_holding_operation::tuple_holding_operation; + + value *evaluate (struct type *expect_type, + struct expression *exp, + enum noside noside) override + { + return eval_op_type (expect_type, exp, noside, std::get<0> (m_storage)); + } + + enum exp_opcode opcode () const override + { return OP_TYPE; } + + bool constant_p () const override + { return true; } +}; + } /* namespace expr */ #endif /* EXPOP_H */ |