[Ada] Improve DG output of subprograms

Arnaud Charlet charlet@adacore.com
Tue Oct 5 09:57:00 GMT 2010


This patch improves the output of subprogram bodies generating
the full-qualified of its corresponding spec. For example:

package Pkg is
   type T1 is tagged null record;
   type T2 is tagged null record;
end;

Command:
  gcc -c -gnatD pkg.ads
  grep -i "procedure .*assign" pkg.ads.dg

Output:
  procedure pkg___assign (x : out pkg__t1; y : pkg__t1);
     procedure pkg___assign (x : out pkg__t1; y : pkg__t1) is
  procedure pkg___assign__2 (x : out pkg__t2; y : pkg__t2);
     procedure pkg___assign__2 (x : out pkg__t2; y : pkg__t2) is

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-10-05  Javier Miranda  <miranda@adacore.com>

	* sprint.adb (Sprint_Node_Actual): Improve output of subprogram bodies
	to generate the full-qualified names of its corresponding spec.
	This facilitates locating the corresponing body when reading
	the DG output.

-------------- next part --------------
Index: sprint.adb
===================================================================
--- sprint.adb	(revision 164942)
+++ sprint.adb	(working copy)
@@ -2785,7 +2785,13 @@ package body Sprint is
             end if;
 
             Write_Indent;
-            Sprint_Node_Sloc (Specification (Node));
+
+            if Present (Corresponding_Spec (Node)) then
+               Sprint_Node_Sloc (Parent (Corresponding_Spec (Node)));
+            else
+               Sprint_Node_Sloc (Specification (Node));
+            end if;
+
             Write_Str (" is");
 
             Sprint_Indented_List (Declarations (Node));


More information about the Gcc-patches mailing list