Since we are reaching through renamings in Alfa mode, we may end up with a
reference to a standard constants. Ignore those.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-09-19  Yannick Moy  <m...@adacore.com>

        * lib-xref.adb (Generate_Reference): Ignore references to
        constants in Standard.

Index: lib-xref.adb
===================================================================
--- lib-xref.adb        (revision 178959)
+++ lib-xref.adb        (working copy)
@@ -1010,8 +1010,17 @@
          if Alfa_Mode then
             Ref_Scope := Alfa.Enclosing_Subprogram_Or_Package (N);
             Ent_Scope := Alfa.Enclosing_Subprogram_Or_Package (Ent);
+
+            --  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;

Reply via email to