]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Simplify detection of controlling formals
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 7 Oct 2022 19:58:58 +0000 (21:58 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 4 Nov 2022 13:47:28 +0000 (14:47 +0100)
When detecting controlling formals we are only interested in formal
parameters and not in other entities.

gcc/ada/

* sem_ch6.adb (Controlling_Formal): Iterate with First/Next_Formal
and not with First/Next_Entity.

gcc/ada/sem_ch6.adb

index 228adcff5cd9b87b7b4009185221ce054a004db9..d28de10d3d6655edc7f4b25b781246bef3fc9e74 100644 (file)
@@ -10711,13 +10711,13 @@ package body Sem_Ch6 is
          E : Entity_Id;
 
       begin
-         E := First_Entity (Prim);
+         E := First_Formal (Prim);
          while Present (E) loop
-            if Is_Formal (E) and then Is_Controlling_Formal (E) then
+            if Is_Controlling_Formal (E) then
                return E;
             end if;
 
-            Next_Entity (E);
+            Next_Formal (E);
          end loop;
 
          return Empty;