From: Tom Tromey Date: Mon, 8 Mar 2021 14:27:57 +0000 (-0700) Subject: Split out ada_atr_tag X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=020dbabe22262ee118c29c768d7b9d66b1c65e67;p=binutils-gdb.git Split out ada_atr_tag This splits OP_ATR_TAG into a new function for future use. gdb/ChangeLog 2021-03-08 Tom Tromey * ada-lang.c (ada_atr_tag): New function. (ada_evaluate_subexp): Use it. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d81a8765d3f..0afbe4fe0ef 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2021-03-08 Tom Tromey + + * ada-lang.c (ada_atr_tag): New function. + (ada_evaluate_subexp): Use it. + 2021-03-08 Tom Tromey * ada-lang.c (ada_unop_in_range): New function. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index ac080fee434..a1d990ce41f 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: