[Ada] Improve DG output of subprograms

Message ID 20101005095718.GA5547@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Oct. 5, 2010, 9:57 a.m.
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;

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

  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.


Index: sprint.adb
--- sprint.adb	(revision 164942)
+++ sprint.adb	(working copy)
@@ -2785,7 +2785,13 @@  package body Sprint is
             end if;
-            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));