[v3,147/206] Implement fortran_allocated_operation

Message ID 20210220201609.838264-148-tom@tromey.com
State New
Headers show
Series
  • Refactor expressions
Related show

Commit Message

Tom Tromey Feb. 20, 2021, 8:15 p.m.
This implements the Fortran ALLOCATED intrinsic.

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

	* f-exp.h (eval_op_f_allocated): Declare.
	(fortran_allocated_operation): New typedef.
	* f-lang.c (eval_op_f_allocated): No longer static.
---
 gdb/ChangeLog | 6 ++++++
 gdb/f-exp.h   | 9 ++++++++-
 gdb/f-lang.c  | 2 +-
 3 files changed, 15 insertions(+), 2 deletions(-)

-- 
2.26.2

Patch

diff --git a/gdb/f-exp.h b/gdb/f-exp.h
index e1d351a2bb4..1950e39a235 100644
--- a/gdb/f-exp.h
+++ b/gdb/f-exp.h
@@ -1,6 +1,6 @@ 
 /* Definitions for Fortran expressions
 
-   Copyright (C) 2020 Free Software Foundation, Inc.
+   Copyright (C) 2020, 2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -57,6 +57,11 @@  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_allocated (struct type *expect_type,
+					   struct expression *exp,
+					   enum noside noside,
+					   enum exp_opcode op,
+					   struct value *arg1);
 
 namespace expr
 {
@@ -68,6 +73,8 @@  using fortran_floor_operation = unop_operation<UNOP_FORTRAN_FLOOR,
 					       eval_op_f_floor>;
 using fortran_kind_operation = unop_operation<UNOP_FORTRAN_KIND,
 					      eval_op_f_kind>;
+using fortran_allocated_operation = unop_operation<UNOP_FORTRAN_ALLOCATED,
+						   eval_op_f_allocated>;
 
 using fortran_mod_operation = binop_operation<BINOP_MOD, eval_op_f_mod>;
 using fortran_modulo_operation = binop_operation<BINOP_FORTRAN_MODULO,
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 4bee88faef5..40ae7411afc 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -1010,7 +1010,7 @@  eval_op_f_kind (struct type *expect_type, struct expression *exp,
 
 /* A helper function for UNOP_FORTRAN_ALLOCATED.  */
 
-static struct value *
+struct value *
 eval_op_f_allocated (struct type *expect_type, struct expression *exp,
 		     enum noside noside, enum exp_opcode op,
 		     struct value *arg1)