diff mbox series

[Ada] Simplify iteration over formal parameters for Global/Depends check

Message ID 20210504095222.GA90482@adacore.com
State New
Headers show
Series [Ada] Simplify iteration over formal parameters for Global/Depends check | expand

Commit Message

Pierre-Marie de Rodat May 4, 2021, 9:52 a.m. UTC
Replace low-level First_Entity/Next_Entity with a high-level
First_Formal/Next_Formal. The new code is easier to debug, because we
don't even see local subprograms, objects, etc.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_prag.adb (Collect_Global_Item): Iterate directly over
	formals.
diff mbox series

Patch

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -30246,7 +30246,7 @@  package body Sem_Prag is
 
          --  Process all formal parameters
 
-         Formal := First_Entity (Spec_Id);
+         Formal := First_Formal (Spec_Id);
          while Present (Formal) loop
             if Ekind (Formal) in E_In_Out_Parameter | E_In_Parameter then
                Append_New_Elmt (Formal, Subp_Inputs);
@@ -30277,7 +30277,7 @@  package body Sem_Prag is
                Append_New_Elmt (Formal, Subp_Outputs);
             end if;
 
-            Next_Entity (Formal);
+            Next_Formal (Formal);
          end loop;
 
       --  Otherwise the input denotes a task type, a task body, or the