aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/xref_lib.adb
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2005-06-16 10:42:37 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2005-06-16 10:42:37 +0200
commit217efe162dcacbed0b3eb31c68a1ea9070285137 (patch)
tree899ff257fa91dd9472295e0c76d8f9c924e4a50a /gcc/ada/xref_lib.adb
parente9437007b8d68b91b2d1ac803f8938c54b6c4188 (diff)
downloadgcc-217efe162dcacbed0b3eb31c68a1ea9070285137.zip
gcc-217efe162dcacbed0b3eb31c68a1ea9070285137.tar.gz
gcc-217efe162dcacbed0b3eb31c68a1ea9070285137.tar.bz2
lib-xref.ads, [...] (Generate_Definition): Treat any entity declared within an inlined body as referenced...
2005-06-14 Ed Schonberg <schonberg@adacore.com> Emmanuel Briot <briot@adacore.com> * lib-xref.ads, lib-xref.adb (Generate_Definition): Treat any entity declared within an inlined body as referenced, to prevent spurious warnings. (Output_One_Ref): If an entity renames an array component, indicate in the ALI file that this aliases (renames) the array. Capture as well function renamings that rename predefined operations. Add information about generic parent for package and subprogram instances. (Get_Type_Reference): For a subtype that is the renaming of an actual in an instantiation, use the first_subtype to ensure that we don't generate cross-reference information for internal types. For objects and parameters of a generic private type, retain the '*' indicator to distinguish such an entity from its type. * ali.ads (Xref_Entity_Record): New fields Iref_File_Num and Iref_Line, to store information about instantiated entities. * ali.adb (Scan_ALI): Add support for parsing the reference to the generic parent * xref_lib.adb (Skip_To_Matching_Closing_Bracket): New subprogram (Parse_Identifier_Info, Parse_Token): Add support for the generic parent information. From-SVN: r101046
Diffstat (limited to 'gcc/ada/xref_lib.adb')
-rw-r--r--gcc/ada/xref_lib.adb48
1 files changed, 32 insertions, 16 deletions
diff --git a/gcc/ada/xref_lib.adb b/gcc/ada/xref_lib.adb
index 5b953e4..b6054b6 100644
--- a/gcc/ada/xref_lib.adb
+++ b/gcc/ada/xref_lib.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2003 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- --
@@ -755,6 +755,10 @@ package body Xref_Lib is
-- to parse the ali file again because the parent entity is not in
-- the declaration table if it did not match the search pattern.
+ procedure Skip_To_Matching_Closing_Bracket;
+ -- When Ptr points to an opening square bracket, moves it to the
+ -- character following the matching closing bracket
+
---------------------
-- Get_Symbol_Name --
---------------------
@@ -806,6 +810,27 @@ package body Xref_Lib is
return "???";
end Get_Symbol_Name;
+ --------------------------------------
+ -- Skip_To_Matching_Closing_Bracket --
+ --------------------------------------
+
+ procedure Skip_To_Matching_Closing_Bracket is
+ Num_Brackets : Natural;
+
+ begin
+ Num_Brackets := 1;
+ while Num_Brackets /= 0 loop
+ Ptr := Ptr + 1;
+ if Ali (Ptr) = '[' then
+ Num_Brackets := Num_Brackets + 1;
+ elsif Ali (Ptr) = ']' then
+ Num_Brackets := Num_Brackets - 1;
+ end if;
+ end loop;
+
+ Ptr := Ptr + 1;
+ end Skip_To_Matching_Closing_Bracket;
+
-- Start of processing for Parse_Identifier_Info
begin
@@ -862,7 +887,10 @@ package body Xref_Lib is
Decl_Ref := Add_Declaration
(File.X_File, Ali (E_Name .. Ptr - 1), E_Line, E_Col, E_Type);
- if Ali (Ptr) = '<'
+ if Ali (Ptr) = '[' then
+ Skip_To_Matching_Closing_Bracket;
+
+ elsif Ali (Ptr) = '<'
or else Ali (Ptr) = '('
or else Ali (Ptr) = '{'
then
@@ -918,20 +946,7 @@ package body Xref_Lib is
-- Skip the information for generics instantiations
if Ali (Ptr) = '[' then
- declare
- Num_Brackets : Natural := 1;
- begin
- while Num_Brackets /= 0 loop
- Ptr := Ptr + 1;
- if Ali (Ptr) = '[' then
- Num_Brackets := Num_Brackets + 1;
- elsif Ali (Ptr) = ']' then
- Num_Brackets := Num_Brackets - 1;
- end if;
- end loop;
-
- Ptr := Ptr + 1;
- end;
+ Skip_To_Matching_Closing_Bracket;
end if;
-- Skip '>', or ')' or '>'
@@ -1169,6 +1184,7 @@ package body Xref_Lib is
or else Source (Ptr) = ASCII.HT
or else Source (Ptr) = '<'
or else Source (Ptr) = '{'
+ or else Source (Ptr) = '['
or else Source (Ptr) = '='
or else Source (Ptr) = '('))
and then Source (Ptr) >= ' '