[PATCH 060/203] Split out ada_atr_tag

Tom Tromey tom@tromey.com
Fri Jan 1 21:45:00 GMT 2021


This splits OP_ATR_TAG into a new function for future use.

gdb/ChangeLog
2021-01-01  Tom Tromey  <tom@tromey.com>

	* ada-lang.c (ada_atr_tag): New function.
	(ada_evaluate_subexp): Use it.
---
 gdb/ChangeLog  |  5 +++++
 gdb/ada-lang.c | 20 +++++++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 22ea6346088..88d1198acf6 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -10162,6 +10162,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.  */
 
@@ -10896,11 +10910,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:
-- 
2.26.2



More information about the Gdb-patches mailing list