diff --git a/gcc/ada/ali.adb b/gcc/ada/ali.adb index 6d4b551e9778..26053016af68 100644 --- a/gcc/ada/ali.adb +++ b/gcc/ada/ali.adb @@ -2174,35 +2174,82 @@ package body ALI is Skip_Space; - -- See if type reference present + XE.Oref_File_Num := No_Sdep_Id; + XE.Tref_File_Num := No_Sdep_Id; + XE.Tref := Tref_None; + XE.First_Xref := Xref.Last + 1; - Get_Typeref - (Current_File_Num, XE.Tref, XE.Tref_File_Num, XE.Tref_Line, - XE.Tref_Type, XE.Tref_Col, XE.Tref_Standard_Entity); + -- Loop to check for additional info present - -- Do we have an overriding procedure, instead ? - if XE.Tref_Type = 'p' then - XE.Oref_File_Num := XE.Tref_File_Num; - XE.Oref_Line := XE.Tref_Line; - XE.Oref_Col := XE.Tref_Col; - XE.Tref_File_Num := No_Sdep_Id; - XE.Tref := Tref_None; - else - -- We might have additional information about the - -- overloaded subprograms + loop declare - Ref : Tref_Kind; - Typ : Character; - Standard_Entity : Name_Id; + Ref : Tref_Kind; + File : Sdep_Id; + Line : Nat; + Typ : Character; + Col : Nat; + Std : Name_Id; + begin Get_Typeref - (Current_File_Num, - Ref, XE.Oref_File_Num, - XE.Oref_Line, Typ, XE.Oref_Col, Standard_Entity); - end; - end if; + (Current_File_Num, Ref, File, Line, Typ, Col, Std); + exit when Ref = Tref_None; - XE.First_Xref := Xref.Last + 1; + -- Do we have an overriding procedure? + + if Ref = Tref_Derived and then Typ = 'p' then + XE.Oref_File_Num := File; + XE.Oref_Line := Line; + XE.Oref_Col := Col; + + -- Arrays never override anything, and <> points to + -- the index types instead + + elsif Ref = Tref_Derived and then XE.Etype = 'A' then + + -- Index types are stored in the list of references + + Xref.Increment_Last; + + declare + XR : Xref_Record renames Xref.Table (Xref.Last); + begin + XR.File_Num := File; + XR.Line := Line; + XR.Rtype := Array_Index_Reference; + XR.Col := Col; + XR.Name := Std; + end; + + -- Interfaces are stored in the list of references, + -- although the parent type itself is stored in XE + + elsif Ref = Tref_Derived + and then Typ = 'R' + and then XE.Tref_File_Num /= No_Sdep_Id + then + Xref.Increment_Last; + + declare + XR : Xref_Record renames Xref.Table (Xref.Last); + begin + XR.File_Num := File; + XR.Line := Line; + XR.Rtype := Interface_Reference; + XR.Col := Col; + XR.Name := Std; + end; + + else + XE.Tref := Ref; + XE.Tref_File_Num := File; + XE.Tref_Line := Line; + XE.Tref_Type := Typ; + XE.Tref_Col := Col; + XE.Tref_Standard_Entity := Std; + end if; + end; + end loop; -- Loop through cross-references for this entity diff --git a/gcc/ada/ali.ads b/gcc/ada/ali.ads index e9ae46a3ed35..c90954acbcbd 100644 --- a/gcc/ada/ali.ads +++ b/gcc/ada/ali.ads @@ -865,6 +865,13 @@ package ALI is Table_Increment => 300, Table_Name => "Xref_Entity"); + Array_Index_Reference : constant Character := '*'; + Interface_Reference : constant Character := 'I'; + -- Some special types of references. In the ALI file itself, these + -- are output as attributes of the entity, not as references, but + -- there is no provision in Xref_Entity_Record for storing multiple + -- such references. + -- The following table records actual cross-references type Xref_Record is record @@ -873,8 +880,9 @@ package ALI is -- that if no file entry is present explicitly, this is just a copy -- of the reference for the current cross-reference section. - Line : Pos; - -- Line number for the reference + Line : Nat; + -- Line number for the reference. This is zero when referencing a + -- predefined entity, but in this case Name is set. Rtype : Character; -- Indicates type of reference, using code used in ALI file: @@ -884,11 +892,18 @@ package ALI is -- c = completion of private or incomplete type -- x = type extension -- i = implicit reference + -- Array_Index_Reference = reference to the index of an array + -- Interface_Reference = reference to an interface implemented + -- by the type -- See description in lib-xref.ads for further details Col : Nat; -- Column number for the reference + Name : Name_Id := No_Name; + -- This is only used when referencing a predefined entity. Currently, + -- this only occurs for array indexes. + -- Note: for instantiation references, Rtype is set to ' ', and Col is -- set to zero. One or more such entries can follow any other reference. -- When there is more than one such entry, this is to be read as: