[Ada] Fix reference & instantiation in ali file
Arnaud Charlet
charlet@adacore.com
Tue Nov 15 14:32:00 GMT 2005
Tested on i686-linux, committed on trunk
This check in fixes incorrect handling for instantiations of generic
functions while gnatxref and gnatfind parse the ALI files
Test case:
--
$ gnatxref p.adb
--
output should contain the following lines (reference to Cnv):
Cnv function
Decl: p.adb 7:12
Ref: p.adb 15:7
Cnv function
Decl: p.adb 8:12
Ref: p.adb 13:8 13:19
--
package P is
procedure X;
end P;
with Unchecked_Conversion;
with System;
package body P is
type Character_Ptr_T is access Character;
for Character_Ptr_T'Storage_Size use 0;
function Cnv is new Unchecked_Conversion (System.Address, Character_Ptr_T);
function Cnv is new Unchecked_Conversion (System.Address, Integer);
A1, A2 : System.Address;
procedure X is
begin
if Cnv (A1) > Cnv (A2) then
A1 := A2;
Cnv (A1).all := '*';
else
A2 := A1;
end if;
end;
end P;
2005-11-14 Emmanuel Briot <briot@adacore.com>
* xref_lib.adb (Parse_Identifier_Info): It is possible for an entity
line in the ALI file to include both an instantiation reference, and a
returned value.
-------------- next part --------------
Index: xref_lib.adb
===================================================================
--- xref_lib.adb (revision 106884)
+++ xref_lib.adb (working copy)
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -372,7 +372,7 @@
if Tail (Dir_Ent (1 .. Last), 4) = ".adp" then
- -- The first project file found is the good one.
+ -- The first project file found is the good one
Close (My_Dir);
return Dir_Ent (1 .. Last);
@@ -889,8 +889,9 @@
if Ali (Ptr) = '[' then
Skip_To_Matching_Closing_Bracket;
+ end if;
- elsif Ali (Ptr) = '<'
+ if Ali (Ptr) = '<'
or else Ali (Ptr) = '('
or else Ali (Ptr) = '{'
then
@@ -1475,7 +1476,7 @@
-- Go to start of new line
procedure Print80 (S : in String);
- -- Print the text, respecting the 80 columns rule.
+ -- Print the text, respecting the 80 columns rule
procedure Print_Ref (Line, Column : String);
-- The beginning of the output is aligned on a column multiple of 9
More information about the Gcc-patches
mailing list