aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/f-exp.h15
-rw-r--r--gdb/f-lang.c20
3 files changed, 41 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6f3037c..d92f16b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2021-03-08 Tom Tromey <tom@tromey.com>
+ * f-lang.c (eval_op_f_associated): New functions.
+ * f-exp.h (fortran_associated_1arg, fortran_associated_2arg): New
+ typedefs.
+
+2021-03-08 Tom Tromey <tom@tromey.com>
+
* f-lang.c (fortran_bound_1arg::evaluate)
(fortran_bound_2arg::evaluate): New methods.
* f-exp.h (class fortran_bound_1arg, class fortran_bound_2arg):
diff --git a/gdb/f-exp.h b/gdb/f-exp.h
index e1d351a..11f403d 100644
--- a/gdb/f-exp.h
+++ b/gdb/f-exp.h
@@ -57,6 +57,17 @@ extern struct value *eval_op_f_kind (struct type *expect_type,
enum noside noside,
enum exp_opcode opcode,
struct value *arg1);
+extern struct value *eval_op_f_associated (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside,
+ enum exp_opcode opcode,
+ struct value *arg1);
+extern struct value *eval_op_f_associated (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside,
+ enum exp_opcode opcode,
+ struct value *arg1,
+ struct value *arg2);
namespace expr
{
@@ -72,6 +83,10 @@ using fortran_kind_operation = unop_operation<UNOP_FORTRAN_KIND,
using fortran_mod_operation = binop_operation<BINOP_MOD, eval_op_f_mod>;
using fortran_modulo_operation = binop_operation<BINOP_FORTRAN_MODULO,
eval_op_f_modulo>;
+using fortran_associated_1arg = unop_operation<FORTRAN_ASSOCIATED,
+ eval_op_f_associated>;
+using fortran_associated_2arg = binop_operation<FORTRAN_ASSOCIATED,
+ eval_op_f_associated>;
/* The Fortran "complex" operation. */
class fortran_cmplx_operation
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index dcd7c48..1a49b6b 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -995,6 +995,26 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang,
return value_from_longest (result_type, is_associated ? 1 : 0);
}
+struct value *
+eval_op_f_associated (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside,
+ enum exp_opcode opcode,
+ struct value *arg1)
+{
+ return fortran_associated (exp->gdbarch, exp->language_defn, arg1);
+}
+
+struct value *
+eval_op_f_associated (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside,
+ enum exp_opcode opcode,
+ struct value *arg1,
+ struct value *arg2)
+{
+ return fortran_associated (exp->gdbarch, exp->language_defn, arg1, arg2);
+}
/* A helper function for UNOP_ABS. */