public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Simplify iteration over formal parameters for Global/Depends check
@ 2021-05-04  9:52 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-05-04  9:52 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

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.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 758 bytes --]

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-04  9:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04  9:52 [Ada] Simplify iteration over formal parameters for Global/Depends check Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).