[Ada] Reuse First_Formal for generic subprograms
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 7 Jan 2021 11:17:49 +0000 (12:17 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 4 May 2021 09:17:34 +0000 (05:17 -0400)
gcc/ada/

* lib-xref.adb (Generate_Reference_To_Formals): Remove dedicated
branch for generic subprograms (they are now handled together
with non-generic subprograms in the ELSE branch); replace a
low-level Ekind membership test with a high-level call to
Is_Access_Subprogram_Type.

gcc/ada/lib-xref.adb

index 1b0b177..f8d86e6 100644 (file)
@@ -1277,18 +1277,8 @@ package body Lib.Xref is
       Formal : Entity_Id;
 
    begin
-      if Is_Generic_Subprogram (E) then
-         Formal := First_Entity (E);
-
-         while Present (Formal)
-           and then not Is_Formal (Formal)
-         loop
-            Next_Entity (Formal);
-         end loop;
-
-      elsif Ekind (E) in Access_Subprogram_Kind then
+      if Is_Access_Subprogram_Type (E) then
          Formal := First_Formal (Designated_Type (E));
-
       else
          Formal := First_Formal (E);
       end if;