From 086734aed9adb3e46f362db83e9ea31571778b54 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Mon, 19 Aug 2019 08:35:58 +0000 Subject: [PATCH] [Ada] Minor refactorings 2019-08-19 Piotr Trojanek 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 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/sem.adb | 8 +++----- gcc/ada/sem_ch12.adb | 5 +---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d06fd4ef53a..a2e90375360 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2019-08-19 Piotr Trojanek + + * 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 * sem_spark.ads, sem_spark.adb (Is_Pledge_Function): New diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index 9b6b33535f9..2e9953189dd 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -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 diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 5d1c824bb7b..e94fc210db2 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -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)); -- 2.30.2