[Ada] Minor refactorings

2019-08-19  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* sem_ch12.adb (Get_Unit_Instantiation_Node): Simplify Nkind_In
	membership test.
	* sem.adb (Depends_On_Main): Whitespace cleanup; only assign a
	local variable if needed.

From-SVN: r274645
This commit is contained in:
Piotr Trojanek 2019-08-19 08:35:58 +00:00 committed by Pierre-Marie de Rodat
parent ef1c6c0e54
commit 086734aed9
3 changed files with 11 additions and 9 deletions

View File

@ -1,3 +1,10 @@
2019-08-19 Piotr Trojanek <trojanek@adacore.com>
* sem_ch12.adb (Get_Unit_Instantiation_Node): Simplify Nkind_In
membership test.
* sem.adb (Depends_On_Main): Whitespace cleanup; only assign a
local variable if needed.
2019-08-19 Claire Dross <dross@adacore.com>
* sem_spark.ads, sem_spark.adb (Is_Pledge_Function): New

View File

@ -1729,16 +1729,14 @@ package body Sem is
MCU : constant Node_Id := Unit (Main_CU);
begin
CL := First (Context_Items (CU));
-- Problem does not arise with main subprograms
if
not Nkind_In (MCU, N_Package_Body, N_Package_Declaration)
then
if not Nkind_In (MCU, N_Package_Body, N_Package_Declaration) then
return False;
end if;
CL := First (Context_Items (CU));
while Present (CL) loop
if Nkind (CL) = N_With_Clause
and then Library_Unit (CL) = Main_CU

View File

@ -8953,10 +8953,7 @@ package body Sem_Ch12 is
Decl := Unit_Declaration_Node (Corresponding_Body (Decl));
end if;
if Nkind_In (Original_Node (Decl), N_Function_Instantiation,
N_Package_Instantiation,
N_Procedure_Instantiation)
then
if Nkind (Original_Node (Decl)) in N_Generic_Instantiation then
return Original_Node (Decl);
else
return Unit (Parent (Decl));