[Ada] gnatfind missing references to array types

Submitted by Arnaud Charlet on Jan. 3, 2013, 11:05 a.m.

Details

Message ID 20130103110532.GA22511@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Jan. 3, 2013, 11:05 a.m.
The format for the ALI file has evolved and now lists the information for both
the index and the component type for array types. However, gnatfind and
gnatxref do not correctly parse this information and consider the corresponding
line as invalid, resulting in missing references.

With the following example:

with GNATCOLL.SQL.Exec;  use GNATCOLL.SQL.Exec;
procedure Debug_Books is
   Param : SQL_Parameters := (1 => +23);
begin
   null;
end Debug_Books;

gnatfind must list a reference to SQL_Parameters.

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

2013-01-03  Emmanuel Briot  <briot@adacore.com>

	* xref_lib.adb (Parse_Identifier_Info): Fix handling of arrays, which
	have information in the ALI file for both the index and the component
	types.

Patch hide | download patch | download mbox

Index: xref_lib.adb
===================================================================
--- xref_lib.adb	(revision 194841)
+++ xref_lib.adb	(working copy)
@@ -925,10 +925,11 @@ 
          end;
       end if;
 
-      if Ali (Ptr) = '<'
-        or else Ali (Ptr) = '('
-        or else Ali (Ptr) = '{'
-      then
+      while Ptr <= Ali'Last
+         and then (Ali (Ptr) = '<'
+                   or else Ali (Ptr) = '('
+                   or else Ali (Ptr) = '{')
+      loop
          --  Here we have a type derivation information. The format is
          --  <3|12I45> which means that the current entity is derived from the
          --  type defined in unit number 3, line 12 column 45. The pipe and
@@ -1065,7 +1066,7 @@ 
             end loop;
             Ptr := Ptr + 1;
          end if;
-      end if;
+      end loop;
 
       --  To find the body, we will have to parse the file too