summaryrefslogtreecommitdiff
path: root/gdb/expop.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-08 07:27:57 -0700
committerTom Tromey <tom@tromey.com>2021-03-08 07:28:23 -0700
commitf6b4232691d79a9e4b54934529f4b34081d79d94 (patch)
tree1e14c60f34970a1c8b8dc04c19ec60622a91bf64 /gdb/expop.h
parentcbc18219d313984150f25af6cc66c866e1686190 (diff)
downloadbinutils-gdb-f6b4232691d79a9e4b54934529f4b34081d79d94.tar.gz
Introduce op_this_operation
This adds class op_this_operation, which implements OP_THIS. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class op_this_operation): New. * ax-gdb.c (op_this_operation::do_generate_ax): New method.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r--gdb/expop.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/gdb/expop.h b/gdb/expop.h
index b808c0f63bc..7c0768ca6c1 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -1713,6 +1713,33 @@ protected:
override;
};
+/* Implement the 'this' expression. */
+class op_this_operation
+ : public tuple_holding_operation<>
+{
+public:
+
+ using tuple_holding_operation::tuple_holding_operation;
+
+ value *evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside) override
+ {
+ return value_of_this (exp->language_defn);
+ }
+
+ enum exp_opcode opcode () const override
+ { return OP_THIS; }
+
+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 */