exp_ch3.adb (Expand_N_Object_Declaration): If the object has a class-wide type and a renaming declaration is created for it...
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. From-SVN: r194843
This commit is contained in:
parent
329ea7ece2
commit
c1ce069176
4 changed files with 54 additions and 18 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
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>
|
2013-01-03 Robert Dewar <dewar@adacore.com>
|
||||||
|
|
||||||
* exp_intr.adb: Minor reformatting.
|
* exp_intr.adb: Minor reformatting.
|
||||||
|
|
|
@ -5315,33 +5315,38 @@ package body Exp_Ch3 is
|
||||||
Subtype_Mark => New_Occurrence_Of (Typ, Loc),
|
Subtype_Mark => New_Occurrence_Of (Typ, Loc),
|
||||||
Name => Convert_Tag_To_Interface (Typ, Tag_Comp)));
|
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);
|
Analyze (N, Suppress => All_Checks);
|
||||||
|
|
||||||
-- Replace internal identifier of rewritten node by the
|
-- Replace internal identifier of rewritten node by the
|
||||||
-- identifier found in the sources. We also have to exchange
|
-- identifier found in the sources. We also have to exchange
|
||||||
-- entities containing their defining identifiers to ensure
|
-- entities containing their defining identifiers to ensure
|
||||||
-- the correct replacement of the object declaration by this
|
-- 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.
|
-- were previously added by Enter_Name to the current scope.
|
||||||
-- We must preserve the homonym chain of the source entity
|
-- We must preserve the homonym chain of the source entity
|
||||||
-- as well. We must also preserve the kind of the 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.
|
||||||
|
|
||||||
Set_Chars (Defining_Identifier (N), Chars (Def_Id));
|
declare
|
||||||
Set_Homonym (Defining_Identifier (N), Homonym (Def_Id));
|
New_Id : constant Entity_Id := Defining_Identifier (N);
|
||||||
Set_Ekind (Defining_Identifier (N), Ekind (Def_Id));
|
Next_Temp : constant Entity_Id := Next_Entity (New_Id);
|
||||||
Exchange_Entities (Defining_Identifier (N), Def_Id);
|
S_Flag : constant Boolean :=
|
||||||
|
Comes_From_Source (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;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
|
|
|
@ -8531,4 +8531,21 @@ package body Sem_Ch8 is
|
||||||
end loop;
|
end loop;
|
||||||
end ws;
|
end ws;
|
||||||
|
|
||||||
|
--------
|
||||||
|
-- we --
|
||||||
|
--------
|
||||||
|
|
||||||
|
procedure we (S : Entity_Id) is
|
||||||
|
E : Entity_Id;
|
||||||
|
begin
|
||||||
|
E := First_Entity (S);
|
||||||
|
while Present (E) loop
|
||||||
|
Write_Int (Int (E));
|
||||||
|
Write_Str (" === ");
|
||||||
|
Write_Name (Chars (E));
|
||||||
|
Write_Eol;
|
||||||
|
|
||||||
|
Next_Entity (E);
|
||||||
|
end loop;
|
||||||
|
end we;
|
||||||
end Sem_Ch8;
|
end Sem_Ch8;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
-- --
|
-- --
|
||||||
-- S p e c --
|
-- S p e c --
|
||||||
-- --
|
-- --
|
||||||
-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
|
-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
|
||||||
-- --
|
-- --
|
||||||
-- GNAT is free software; you can redistribute it and/or modify it under --
|
-- GNAT is free software; you can redistribute it and/or modify it under --
|
||||||
-- terms of the GNU General Public License as published by the Free Soft- --
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
||||||
|
@ -169,4 +169,7 @@ package Sem_Ch8 is
|
||||||
procedure ws;
|
procedure ws;
|
||||||
-- Debugging routine for use in gdb: dump all entities on scope stack
|
-- Debugging routine for use in gdb: dump all entities on scope stack
|
||||||
|
|
||||||
|
procedure we (S : Entity_Id);
|
||||||
|
-- Debugging routine for use in gdb: dump all entities in given scope
|
||||||
|
|
||||||
end Sem_Ch8;
|
end Sem_Ch8;
|
||||||
|
|
Loading…
Add table
Reference in a new issue