Commit 25c87b0f by Ed Schonberg Committed by Arnaud Charlet

lib-xref.adb (Get_Type_Reference): For a private type whose full view is an array type...

2006-02-13  Ed Schonberg  <schonberg@adacore.com>
	    Robert Dewar  <dewar@adacore.com>

	* lib-xref.adb (Get_Type_Reference): For a private type whose full
	view is an array type, indicate the component type as well, for
	navigation purposes.
	(Generate_Reference): Don't consider array ref on LHS to be a case
	of violating pragma Unreferenced.
	Do not give Ada 2005 warning except on real reference.

From-SVN: r111077
parent ae8926a0
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1998-2005, Free Software Foundation, Inc. -- -- Copyright (C) 1998-2006, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -260,8 +260,7 @@ package body Lib.Xref is ...@@ -260,8 +260,7 @@ package body Lib.Xref is
end if; end if;
end loop; end loop;
-- Parent (N) is an assignment statement, check whether -- Parent (N) is assignment statement, check whether N is its name
-- N is its name.
return Name (Parent (N)) = N; return Name (Parent (N)) = N;
end Is_On_LHS; end Is_On_LHS;
...@@ -277,21 +276,23 @@ package body Lib.Xref is ...@@ -277,21 +276,23 @@ package body Lib.Xref is
Check_Restriction (No_Obsolescent_Features, N); Check_Restriction (No_Obsolescent_Features, N);
end if; end if;
-- Warn if reference to Ada 2005 entity not in Ada 2005 mode -- Warn if reference to Ada 2005 entity not in Ada 2005 mode. We only
-- detect real explicit references (modifications and references).
if Is_Ada_2005 (E) if Is_Ada_2005 (E)
and then Ada_Version < Ada_05 and then Ada_Version < Ada_05
and then Warn_On_Ada_2005_Compatibility and then Warn_On_Ada_2005_Compatibility
and then (Typ = 'm' or else Typ = 'r')
then then
Error_Msg_NE ("& is only defined in Ada 2005?", N, E); Error_Msg_NE ("& is only defined in Ada 2005?", N, E);
end if; end if;
-- Never collect references if not in main source unit. However, -- Never collect references if not in main source unit. However, we omit
-- we omit this test if Typ is 'e' or 'k', since these entries are -- this test if Typ is 'e' or 'k', since these entries are structural,
-- really structural, and it is useful to have them in units -- and it is useful to have them in units that reference packages as
-- that reference packages as well as units that define packages. -- well as units that define packages. We also omit the test for the
-- We also omit the test for the case of 'p' since we want to -- case of 'p' since we want to include inherited primitive operations
-- include inherited primitive operations from other packages. -- from other packages.
if not In_Extended_Main_Source_Unit (N) if not In_Extended_Main_Source_Unit (N)
and then Typ /= 'e' and then Typ /= 'e'
...@@ -397,12 +398,9 @@ package body Lib.Xref is ...@@ -397,12 +398,9 @@ package body Lib.Xref is
null; null;
-- Neither does a reference to a variable on the left side -- Neither does a reference to a variable on the left side
-- of an assignment -- of an assignment.
elsif Ekind (E) = E_Variable elsif Is_On_LHS (N) then
and then Nkind (Parent (N)) = N_Assignment_Statement
and then Name (Parent (N)) = N
then
null; null;
-- For entry formals, we want to place the warning on the -- For entry formals, we want to place the warning on the
...@@ -720,12 +718,22 @@ package body Lib.Xref is ...@@ -720,12 +718,22 @@ package body Lib.Xref is
elsif Is_Private_Type (Tref) elsif Is_Private_Type (Tref)
and then Present (Full_View (Tref)) and then Present (Full_View (Tref))
and then Is_Access_Type (Full_View (Tref))
then then
if Is_Access_Type (Full_View (Tref)) then
Tref := Directly_Designated_Type (Full_View (Tref)); Tref := Directly_Designated_Type (Full_View (Tref));
Left := '('; Left := '(';
Right := ')'; Right := ')';
-- If the full view is an array type, we also retrieve
-- the corresponding component type, because the ali
-- entry already indicates that this is an array.
elsif Is_Array_Type (Full_View (Tref)) then
Tref := Component_Type (Full_View (Tref));
Left := '(';
Right := ')';
end if;
-- If non-derived array, get component type. -- If non-derived array, get component type.
-- Skip component type for case of String -- Skip component type for case of String
-- or Wide_String, saves worthwhile space. -- or Wide_String, saves worthwhile space.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment