Commit 0d354370 by Arnaud Charlet

[multiple changes]

2009-06-23  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch10.adb (Remove_Limited_With_Clause): Clean up code that handles
	incomplete type declarations. Previous code was potentially quadratic
	in the number of visible declarations in any package appearing in a
	limited_with_clause.

2009-06-23  Robert Dewar  <dewar@adacore.com>

	* prj-conf.ads, prj-part.adb, prj-proc.adb, prj-proc.ads, sem_ch8.adb,
	xref_lib.adb: Minor reformatting

From-SVN: r148843
parent 85b7d482
2009-06-23 Ed Schonberg <schonberg@adacore.com>
* sem_ch10.adb (Remove_Limited_With_Clause): Clean up code that handles
incomplete type declarations. Previous code was potentially quadratic
in the number of visible declarations in any package appearing in a
limited_with_clause.
2009-06-23 Robert Dewar <dewar@adacore.com>
* prj-conf.ads, prj-part.adb, prj-proc.adb, prj-proc.ads, sem_ch8.adb,
xref_lib.adb: Minor reformatting
2009-06-23 Robert Dewar <dewar@adacore.com> 2009-06-23 Robert Dewar <dewar@adacore.com>
* a-stzhas.adb: Provide dummy body to avoid build problems with old * a-stzhas.adb: Provide dummy body to avoid build problems with old
......
...@@ -35,11 +35,11 @@ package Prj.Conf is ...@@ -35,11 +35,11 @@ package Prj.Conf is
Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref); Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref);
-- Hook called after the config file has been parsed. This lets the -- Hook called after the config file has been parsed. This lets the
-- application do last minute changes to it (GPS uses this to add the -- application do last minute changes to it (GPS uses this to add the
-- default naming schemes for instance). -- default naming schemes for instance). At that point, the config file
-- At that point, the config file has not been applied to the project yet. -- has not been applied to the project yet. When no config file was found,
-- When no config file was found, and automatic generation is disabled, it -- and automatic generation is disabled, it is possible that Config_File
-- is possible that Config_File is set to Empty_Node when this procedure is -- is set to Empty_Node when this procedure is called. You can then decide
-- called. You can then decide to create a new config file if you need. -- to create a new config file if you need.
procedure Parse_Project_And_Apply_Config procedure Parse_Project_And_Apply_Config
(Main_Project : out Prj.Project_Id; (Main_Project : out Prj.Project_Id;
......
...@@ -1227,6 +1227,7 @@ package body Prj.Part is ...@@ -1227,6 +1227,7 @@ package body Prj.Part is
end if; end if;
if Is_Config_File and then Proj_Qualifier = Unspecified then if Is_Config_File and then Proj_Qualifier = Unspecified then
-- Set the qualifier to Configuration, even if the token doesn't -- Set the qualifier to Configuration, even if the token doesn't
-- exist in the source file itself, so that we can differentiate -- exist in the source file itself, so that we can differentiate
-- project files and configuration files later on. -- project files and configuration files later on.
......
...@@ -180,7 +180,6 @@ package body Prj.Proc is ...@@ -180,7 +180,6 @@ package body Prj.Proc is
elsif Str /= No_Name and then Str /= Empty_String then elsif Str /= No_Name and then Str /= Empty_String then
declare declare
S : constant String := Get_Name_String (Str); S : constant String := Get_Name_String (Str);
begin begin
Get_Name_String (To_Exp); Get_Name_String (To_Exp);
Add_Str_To_Name_Buffer (S); Add_Str_To_Name_Buffer (S);
...@@ -301,6 +300,7 @@ package body Prj.Proc is ...@@ -301,6 +300,7 @@ package body Prj.Proc is
Data.When_No_Sources := When_No_Sources; Data.When_No_Sources := When_No_Sources;
Data.Is_Config_File := Is_Config_File; Data.Is_Config_File := Is_Config_File;
Data.Compiler_Driver_Mandatory := Compiler_Driver_Mandatory; Data.Compiler_Driver_Mandatory := Compiler_Driver_Mandatory;
Initialize (Data.Proc_Data); Initialize (Data.Proc_Data);
Check_All_Projects (Project, Data, Imported_First => True); Check_All_Projects (Project, Data, Imported_First => True);
......
...@@ -5650,26 +5650,30 @@ package body Sem_Ch10 is ...@@ -5650,26 +5650,30 @@ package body Sem_Ch10 is
if Ekind (Lim_Typ) /= E_Package if Ekind (Lim_Typ) /= E_Package
and then not Is_Child_Unit (Non_Limited_View (Lim_Typ)) and then not Is_Child_Unit (Non_Limited_View (Lim_Typ))
then then
-- Handle incomplete types of the real view. For this purpose
-- we traverse the list of visible entities to look for an
-- incomplete type in the real-view associated with Lim_Typ.
E := First_Entity (P); -- If the package has incomplete types, the limited view
while Present (E) and then E /= First_Private_Entity (P) loop -- of the incomplete type is in fact never visible (AI05-129)
exit when Ekind (E) = E_Incomplete_Type -- but we have created a shadow entity E1 for it, that points
and then Present (Full_View (E)) -- to E2, a non-limited incomplete type. This in turn has a
and then Full_View (E) = Lim_Typ; -- full view E3 that is the full declaration. There is a
-- corresponding shadow entity E4. When reinstalling the
-- non-limited view, E2 must become the current entity and
-- E3 must be ignored.
Next_Entity (E); E := Non_Limited_View (Lim_Typ);
end loop;
if Present (Current_Entity (E))
and then Ekind (Current_Entity (E)) = E_Incomplete_Type
and then Full_View (Current_Entity (E)) = E
then
-- If the previous search was not successful then the entity -- Lim_Typ is the limited view of a full type declaration
-- to be restored in the homonym list is the non-limited view -- that has a previous incomplete declaration, i.e. E3
-- from the previous description. Nothing to insert.
if E = First_Private_Entity (P) then null;
E := Non_Limited_View (Lim_Typ);
end if;
else
pragma Assert (not In_Chain (E)); pragma Assert (not In_Chain (E));
Prev := Current_Entity (Lim_Typ); Prev := Current_Entity (Lim_Typ);
...@@ -5689,12 +5693,11 @@ package body Sem_Ch10 is ...@@ -5689,12 +5693,11 @@ package body Sem_Ch10 is
end if; end if;
end if; end if;
-- We must also set the next homonym entity of the real entity -- Preserve structure of homonym chain.
-- to handle the case in which the next homonym was a shadow
-- entity.
Set_Homonym (E, Homonym (Lim_Typ)); Set_Homonym (E, Homonym (Lim_Typ));
end if; end if;
end if;
Next_Entity (Lim_Typ); Next_Entity (Lim_Typ);
end loop; end loop;
......
...@@ -4773,10 +4773,10 @@ package body Sem_Ch8 is ...@@ -4773,10 +4773,10 @@ package body Sem_Ch8 is
then then
declare declare
H : constant Entity_Id := Homonym (P_Name); H : constant Entity_Id := Homonym (P_Name);
begin begin
Id := First_Entity (H); Id := First_Entity (H);
while Present (Id) loop while Present (Id) loop
if Chars (Id) = Chars (Selector) then if Chars (Id) = Chars (Selector) then
Error_Msg_Qual_Level := 99; Error_Msg_Qual_Level := 99;
Error_Msg_Name_1 := Chars (Selector); Error_Msg_Name_1 := Chars (Selector);
......
...@@ -49,7 +49,7 @@ package body Xref_Lib is ...@@ -49,7 +49,7 @@ package body Xref_Lib is
No_Xref_Information : exception; No_Xref_Information : exception;
-- Exception raised when there is no cross-referencing information in -- Exception raised when there is no cross-referencing information in
-- the .ali files -- the .ali files.
procedure Parse_EOL procedure Parse_EOL
(Source : not null access String; (Source : not null access String;
...@@ -708,9 +708,9 @@ package body Xref_Lib is ...@@ -708,9 +708,9 @@ package body Xref_Lib is
Ptr := Ptr + 1; Ptr := Ptr + 1;
end loop; end loop;
if Source (Ptr) /= EOF then -- Skip CR or LF if not at end of file
-- Skip CR or LF
if Source (Ptr) /= EOF then
Ptr := Ptr + 1; Ptr := Ptr + 1;
end if; end if;
......
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