[Ada] Reflect ACT change of 2001-11-01

Geert Bosch bosch@darwin.gnat.com
Tue Dec 11 15:28:00 GMT 2001


2001-12-11  Ed Schonberg <schonber@gnat.com>

	* sem_ch10.adb (Install_Withed_Unit): If the unit is a generic instance
	that is the parent of other generics, the instance body replaces the 
	instance node.  Retrieve the instance of the spec, which is the one 
	that is visible in clients and within the body.

*** sem_ch10.adb	2001/09/18 20:02:56	1.402
--- sem_ch10.adb	2001/11/01 21:46:58	1.403
***************
*** 2708,2717 ****
     -------------------------
  
     procedure Install_Withed_Unit (With_Clause : Node_Id) is
!       Uname : constant Entity_Id := Entity (Name (With_Clause));
        P     : constant Entity_Id := Scope (Uname);
  
     begin
        --  We do not apply the restrictions to an internal unit unless
        --  we are compiling the internal unit as a main unit. This check
        --  is also skipped for dummy units (for missing packages).
--- 2708,2728 ----
     -------------------------
  
     procedure Install_Withed_Unit (With_Clause : Node_Id) is
!       Uname : Entity_Id := Entity (Name (With_Clause));
        P     : constant Entity_Id := Scope (Uname);
  
     begin
+       --  If the unit is a package instantiation, its body may have been
+       --  generated for an inner instance, and the instance now denotes the
+       --  body entity. For visibility purposes we need the instance in the
+       --  specification.
+ 
+       if Ekind (Uname) = E_Package_Body
+         and then Is_Generic_Instance (Uname)
+       then
+          Uname := Spec_Entity (Uname);
+       end if;
+ 
        --  We do not apply the restrictions to an internal unit unless
        --  we are compiling the internal unit as a main unit. This check
        --  is also skipped for dummy units (for missing packages).



More information about the Gcc-patches mailing list