This implements the Fortran 1- and 2-argument "associated" operations.
gdb/ChangeLog
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 (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)
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
{
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
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. */