OSDN Git Service

2004-01-12 Laurent Pautet <pautet@act-europe.fr>
[pf3gnuchains/gcc-fork.git] / gcc / ada / lib-xref.adb
index bc663a1..64ae4b7 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1998-2003, Free Software Foundation, Inc.         --
+--          Copyright (C) 1998-2004, 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- --
@@ -604,9 +604,7 @@ package body Lib.Xref is
                      exit;
                   end if;
 
-               --  For a subtype, go to ancestor subtype. If it is a
-               --  subtype created for a generic actual, not clear yet
-               --  what is the right type to use ???
+               --  For a subtype, go to ancestor subtype.
 
                else
                   Tref := Ancestor_Subtype (Tref);
@@ -651,6 +649,19 @@ package body Lib.Xref is
             if Sloc (Tref) = Standard_Location
               or else Comes_From_Source (Tref)
             then
+               --  If the reference is a subtype created for a generic
+               --  actual, go to actual directly, the inner subtype is
+               --  not user visible.
+
+               if Nkind (Parent (Tref)) = N_Subtype_Declaration
+                 and then not Comes_From_Source (Parent (Tref))
+                 and then
+                  (Is_Wrapper_Package (Scope (Tref))
+                     or else Is_Generic_Instance (Scope (Tref)))
+               then
+                  Tref := Base_Type (Tref);
+               end if;
+
                return;
             end if;
          end loop;