]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Code refactoring on calls to Set_Debug_Info_Needed
authorArnaud Charlet <charlet@adacore.com>
Sun, 1 Mar 2020 11:59:11 +0000 (06:59 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 9 Jun 2020 08:09:04 +0000 (04:09 -0400)
2020-06-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* sem_util.ads, sem_util.adb (Set_Debug_Info_Defining_Id): New.
* exp_ch3.adb, exp_ch8.adb: Call Set_Debug_Info_Defining_Id when
relevant.

gcc/ada/exp_ch3.adb
gcc/ada/exp_ch8.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads

index a977e4f8e7b052150d477999aa78fb7b86acb3a7..6aaa4750558788eb8b7d01055398adb7cdfcbc92 100644 (file)
@@ -7267,9 +7267,7 @@ package body Exp_Ch3 is
             --  debug information, even though it is defined by a generated
             --  renaming that does not come from source.
 
-            if Comes_From_Source (Defining_Identifier (N)) then
-               Set_Debug_Info_Needed (Defining_Identifier (N));
-            end if;
+            Set_Debug_Info_Defining_Id (N);
 
             --  Now call the routine to generate debug info for the renaming
 
index 71160ee0665692bbe7d366075918266d9a73ce6d..4498be5c817d491c414f96f371cdb3e9f1bb34cb 100644 (file)
@@ -209,10 +209,7 @@ package body Exp_Ch8 is
       --  needing debug info if it comes from sources because the current
       --  setting in Freeze_Entity occurs too late. ???
 
-      if Comes_From_Source (Defining_Identifier (N)) then
-         Set_Debug_Info_Needed (Defining_Identifier (N));
-      end if;
-
+      Set_Debug_Info_Defining_Id (N);
       Decl := Debug_Renaming_Declaration (N);
 
       if Present (Decl) then
index ff52378d56090457b7ba39d1827dd9595747e70e..cd7ac1ea22fc8c3096ce24d2e071c4ce0941895e 100644 (file)
@@ -25142,6 +25142,17 @@ package body Sem_Util is
       end if;
    end Set_Debug_Info_Needed;
 
+   --------------------------------
+   -- Set_Debug_Info_Defining_Id --
+   --------------------------------
+
+   procedure Set_Debug_Info_Defining_Id (N : Node_Id) is
+   begin
+      if Comes_From_Source (Defining_Identifier (N)) then
+         Set_Debug_Info_Needed (Defining_Identifier (N));
+      end if;
+   end Set_Debug_Info_Defining_Id;
+
    ----------------------------
    -- Set_Entity_With_Checks --
    ----------------------------
index 03fcfe4421f46ccfc9de74360966b300125d26e7..5ca8ca39f28d7bc4646db61d9ca1d82b5e4ac176 100644 (file)
@@ -2721,6 +2721,10 @@ package Sem_Util is
    --  This routine should always be used instead of Set_Needs_Debug_Info to
    --  ensure that subsidiary entities are properly handled.
 
+   procedure Set_Debug_Info_Defining_Id (N : Node_Id);
+   --  Call Set_Debug_Info_Needed on Defining_Identifier (N) if it comes
+   --  from source.
+
    procedure Set_Entity_With_Checks (N : Node_Id; Val : Entity_Id);
    --  This procedure has the same calling sequence as Set_Entity, but it
    --  performs additional checks as follows: