Patchwork [Ada] Ignore references to renamed Standard constants in Alfa mode

login
register
mail settings
Submitter Arnaud Charlet
Date Sept. 19, 2011, 9:04 a.m.
Message ID <20110919090413.GA25885@adacore.com>
Download mbox | patch
Permalink /patch/115310/
State New
Headers show

Comments

Arnaud Charlet - Sept. 19, 2011, 9:04 a.m.
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  <moy@adacore.com>

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

Patch

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;