Patchwork [Ada] Add support to load references of imported entities

login
register
mail settings
Submitter Arnaud Charlet
Date Sept. 6, 2011, 9:33 a.m.
Message ID <20110906093307.GA30732@adacore.com>
Download mbox | patch
Permalink /patch/113517/
State New
Headers show

Comments

Arnaud Charlet - Sept. 6, 2011, 9:33 a.m.
This patch adds the support needed to load references of entities
imported from other languages. This functionality is required by
tools processing ALI files (for example GPS).

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

2011-09-06  Javier Miranda  <miranda@adacore.com>

	* ali.adb (Scan_ALI): Add missing support to load references of
	entities imported from other languages.
	* ali.ads (Xref_Record): Adding new fields to store the language and
	name of an imported entity.
	* lib-xref.adb (Output_Import_Export_Info): Fix typo
	in comment.

Patch

Index: ali.adb
===================================================================
--- ali.adb	(revision 178565)
+++ ali.adb	(working copy)
@@ -504,6 +504,10 @@ 
                     or else Nextc = '<' or else Nextc = '>'
                     or else Nextc = '=';
 
+                  --  Terminate on comma
+
+                  exit when Nextc = ',';
+
                   --  Terminate if left bracket not part of wide char sequence
                   --  Note that we only recognize brackets notation so far ???
 
@@ -2389,12 +2393,21 @@ 
 
                         --  Imported entities reference as in:
                         --    494b<c,__gnat_copy_attribs>25
-                        --  ??? Simply skipped for now
 
                         if Nextc = '<' then
-                           while Getc /= '>' loop
-                              null;
-                           end loop;
+                           Skipc;
+                           XR.Imported_Lang := Get_Name;
+
+                           pragma Assert (Nextc = ',');
+                           Skipc;
+
+                           XR.Imported_Name := Get_Name;
+
+                           pragma Assert (Nextc = '>');
+                           Skipc;
+                        else
+                           XR.Imported_Lang := No_Name;
+                           XR.Imported_Name := No_Name;
                         end if;
 
                         XR.Col   := Get_Nat;
Index: ali.ads
===================================================================
--- ali.ads	(revision 178565)
+++ ali.ads	(working copy)
@@ -975,6 +975,10 @@ 
       --     ref1 is a reference to an entity that was instantied at ref2.
       --     ref2 itself is also the result of an instantiation, that took
       --     place at ref3
+
+      Imported_Lang : Name_Id := No_Name;
+      Imported_Name : Name_Id := No_Name;
+      --  Language and name of imported entity reference
    end record;
 
    package Xref is new Table.Table (
Index: lib-xref.adb
===================================================================
--- lib-xref.adb	(revision 178565)
+++ lib-xref.adb	(working copy)
@@ -1163,7 +1163,7 @@ 
 
       procedure Output_Import_Export_Info (Ent : Entity_Id);
       --  Output language and external name information for an interfaced
-      --  entity, using the format <language, external_name>,
+      --  entity, using the format <language, external_name>
 
       ------------------------
       -- Get_Type_Reference --