+2013-01-03 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch3.adb (Expand_N_Object_Declaration): If the object has
+ a class-wide type and a renaming declaration is created for it,
+ preserve entity chain, which already contains generated internal
+ types. This ensures that freezing actions are properly generated
+ for all objects declared subsequently in the same scope, and
+ that debugging information is generated for them.
+ * sem_util.adb, sem_util.ads (we): New debugging routine, to
+ display entity chain of a given scope.
+
2013-01-03 Robert Dewar <dewar@adacore.com>
* exp_intr.adb: Minor reformatting.
Subtype_Mark => New_Occurrence_Of (Typ, Loc),
Name => Convert_Tag_To_Interface (Typ, Tag_Comp)));
- -- If the original entity comes from source, then mark the
- -- new entity as needing debug information, even though it's
- -- defined by a generated renaming that does not come from
- -- source, so that Materialize_Entity will be set on the
- -- entity when Debug_Renaming_Declaration is called during
- -- analysis.
-
- if Comes_From_Source (Def_Id) then
- Set_Debug_Info_Needed (Defining_Identifier (N));
- end if;
-
Analyze (N, Suppress => All_Checks);
-- Replace internal identifier of rewritten node by the
-- identifier found in the sources. We also have to exchange
-- entities containing their defining identifiers to ensure
-- the correct replacement of the object declaration by this
- -- object renaming declaration ---because these identifiers
+ -- object renaming declaration because these identifiers
-- were previously added by Enter_Name to the current scope.
-- We must preserve the homonym chain of the source entity
-- as well. We must also preserve the kind of the entity,
- -- which may be a constant.
+ -- which may be a constant. Preserve entity chain because
+ -- itypes may have been generated already, and the full
+ -- chain must be preserved for final freezing. Finally,
+ -- Preserve Comes_From_Source setting, so that debugging
+ -- and cross-referencing information is properly kept.
+
+ declare
+ New_Id : constant Entity_Id := Defining_Identifier (N);
+ Next_Temp : constant Entity_Id := Next_Entity (New_Id);
+ S_Flag : constant Boolean :=
+ Comes_From_Source (Def_Id);
- Set_Chars (Defining_Identifier (N), Chars (Def_Id));
- Set_Homonym (Defining_Identifier (N), Homonym (Def_Id));
- Set_Ekind (Defining_Identifier (N), Ekind (Def_Id));
- Exchange_Entities (Defining_Identifier (N), Def_Id);
+ begin
+ Set_Next_Entity (New_Id, Next_Entity (Def_Id));
+ Set_Next_Entity (Def_Id, Next_Temp);
+ Set_Chars (Defining_Identifier (N), Chars (Def_Id));
+ Set_Homonym (Defining_Identifier (N), Homonym (Def_Id));
+ Set_Ekind (Defining_Identifier (N), Ekind (Def_Id));
+ Set_Comes_From_Source (Def_Id, False);
+ Exchange_Entities (Defining_Identifier (N), Def_Id);
+ Set_Comes_From_Source (Def_Id, S_Flag);
+ end;
end;
end if;