OSDN Git Service

2011-10-16 Tristan Gingold <gingold@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / lib-xref.adb
index f50406f..83a06e4 100644 (file)
@@ -1010,8 +1010,17 @@ package body Lib.Xref is
          if Alfa_Mode then
             Ref_Scope := Alfa.Enclosing_Subprogram_Or_Package (N);
             Ent_Scope := Alfa.Enclosing_Subprogram_Or_Package (Ent);
-            Ent_Scope_File := Get_Source_Unit (Ent_Scope);
 
+            --  Since we are reaching through renamings in Alfa mode, we may
+            --  end up with standard constants. Ignore those.
+
+            if Sloc (Ent_Scope) <= Standard_Location
+              or else Def <= Standard_Location
+            then
+               return;
+            end if;
+
+            Ent_Scope_File := Get_Source_Unit (Ent_Scope);
          else
             Ref_Scope := Empty;
             Ent_Scope := Empty;
@@ -1901,7 +1910,9 @@ package body Lib.Xref is
 
                      Op := Ultimate_Alias (Old_E);
 
-                  --  Normal case of no alias present
+                  --  Normal case of no alias present. We omit generated
+                  --  primitives like tagged equality, that have no source
+                  --  representation.
 
                   else
                      Op := Old_E;
@@ -1909,6 +1920,7 @@ package body Lib.Xref is
 
                   if Present (Op)
                     and then Sloc (Op) /= Standard_Location
+                    and then Comes_From_Source (Op)
                   then
                      declare
                         Loc      : constant Source_Ptr := Sloc (Op);