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:34 -0700
commit7992accc6e5dc674ab209397acc1d840f869c326 (patch)
tree10cbd039119f3a3811e6440760826ba27ce6a558 /gdb
parent6ad3b8bf3b118e9635a0dcc022128496f4fc13ca (diff)
downloadgdb-7992accc6e5dc674ab209397acc1d840f869c326.zip
gdb-7992accc6e5dc674ab209397acc1d840f869c326.tar.gz
gdb-7992accc6e5dc674ab209397acc1d840f869c326.tar.bz2
Refactor value_pos_atr
This refactors value_pos_atr to be directly usable by a new operation implementation. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ada-lang.c (ada_pos_atr): Rename from value_pos_atr. Change parameters. (ada_evaluate_subexp): Use it.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/ada-lang.c16
2 files changed, 14 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 408ad7f..9a13a03 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2021-03-08 Tom Tromey <tom@tromey.com>
+ * ada-lang.c (ada_pos_atr): Rename from value_pos_atr. Change
+ parameters.
+ (ada_evaluate_subexp): Use it.
+
+2021-03-08 Tom Tromey <tom@tromey.com>
+
* ada-lang.c (ada_binop_minmax): No longer static.
* ada-exp.h (ada_binop_min_operation, ada_binop_max_operation):
New typedefs.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 418cc04..cbb1dee 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -189,8 +189,6 @@ static struct value *ada_coerce_ref (struct value *);
static LONGEST pos_atr (struct value *);
-static struct value *value_pos_atr (struct type *, struct value *);
-
static struct value *val_atr (struct type *, LONGEST);
static struct symbol *standard_lookup (const char *, const struct block *,
@@ -8866,8 +8864,14 @@ pos_atr (struct value *arg)
}
static struct value *
-value_pos_atr (struct type *type, struct value *arg)
+ada_pos_atr (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside, enum exp_opcode op,
+ struct value *arg)
{
+ struct type *type = builtin_type (exp->gdbarch)->builtin_int;
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value_zero (type, not_lval);
return value_from_longest (type, pos_atr (arg));
}
@@ -11231,11 +11235,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- type = builtin_type (exp->gdbarch)->builtin_int;
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (type, not_lval);
- else
- return value_pos_atr (type, arg1);
+ return ada_pos_atr (expect_type, exp, noside, op, arg1);
case OP_ATR_SIZE:
arg1 = evaluate_subexp (nullptr, exp, pos, noside);