Patchwork [Ada] Freezing of nested generic instantiations

login
register
mail settings
Submitter Arnaud Charlet
Date Jan. 30, 2012, 10:30 a.m.
Message ID <20120130103007.GA10116@adacore.com>
Download mbox | patch
Permalink /patch/138544/
State New
Headers show

Comments

Arnaud Charlet - Jan. 30, 2012, 10:30 a.m.
This patch corrects machinery which detects whether one node appears earlier in
the tree with respect to another node.

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

2012-01-30  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch12.adb (Earlier): Do not use the
	top level source locations of the two input nodes.

Patch

Index: sem_ch12.adb
===================================================================
--- sem_ch12.adb	(revision 183698)
+++ sem_ch12.adb	(working copy)
@@ -7142,13 +7142,12 @@ 
       end if;
 
       --  At this point either both nodes came from source or we approximated
-      --  their source locations through neighbouring source statements.
+      --  their source locations through neighbouring source statements. There
+      --  is no need to look at the top level locations of P1 and P2 because
+      --  both nodes are in the same list and whether the enclosing context is
+      --  instantiated is irrelevant.
 
-      if Top_Level_Location (Sloc (P1)) < Top_Level_Location (Sloc (P2)) then
-         return True;
-      else
-         return False;
-      end if;
+      return Sloc (P1) < Sloc (P2);
    end Earlier;
 
    ----------------------