[gcc r11-1102] [Ada] Code refactoring on calls to Set_Debug_Info_Needed
Pierre-Marie de Rodat
pmderodat@gcc.gnu.org
Tue Jun 9 08:11:32 GMT 2020
https://gcc.gnu.org/g:4228c32ab0b50e10e74ff53159894708471bcdbc
commit r11-1102-g4228c32ab0b50e10e74ff53159894708471bcdbc
Author: Arnaud Charlet <charlet@adacore.com>
Date: Sun Mar 1 06:59:11 2020 -0500
[Ada] Code refactoring on calls to Set_Debug_Info_Needed
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.
Diff:
---
gcc/ada/exp_ch3.adb | 4 +---
gcc/ada/exp_ch8.adb | 5 +----
gcc/ada/sem_util.adb | 11 +++++++++++
gcc/ada/sem_util.ads | 4 ++++
4 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index a977e4f8e7b..6aaa4750558 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -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
diff --git a/gcc/ada/exp_ch8.adb b/gcc/ada/exp_ch8.adb
index 71160ee0665..4498be5c817 100644
--- a/gcc/ada/exp_ch8.adb
+++ b/gcc/ada/exp_ch8.adb
@@ -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
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index ff52378d560..cd7ac1ea22f 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -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 --
----------------------------
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index 03fcfe4421f..5ca8ca39f28 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -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:
More information about the Gcc-cvs
mailing list