[Ada] Minor refactorings
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 19 Aug 2019 08:35:58 +0000 (08:35 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 19 Aug 2019 08:35:58 +0000 (08:35 +0000)
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

gcc/ada/ChangeLog
gcc/ada/sem.adb
gcc/ada/sem_ch12.adb

index d06fd4ef53add7b90895d35c289c187ba45c4c6e..a2e90375360fdd12286c64f09dc8ea6ee0bda8cf 100644 (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
index 9b6b33535f97ab78377843ef612907952854cf8f..2e9953189dd2396f217b282a12a2ccb4ee3a84f4 100644 (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
index 5d1c824bb7b4b8cfae1d503f7d664263a1266ca5..e94fc210db205516f453edf7c28d3a3c1df9cf1e 100644 (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));