Replace a low-level membership test "Ekind_In (Id, E_Entry,
E_Entry_Family)" with a high-level "Is_Entry (Id)", which is more
readable. Semantics stays the same.
Tested on x86_64-pc-linux-gnu, committed on trunk
2020-06-12 Piotr Trojanek <troja...@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/contracts.adb
@@ -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;
--- gcc/ada/einfo.adb
+++ gcc/ada/einfo.adb
@@ -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;
--- gcc/ada/sem_ch4.adb
+++ gcc/ada/sem_ch4.adb
@@ -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;
--- gcc/ada/sem_ch6.adb
+++ gcc/ada/sem_ch6.adb
@@ -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);
--- gcc/ada/sem_res.adb
+++ gcc/ada/sem_res.adb
@@ -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;
--- gcc/ada/sem_util.adb
+++ gcc/ada/sem_util.adb
@@ -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;