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:20 -0700 |
commit | ae64ba58b3bc5a9a023974f37515aee9862548fd (patch) | |
tree | 1e3490af3e496eaae203886c75a69649ac9bf3d5 /gdb/expop.h | |
parent | d4eff4c122e06e913452e2039e29e8db6b15b1dd (diff) | |
download | gdb-ae64ba58b3bc5a9a023974f37515aee9862548fd.zip gdb-ae64ba58b3bc5a9a023974f37515aee9862548fd.tar.gz gdb-ae64ba58b3bc5a9a023974f37515aee9862548fd.tar.bz2 |
Introduce comma_operation
This adds class comma_operation, which implements BINOP_COMMA.
gdb/ChangeLog
2021-03-08 Tom Tromey <tom@tromey.com>
* ax-gdb.c (comma_operation::do_generate_ax): New method.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r-- | gdb/expop.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gdb/expop.h b/gdb/expop.h index 4bf32f5..2fa5b2f 100644 --- a/gdb/expop.h +++ b/gdb/expop.h @@ -1208,6 +1208,37 @@ protected: override; }; +/* C-style comma operator. */ +class comma_operation + : public maybe_constant_operation<operation_up, operation_up> +{ +public: + + using maybe_constant_operation::maybe_constant_operation; + + value *evaluate (struct type *expect_type, + struct expression *exp, + enum noside noside) override + { + /* The left-hand-side is only evaluated for side effects, so don't + bother in other modes. */ + if (noside == EVAL_NORMAL) + std::get<0> (m_storage)->evaluate (nullptr, exp, noside); + return std::get<1> (m_storage)->evaluate (nullptr, exp, noside); + } + + enum exp_opcode opcode () const override + { return BINOP_COMMA; } + +protected: + + void do_generate_ax (struct expression *exp, + struct agent_expr *ax, + struct axs_value *value, + struct type *cast_type) + override; +}; + } /* namespace expr */ #endif /* EXPOP_H */ |