From 5ec5b8c17167a5d831310bc80f42ae717998769a Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Mon, 5 Sep 2005 09:55:30 +0200 Subject: lib-xref.adb (Output_Overridden_Op): Display information on overridden operation. 2005-09-01 Ed Schonberg Emmanuel Briot * lib-xref.adb (Output_Overridden_Op): Display information on overridden operation. * lib-xref.ads: Add documentation on overridden operations. * ali.ads (Xref_Entity_Record): Add support for storing the overriding information. * ali.adb (Get_Typeref): New subprogram. Adds support for parsing the overriding entity information. From-SVN: r103871 --- gcc/ada/lib-xref.adb | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'gcc/ada/lib-xref.adb') diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb index 1fc8b56..7260b0c 100644 --- a/gcc/ada/lib-xref.adb +++ b/gcc/ada/lib-xref.adb @@ -1172,6 +1172,10 @@ package body Lib.Xref is -- the given source ptr in [file|line[...]] form. No output -- if the given location is not a generic template reference. + procedure Output_Overridden_Op (Old_E : Entity_Id); + -- For a subprogram that is overriding, display information + -- about the inherited operation that it overrides. + ------------------------------- -- Output_Instantiation_Refs -- ------------------------------- @@ -1212,6 +1216,35 @@ package body Lib.Xref is return; end Output_Instantiation_Refs; + -------------------------- + -- Output_Overridden_Op -- + -------------------------- + + procedure Output_Overridden_Op (Old_E : Entity_Id) is + begin + if Present (Old_E) + and then Sloc (Old_E) /= Standard_Location + then + declare + Loc : constant Source_Ptr := Sloc (Old_E); + Par_Unit : constant Unit_Number_Type := + Get_Source_Unit (Loc); + begin + Write_Info_Char ('<'); + + if Par_Unit /= Curxu then + Write_Info_Nat (Dependency_Num (Par_Unit)); + Write_Info_Char ('|'); + end if; + + Write_Info_Nat (Int (Get_Logical_Line_Number (Loc))); + Write_Info_Char ('p'); + Write_Info_Nat (Int (Get_Column_Number (Loc))); + Write_Info_Char ('>'); + end; + end if; + end Output_Overridden_Op; + -- Start of processing for Output_One_Ref begin @@ -1661,6 +1694,15 @@ package body Lib.Xref is end if; end if; + -- If the entity is an overriding operation, write + -- info on operation that was overridden. + + if Is_Subprogram (XE.Ent) + and then Is_Overriding_Operation (XE.Ent) + then + Output_Overridden_Op (Overridden_Operation (XE.Ent)); + end if; + -- End of processing for entity output Crloc := No_Location; -- cgit v1.1