sem_ch3.adb (Access_Type_Declaration): If designated type is a limited view...

2014-08-01  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Access_Type_Declaration): If designated type is
	a limited view, create a master entity (as is already done for
	class-wide types) in case the full view designates a type that
	contains tasks.
	* sem_ch8.adb (Find_Selected_Component): If prefix is a dereference
	and the designated type is a limited view, use the non-limited
	view if available.

From-SVN: r213464
This commit is contained in:
Ed Schonberg 2014-08-01 13:50:32 +00:00 committed by Arnaud Charlet
parent bf0b0e5ee1
commit 38cea80dc4
3 changed files with 45 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2014-08-01 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Access_Type_Declaration): If designated type is
a limited view, create a master entity (as is already done for
class-wide types) in case the full view designates a type that
contains tasks.
* sem_ch8.adb (Find_Selected_Component): If prefix is a dereference
and the designated type is a limited view, use the non-limited
view if available.
2014-08-01 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/ada-tree.h (DECL_BY_DESCRIPTOR_P): Delete.

View File

@ -1331,9 +1331,23 @@ package body Sem_Ch3 is
if Ekind (Root_Type (Entity (S))) = E_Incomplete_Type then
Set_Directly_Designated_Type (T, Entity (S));
-- If the designated type is a limited view, we cannot tell if
-- the full view contains tasks, and there is no way to handle
-- that full view in a client. We create a master entity for the
-- scope, which will be used when a client determines that one
-- is needed.
if From_Limited_With (Entity (S))
and then not Is_Class_Wide_Type (Entity (S))
then
Set_Ekind (T, E_Access_Type);
Build_Master_Entity (T);
Build_Master_Renaming (T);
end if;
else
Set_Directly_Designated_Type (T,
Process_Subtype (S, P, T, 'P'));
Set_Directly_Designated_Type (T, Process_Subtype (S, P, T, 'P'));
end if;
-- If the access definition is of the form: ACCESS NOT NULL ..

View File

@ -6236,6 +6236,25 @@ package body Sem_Ch8 is
Write_Entity_Info (P_Type, " "); Write_Eol;
end if;
-- The designated type may be a limited view with no components.
-- Check whether the non-limited view is available, because in some
-- cases this will not be set when instlling the context.
if Is_Access_Type (P_Type) then
declare
D : constant Entity_Id := Directly_Designated_Type (P_Type);
begin
if Is_Incomplete_Type (D)
and then not Is_Class_Wide_Type (D)
and then From_Limited_With (D)
and then Present (Non_Limited_View (D))
and then not Is_Class_Wide_Type (Non_Limited_View (D))
then
Set_Directly_Designated_Type (P_Type, Non_Limited_View (D));
end if;
end;
end if;
-- First check for components of a record object (not the
-- result of a call, which is handled below).