From 1ce23123912f1d6311e00643729233bbd28b9470 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 18 Sep 2024 10:25:13 -0600 Subject: Introduce and use operation::type_p There's currently code in gdb that checks if an expression evaluates to a type. In some spots this is done by comparing the opcode against OP_TYPE, but other spots more correctly also compare with OP_TYPEOF and OP_DECLTYPE. This patch cleans up this area, replacing opcode-checking with a new method on 'operation'. Generally, checking the opcode should be considered deprecated, although it's unfortunately difficult to get rid of opcodes entirely. I also took advantage of this change to turn eval_op_type into a method, removing a bit of indirection. Reviewed-by: Keith Seitz --- gdb/ada-lang.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/ada-lang.c') diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 9b61f19..2ea7fd2 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -10772,7 +10772,7 @@ ada_unop_atr_operation::evaluate (struct type *expect_type, struct type *type_arg = nullptr; value *val = nullptr; - if (std::get<0> (m_storage)->opcode () == OP_TYPE) + if (std::get<0> (m_storage)->type_p ()) { value *tem = std::get<0> (m_storage)->evaluate (nullptr, exp, EVAL_AVOID_SIDE_EFFECTS); -- cgit v1.1