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:28 -0700 |
commit | 5019124b1ddc3839bd8ccba08819b11c0151e8a9 (patch) | |
tree | e83820e9ee3c77bdff1892dfbc7b2664c26d0df6 /gdb/expop.h | |
parent | 2bc9b40ce16a109a22320589d2cfb9fced5fb769 (diff) | |
download | gdb-5019124b1ddc3839bd8ccba08819b11c0151e8a9.zip gdb-5019124b1ddc3839bd8ccba08819b11c0151e8a9.tar.gz gdb-5019124b1ddc3839bd8ccba08819b11c0151e8a9.tar.bz2 |
Implement the "&&" and "||" operators
This implements the "&&" and "||" operators.
gdb/ChangeLog
2021-03-08 Tom Tromey <tom@tromey.com>
* expop.h (class logical_and_operation)
(class logical_or_operation): New.
* eval.c (logical_and_operation::evaluate)
(logical_or_operation::evaluate): New methods.
* ax-gdb.c (logical_and_operation::do_generate_ax)
(logical_or_operation::do_generate_ax): New methods.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r-- | gdb/expop.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gdb/expop.h b/gdb/expop.h index 6b1a875..7850c45 100644 --- a/gdb/expop.h +++ b/gdb/expop.h @@ -1982,6 +1982,54 @@ public: { return MULTI_SUBSCRIPT; } }; +/* The "&&" operator. */ +class logical_and_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; + + enum exp_opcode opcode () const override + { return BINOP_LOGICAL_AND; } + +protected: + + void do_generate_ax (struct expression *exp, + struct agent_expr *ax, + struct axs_value *value, + struct type *cast_type) + override; +}; + +/* The "||" operator. */ +class logical_or_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; + + enum exp_opcode opcode () const override + { return BINOP_LOGICAL_OR; } + +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 */ |