[Ada] Remove End_Interp_List from the overloaded resolution API
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 29 Jan 2021 18:34:39 +0000 (19:34 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 7 May 2021 09:29:01 +0000 (05:29 -0400)
gcc/ada/

* sem_ch4.adb (Analyze_Call): Remove call to End_Interp_List.
(Process_Overloaded_Indexed_Component): Remove call to
End_Interp_List.
* sem_util.adb (Insert_Explicit_Dereference): Remove call to
End_Interp_List.
* sem_type.ads (End_Interp_List): Remove.
* sem_type.adb (Add_Entry): The guard against duplicate entries
is now checked before other conditions, so that EXIT statements
do not bypass this guard.
(End_Interp_List): Remove.

gcc/ada/sem_ch4.adb
gcc/ada/sem_type.adb
gcc/ada/sem_type.ads
gcc/ada/sem_util.adb

index 15b4999..f89db02 100644 (file)
@@ -1461,8 +1461,6 @@ package body Sem_Ch4 is
          else
             Remove_Abstract_Operations (N);
          end if;
-
-         End_Interp_List;
       end if;
 
       --  Check the accessibility level for actuals for explicitly aliased
@@ -2790,8 +2788,6 @@ package body Sem_Ch4 is
             Error_Msg_N ("no legal interpretation for indexed component", N);
             Set_Is_Overloaded (N, False);
          end if;
-
-         End_Interp_List;
       end Process_Overloaded_Indexed_Component;
 
    --  Start of processing for Analyze_Indexed_Component_Form
index b22c904..8ffdda3 100644 (file)
@@ -239,6 +239,13 @@ package body Sem_Type is
          Get_First_Interp (N, I, It);
          while Present (It.Nam) loop
 
+            --  Avoid making duplicate entries in overloads
+
+            if Name = It.Nam
+              and then Base_Type (It.Typ) = Base_Type (T)
+            then
+               return;
+
             --  A user-defined subprogram hides another declared at an outer
             --  level, or one that is use-visible. So return if previous
             --  definition hides new one (which is either in an outer
@@ -248,7 +255,7 @@ package body Sem_Type is
             --  If this is a universal operation, retain the operator in case
             --  preference rule applies.
 
-            if (((Ekind (Name) = E_Function or else Ekind (Name) = E_Procedure)
+            elsif ((Ekind (Name) in E_Function | E_Procedure
                    and then Ekind (Name) = Ekind (It.Nam))
                  or else (Ekind (Name) = E_Operator
                            and then Ekind (It.Nam) = E_Function))
@@ -292,13 +299,6 @@ package body Sem_Type is
                   return;
                end if;
 
-            --  Avoid making duplicate entries in overloads
-
-            elsif Name = It.Nam
-              and then Base_Type (It.Typ) = Base_Type (T)
-            then
-               return;
-
             --  Otherwise keep going
 
             else
@@ -2227,16 +2227,6 @@ package body Sem_Type is
       end if;
    end Disambiguate;
 
-   ---------------------
-   -- End_Interp_List --
-   ---------------------
-
-   procedure End_Interp_List is
-   begin
-      All_Interp.Table (All_Interp.Last) := No_Interp;
-      All_Interp.Increment_Last;
-   end End_Interp_List;
-
    -------------------------
    -- Entity_Matches_Spec --
    -------------------------
index b0cb7c7..89fd617 100644 (file)
@@ -130,9 +130,6 @@ package Sem_Type is
    --  always Boolean, and we use Opnd_Type, which is a candidate type for one
    --  of the operands of N, to check visibility.
 
-   procedure End_Interp_List;
-   --  End the list of interpretations of current node
-
    procedure Get_First_Interp
      (N  : Node_Id;
       I  : out Interp_Index;
index 7d919a0..4e6fef5 100644 (file)
@@ -15044,8 +15044,6 @@ package body Sem_Util is
             Get_Next_Interp (I, It);
          end loop;
 
-         End_Interp_List;
-
       else
          --  Prefix is unambiguous: mark the original prefix (which might
          --  Come_From_Source) as a reference, since the new (relocated) one