aboutsummaryrefslogtreecommitdiff
path: root/gdb
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:10 -0700
commit020dbabe22262ee118c29c768d7b9d66b1c65e67 (patch)
tree34c023822507be434cd0f86bd9dda2f1382a9d54 /gdb
parent7efc87ffcb6cf97592821741a48c373d7e82eb0b (diff)
downloadgdb-020dbabe22262ee118c29c768d7b9d66b1c65e67.zip
gdb-020dbabe22262ee118c29c768d7b9d66b1c65e67.tar.gz
gdb-020dbabe22262ee118c29c768d7b9d66b1c65e67.tar.bz2
Split out ada_atr_tag
This splits OP_ATR_TAG into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_atr_tag): New function. (ada_evaluate_subexp): Use it.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/ada-lang.c20
2 files changed, 20 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d81a876..0afbe4f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2021-03-08 Tom Tromey <tom@tromey.com>
+ * ada-lang.c (ada_atr_tag): New function.
+ (ada_evaluate_subexp): Use it.
+
+2021-03-08 Tom Tromey <tom@tromey.com>
+
* ada-lang.c (ada_unop_in_range): New function.
(ada_evaluate_subexp): Use it.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index ac080fe..a1d990c 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -10011,6 +10011,20 @@ ada_unop_in_range (struct type *expect_type,
}
}
+/* A helper function for OP_ATR_TAG. */
+
+static value *
+ada_atr_tag (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside, enum exp_opcode op,
+ struct value *arg1)
+{
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value_zero (ada_tag_type (arg1), not_lval);
+
+ return ada_value_tag (arg1);
+}
+
/* Implement the evaluate_exp routine in the exp_descriptor structure
for the Ada language. */
@@ -10741,11 +10755,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
-
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (ada_tag_type (arg1), not_lval);
-
- return ada_value_tag (arg1);
+ return ada_atr_tag (expect_type, exp, noside, op, arg1);
case OP_ATR_MIN:
case OP_ATR_MAX: