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:22 -0700 |
commit | 14aff815df1efbbc573df75b7fc65017e9399c84 (patch) | |
tree | 951721757086aaeb65f51f802ebe4b64b7d1248b /gdb/expop.h | |
parent | 929f3aa7425dde2626bdf5b23277aee62ec75129 (diff) | |
download | gdb-14aff815df1efbbc573df75b7fc65017e9399c84.zip gdb-14aff815df1efbbc573df75b7fc65017e9399c84.tar.gz gdb-14aff815df1efbbc573df75b7fc65017e9399c84.tar.bz2 |
Introduce unop_addr_operation
This adds class unop_addr_operation, which implements UNOP_ADDR.
gdb/ChangeLog
2021-03-08 Tom Tromey <tom@tromey.com>
* expop.h (class unop_addr_operation): New.
* ax-gdb.c (gen_expr_unop) <case UNOP_ADDR>: New.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r-- | gdb/expop.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gdb/expop.h b/gdb/expop.h index 804f516..a09be96 100644 --- a/gdb/expop.h +++ b/gdb/expop.h @@ -1546,6 +1546,42 @@ public: { return OP_TYPEID; } }; +/* Implement the address-of operation. */ +class unop_addr_operation + : public maybe_constant_operation<operation_up> +{ +public: + + using maybe_constant_operation::maybe_constant_operation; + + value *evaluate (struct type *expect_type, + struct expression *exp, + enum noside noside) override + { + /* C++: check for and handle pointer to members. */ + if (noside == EVAL_SKIP) + return eval_skip_value (exp); + else + return std::get<0> (m_storage)->evaluate_for_address (exp, noside); + } + + enum exp_opcode opcode () const override + { return UNOP_ADDR; } + +protected: + + void do_generate_ax (struct expression *exp, + struct agent_expr *ax, + struct axs_value *value, + struct type *cast_type) + override + { + gen_expr_unop (exp, UNOP_ADDR, + std::get<0> (this->m_storage).get (), + ax, value); + } +}; + } /* namespace expr */ #endif /* EXPOP_H */ |