[Ada] Reuse Is_Entry where possible
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 23 Mar 2020 23:04:11 +0000 (00:04 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 12 Jun 2020 08:29:22 +0000 (04:29 -0400)
2020-06-12  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* contracts.adb, einfo.adb, sem_ch4.adb, sem_ch6.adb,
sem_res.adb, sem_util.adb: Replace Ekind_In with Is_Entry.

gcc/ada/contracts.adb
gcc/ada/einfo.adb
gcc/ada/sem_ch4.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_res.adb
gcc/ada/sem_util.adb

index 42f36d5..300bbf9 100644 (file)
@@ -562,8 +562,7 @@ package body Contracts is
       --  Save the SPARK_Mode-related data to restore on exit
 
       Skip_Assert_Exprs : constant Boolean :=
-                            Ekind_In (Subp_Id, E_Entry, E_Entry_Family)
-                              and then not GNATprove_Mode;
+                            Is_Entry (Subp_Id) and then not GNATprove_Mode;
 
       Depends  : Node_Id := Empty;
       Global   : Node_Id := Empty;
index 9176f4a..2456fc1 100644 (file)
@@ -1299,7 +1299,7 @@ package body Einfo is
 
    function Contract_Wrapper (Id : E) return E is
    begin
-      pragma Assert (Ekind_In (Id, E_Entry, E_Entry_Family));
+      pragma Assert (Is_Entry (Id));
       return Node25 (Id);
    end Contract_Wrapper;
 
@@ -1709,8 +1709,7 @@ package body Einfo is
    function Has_Out_Or_In_Out_Parameter (Id : E) return B is
    begin
       pragma Assert
-        (Ekind_In (Id, E_Entry, E_Entry_Family)
-          or else Is_Subprogram_Or_Generic_Subprogram (Id));
+        (Is_Entry (Id) or else Is_Subprogram_Or_Generic_Subprogram (Id));
       return Flag110 (Id);
    end Has_Out_Or_In_Out_Parameter;
 
@@ -4159,7 +4158,7 @@ package body Einfo is
 
    procedure Set_Contract_Wrapper (Id : E; V : E) is
    begin
-      pragma Assert (Ekind_In (Id, E_Entry, E_Entry_Family));
+      pragma Assert (Is_Entry (Id));
       Set_Node25 (Id, V);
    end Set_Contract_Wrapper;
 
index 7bdb0d1..4b19d2d 100644 (file)
@@ -4989,7 +4989,7 @@ package body Sem_Ch4 is
          then
             if Is_Task_Type (Prefix_Type)
               and then Present (Entity (Sel))
-              and then Ekind_In (Entity (Sel), E_Entry, E_Entry_Family)
+              and then Is_Entry (Entity (Sel))
             then
                null;
 
index 456bd97..9fb46d9 100644 (file)
@@ -12259,7 +12259,7 @@ package body Sem_Ch6 is
       --  point of the call.
 
       if Out_Present (Spec) then
-         if Ekind_In (Id, E_Entry, E_Entry_Family)
+         if Is_Entry (Id)
            or else Is_Subprogram_Or_Generic_Subprogram (Id)
          then
             Set_Has_Out_Or_In_Out_Parameter (Id, True);
index c60f46c..4cd6f06 100644 (file)
@@ -6098,8 +6098,7 @@ package body Sem_Res is
       --  can be an arbitrary expression with special resolution rules.
 
       elsif Nkind_In (Subp, N_Selected_Component, N_Indexed_Component)
-        or else (Is_Entity_Name (Subp)
-                  and then Ekind_In (Entity (Subp), E_Entry, E_Entry_Family))
+        or else (Is_Entity_Name (Subp) and then Is_Entry (Entity (Subp)))
       then
          Resolve_Entry_Call (N, Typ);
 
@@ -7937,7 +7936,7 @@ package body Sem_Res is
          end;
       end if;
 
-      if Ekind_In (Nam, E_Entry, E_Entry_Family)
+      if Is_Entry (Nam)
         and then Present (Contract_Wrapper (Nam))
         and then Current_Scope /= Contract_Wrapper (Nam)
       then
@@ -8008,7 +8007,7 @@ package body Sem_Res is
 
       Generate_Reference (Nam, Entry_Name, 's');
 
-      if Ekind_In (Nam, E_Entry, E_Entry_Family) then
+      if Is_Entry (Nam) then
          Check_Potentially_Blocking_Operation (N);
       end if;
 
index 0a62b10..2661517 100644 (file)
@@ -9139,7 +9139,7 @@ package body Sem_Util is
          if Msg_Index <= Msg_Last - 10
            and then Msg (Msg_Index .. Msg_Index + 9) = "subprogram"
          then
-            if Ekind_In (Id, E_Entry, E_Entry_Family) then
+            if Is_Entry (Id) then
                Res (Res_Index .. Res_Index + 4) := "entry";
                Res_Index := Res_Index + 5;
 
@@ -15417,7 +15417,7 @@ package body Sem_Util is
    function Is_Entry_Body (Id : Entity_Id) return Boolean is
    begin
       return
-        Ekind_In (Id, E_Entry, E_Entry_Family)
+        Is_Entry (Id)
           and then Nkind (Unit_Declaration_Node (Id)) = N_Entry_Body;
    end Is_Entry_Body;
 
@@ -15428,7 +15428,7 @@ package body Sem_Util is
    function Is_Entry_Declaration (Id : Entity_Id) return Boolean is
    begin
       return
-        Ekind_In (Id, E_Entry, E_Entry_Family)
+        Is_Entry (Id)
           and then Nkind (Unit_Declaration_Node (Id)) = N_Entry_Declaration;
    end Is_Entry_Declaration;