aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/namet.adb
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2022-02-14 16:00:55 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-12 12:38:42 +0000
commit0b4606618c081cc99f1a18aeb303e9b05e77df4b (patch)
treee6cdefe78f17b837ab369968f5f33979fad299cc /gcc/ada/namet.adb
parente28064111c3c42e7b75c79c941c9fc339901f0dd (diff)
downloadgcc-0b4606618c081cc99f1a18aeb303e9b05e77df4b.zip
gcc-0b4606618c081cc99f1a18aeb303e9b05e77df4b.tar.gz
gcc-0b4606618c081cc99f1a18aeb303e9b05e77df4b.tar.bz2
[Ada] Restore double quotes in debug printouts
A previous change in "Make debug printouts more robust" accidentally removed double quotes around identifiers in debug printouts. This patch restores those. So for example, we have: Prev_Entity = Node #10 N_Defining_Identifier "foo" (Entity_Id=795) and not: Prev_Entity = Node #10 N_Defining_Identifier foo (Entity_Id=795) This affects the output of -gnatdt, and certain calls normally done from gdb. gcc/ada/ * namet.ads, namet.adb (Write_Name_For_Debug): Add Quote parameter to allow conditional addition of quotes. Note that some calls to Write_Name_For_Debug, for example for file names, shouldn't have quotes, as in some_package.adb:123:45. * treepr.adb (Print_Name): Add double quotes around the name using the above Quote parameters.
Diffstat (limited to 'gcc/ada/namet.adb')
-rw-r--r--gcc/ada/namet.adb6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/ada/namet.adb b/gcc/ada/namet.adb
index 7eb2f0e..50dc783 100644
--- a/gcc/ada/namet.adb
+++ b/gcc/ada/namet.adb
@@ -1570,9 +1570,11 @@ package body Namet is
-- Write_Name_For_Debug --
--------------------------
- procedure Write_Name_For_Debug (Id : Name_Id) is
+ procedure Write_Name_For_Debug (Id : Name_Id; Quote : String := "") is
begin
if Is_Valid_Name (Id) then
+ Write_Str (Quote);
+
declare
Buf : Bounded_String (Max_Length => Natural (Length_Of_Name (Id)));
begin
@@ -1580,6 +1582,8 @@ package body Namet is
Write_Str (Buf.Chars (1 .. Buf.Length));
end;
+ Write_Str (Quote);
+
elsif Id = No_Name then
Write_Str ("<No_Name>");