From 48a8c5be5b98240d664672a2b7b7d26f3c36cf84 Mon Sep 17 00:00:00 2001 From: Mikael Morin Date: Sun, 7 Nov 2021 14:40:36 +0100 Subject: fortran: Identify arguments by their names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This provides a new function to get the name of a dummy argument, so that identifying an argument can be made using just its name instead of a mix of name matching (for keyword actual arguments) and argument counting (for other actual arguments). gcc/fortran/ChangeLog: * interface.c (gfc_dummy_arg_get_name): New function. * gfortran.h (gfc_dummy_arg_get_name): Declare it. * trans-array.c (arg_evaluated_for_scalarization): Pass a dummy argument wrapper as argument instead of an actual argument and an index number. Check it’s non-NULL. Use its name to identify it. (gfc_walk_elemental_function_args): Update call to arg_evaluated for scalarization. Remove argument counting. --- gcc/fortran/interface.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gcc/fortran/interface.c') diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 12574f8..8571709 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -5534,6 +5534,23 @@ gfc_get_formal_from_actual_arglist (gfc_symbol *sym, } +const char * +gfc_dummy_arg_get_name (gfc_dummy_arg & dummy_arg) +{ + switch (dummy_arg.intrinsicness) + { + case GFC_INTRINSIC_DUMMY_ARG: + return dummy_arg.u.intrinsic->name; + + case GFC_NON_INTRINSIC_DUMMY_ARG: + return dummy_arg.u.non_intrinsic->sym->name; + + default: + gcc_unreachable (); + } +} + + const gfc_typespec & gfc_dummy_arg_get_typespec (gfc_dummy_arg & dummy_arg) { -- cgit v1.1