]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ali.ads, ali.adb (Scan_ALI): Initialize XE.Tref to a known default value.
authorEmmanuel Briot <briot@adacore.com>
Mon, 15 Oct 2007 13:54:12 +0000 (15:54 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 15 Oct 2007 13:54:12 +0000 (15:54 +0200)
2007-10-15  Emmanuel Briot  <briot@adacore.com>

* ali.ads, ali.adb (Scan_ALI): Initialize XE.Tref to a known default
value.
(Xref_Record): Change type for Line, since in the case of a reference to
a predefined entity (as happens for array index types), the line is set
to 0.
Add support for parsing multiple array index types info, or
multiple inherited interfaces info. This information cannot be stored
in Xref_Entity_Record, which only supports a single instance of Tref_*,
and is therefore stored in the list of references instead. It has a
special treatement later on in tools that use this information.

From-SVN: r129320

gcc/ada/ali.adb
gcc/ada/ali.ads

index 6d4b551e9778212b9fb3fca55110e1d12ce416f7..26053016af686878a63e3a418093692cdb3d4eb4 100644 (file)
@@ -2174,35 +2174,82 @@ package body ALI is
 
                   Skip_Space;
 
-                  --  See if type reference present
-
-                  Get_Typeref
-                    (Current_File_Num, XE.Tref, XE.Tref_File_Num, XE.Tref_Line,
-                     XE.Tref_Type, XE.Tref_Col, XE.Tref_Standard_Entity);
-
-                  --  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
+                  XE.Oref_File_Num := No_Sdep_Id;
+                  XE.Tref_File_Num := No_Sdep_Id;
+                  XE.Tref          := Tref_None;
+                  XE.First_Xref    := Xref.Last + 1;
+
+                  --  Loop to check for additional info present
+
+                  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;
+
+                        --  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;
 
-                  XE.First_Xref := Xref.Last + 1;
+                        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
 
index e9ae46a3ed35d8400dd5a6f218dc071c6c391729..c90954acbcbd06e1031be47217fcc90771f5dff0 100644 (file)
@@ -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: