Commit 25859971 by Gary Dismukes Committed by Arnaud Charlet

exp_ch8.adb (Expand_N_Package_Renaming_Declaration): In the case of a…

exp_ch8.adb (Expand_N_Package_Renaming_Declaration): In the case of a library-level package renaming...

2007-08-31  Gary Dismukes  <dismukes@adacore.com>

	* exp_ch8.adb (Expand_N_Package_Renaming_Declaration): In the case of a
	library-level package renaming, pass the declaration associated with
	the renaming's special debug variable to Qualify_Entity_Names to ensure
	that its encoded name is properly qualified.

	* exp_dbug.adb (Qualify_All_Entity_Names): Check for a variable entity
	occurring in the list of entities to qualify, and do not attempt to
	traverse an entity list in that case. Variables associated with
`	library-level package renamings can now occur in the table.

	* exp_dbug.ads: Revise documentation of the encoding for renaming
	declarations.

From-SVN: r127973
parent 55d4e6c0
...@@ -319,6 +319,14 @@ package body Exp_Ch8 is ...@@ -319,6 +319,14 @@ package body Exp_Ch8 is
end if; end if;
Analyze (Decl); Analyze (Decl);
-- Enter the debug variable in the qualification list, which
-- must be done at this point because auxiliary declarations
-- occur at the library level and aren't associated with a
-- normal scope.
Qualify_Entity_Names (Decl);
Pop_Scope; Pop_Scope;
end; end;
......
...@@ -1011,17 +1011,25 @@ package body Exp_Dbug is ...@@ -1011,17 +1011,25 @@ package body Exp_Dbug is
E := Defining_Entity (Name_Qualify_Units.Table (J)); E := Defining_Entity (Name_Qualify_Units.Table (J));
Qualify_Entity_Name (E); Qualify_Entity_Name (E);
Ent := First_Entity (E); -- Normally entities in the qualification list are scopes, but in the
while Present (Ent) loop -- case of a library-level package renaming there is an associated
Qualify_Entity_Name (Ent); -- variable that encodes the debugger name and that variable is
Next_Entity (Ent); -- entered in the list since it occurs in the Aux_Decls list of the
-- compilation and doesn't have a normal scope.
-- There are odd cases where Last_Entity (E) = E. This happens
-- in the case of renaming of packages. This test avoids getting if Ekind (E) /= E_Variable then
-- stuck in such cases. Ent := First_Entity (E);
while Present (Ent) loop
exit when Ent = E; Qualify_Entity_Name (Ent);
end loop; Next_Entity (Ent);
-- There are odd cases where Last_Entity (E) = E. This happens
-- in the case of renaming of packages. This test avoids
-- getting stuck in such cases.
exit when Ent = E;
end loop;
end if;
end loop; end loop;
end Qualify_All_Entity_Names; end Qualify_All_Entity_Names;
......
...@@ -603,8 +603,7 @@ package Exp_Dbug is ...@@ -603,8 +603,7 @@ package Exp_Dbug is
-- for most debugging formats. However, we do not ever need XD -- for most debugging formats. However, we do not ever need XD
-- encoding for enumeration base types, since here it is always -- encoding for enumeration base types, since here it is always
-- clear what the bounds are from the total number of enumeration -- clear what the bounds are from the total number of enumeration
-- literals, and of course we do not need to encode the dummy XR -- literals.
-- types generated for renamings.
-- typ___XD -- typ___XD
-- typ___XDL_lowerbound -- typ___XDL_lowerbound
...@@ -969,20 +968,23 @@ package Exp_Dbug is ...@@ -969,20 +968,23 @@ package Exp_Dbug is
-- Consider a renaming declaration of the form -- Consider a renaming declaration of the form
-- x typ renames y; -- x : typ renames y;
-- There is one case in which no special debugging information is required, -- There is one case in which no special debugging information is required,
-- namely the case of an object renaming where the backend allocates a -- namely the case of an object renaming where the back end allocates a
-- reference for the renamed variable, and the entity x is this reference. -- reference for the renamed variable, and the entity x is this reference.
-- The debugger can handle this case without any special processing or -- The debugger can handle this case without any special processing or
-- encoding (it won't know it was a renaming, but that does not matter). -- encoding (it won't know it was a renaming, but that does not matter).
-- All other cases of renaming generate a dummy type definition for -- All other cases of renaming generate a dummy variable for an entity
-- an entity whose name is: -- whose name is of the form:
-- x___XR for an object renaming -- x___XR_... for an object renaming
-- x___XRE for an exception renaming -- x___XRE_... for an exception renaming
-- x___XRP for a package renaming -- x___XRP_... for a package renaming
-- and where the "..." represents a suffix that describes the structure of
-- the object name given in the renaming (see details below).
-- The name is fully qualified in the usual manner, i.e. qualified in the -- The name is fully qualified in the usual manner, i.e. qualified in the
-- same manner as the entity x would be. In the case of a package renaming -- same manner as the entity x would be. In the case of a package renaming
...@@ -992,24 +994,24 @@ package Exp_Dbug is ...@@ -992,24 +994,24 @@ package Exp_Dbug is
-- Note: subprogram renamings are not encoded at the present time -- Note: subprogram renamings are not encoded at the present time
-- The type is an enumeration type with a single enumeration literal -- The suffix of the variable name describing the renamed object is
-- that is an identifier which describes the renamed variable. -- defined to use the following encoding:
-- For the simple entity case, where y is an entity name, -- For the simple entity case, where y is just an entity name, the suffix
-- the enumeration is of the form: -- is of the form:
-- (y___XE) -- y___XE
-- i.e. the enumeration type has a single field, whose name matches -- i.e. the suffix has a single field, the first part matching the
-- the name y, with the XE suffix. The entity for this enumeration -- name y, followed by a "___" separator, ending with sequence XE.
-- literal is fully qualified in the usual manner. All subprogram, -- The entity name portion is fully qualified in the usual manner.
-- exception, and package renamings fall into this category, as -- This same naming scheme is followed for all forms of encoded
-- well as simple object renamings. -- renamings that rename a simple entity.
-- For the object renaming case where y is a selected component or an -- For the object renaming case where y is a selected component or an
-- indexed component, the literal name is suffixed by additional fields -- indexed component, the variable name is suffixed by additional fields
-- that give details of the components. The name starts as above with a -- that give details of the components. The name starts as above with a
-- y___XE entity indicating the outer level variable. Then a series of -- y___XE name indicating the outer level object entity. Then a series of
-- selections and indexing operations can be specified as follows: -- selections and indexing operations can be specified as follows:
-- Indexed component -- Indexed component
...@@ -1020,20 +1022,19 @@ package Exp_Dbug is ...@@ -1020,20 +1022,19 @@ package Exp_Dbug is
-- XSnnn -- XSnnn
-- Here nnn is a constant value, encoded as a decimal -- Here nnn is a constant value, encoded as a decimal integer
-- integer (pos value for enumeration type case). Negative -- (pos value for enumeration type case). Negative values have
-- values have a trailing 'm' as usual. -- a trailing 'm' as usual.
-- XSe -- XSe
-- Here e is the (unqualified) name of a constant entity in -- Here e is the (unqualified) name of a constant entity in the
-- the same scope as the renaming which contains the subscript -- same scope as the renaming which contains the subscript value.
-- value.
-- Slice -- Slice
-- For the slice case, we have two entries. The first is for the -- For the slice case, we have two entries. The first is for the
-- lower bound of the slice, and has the form -- lower bound of the slice, and has the form:
-- XLnnn -- XLnnn
-- XLe -- XLe
...@@ -1069,21 +1070,24 @@ package Exp_Dbug is ...@@ -1069,21 +1070,24 @@ package Exp_Dbug is
-- z : string renames g (1,5).m(2 ..3) -- z : string renames g (1,5).m(2 ..3)
-- end p; -- end p;
-- The generated type definition would appear as -- The generated variable entity would appear as
-- p__z___XR_p__g___XEXS1XS5XRmXL2XS3 : _renaming_type;
-- p__g___XE--------------------outer entity is g
-- XS1-----------------first subscript for g
-- XS5--------------second subscript for g
-- XRm-----------select field m
-- XL2--------lower bound of slice
-- XS3-----upper bound of slice
-- type p__z___XR is -- Note that the type of the variable is a special internal type named
-- (p__g___XEXS1XS5XRmXL2XS3); -- _renaming_type. This type is an arbitrary type of zero size created
-- p__g___XE--------------------outer entity is g -- in package Standard (see cstand.adb) and is ignored by the debugger.
-- XS1-----------------first subscript for g
-- XS5--------------second subscript for g
-- XRm-----------select field m
-- XL2--------lower bound of slice
-- XS3-----upper bound of slice
function Debug_Renaming_Declaration (N : Node_Id) return Node_Id; function Debug_Renaming_Declaration (N : Node_Id) return Node_Id;
-- The argument N is a renaming declaration. The result is a type -- The argument N is a renaming declaration. The result is a variable
-- declaration as described in the above paragraphs. If not special -- declaration as described in the above paragraphs. If N is not a special
-- debug declaration, than Empty is returned. -- debug declaration, then Empty is returned.
--------------------------- ---------------------------
-- Packed Array Encoding -- -- Packed Array Encoding --
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment