aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-09-18 10:25:13 -0600
committerTom Tromey <tromey@adacore.com>2024-10-01 13:25:25 -0600
commit1ce23123912f1d6311e00643729233bbd28b9470 (patch)
treec42e82af599d793ee7eb9b51431ba235c18ea6e8 /gdb/ada-lang.c
parentc5c85987434f5faee54d05547a47ab7748d1eb0f (diff)
downloadbinutils-1ce23123912f1d6311e00643729233bbd28b9470.zip
binutils-1ce23123912f1d6311e00643729233bbd28b9470.tar.gz
binutils-1ce23123912f1d6311e00643729233bbd28b9470.tar.bz2
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 <keiths@redhat.com>
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c2
1 files changed, 1 insertions, 1 deletions
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);