Commit deb4f5ba by Ed Schonberg Committed by Arnaud Charlet

sem_ch3.adb (Analyze_Full_Type_Declaration): If the declaration is a completion…

sem_ch3.adb (Analyze_Full_Type_Declaration): If the declaration is a completion and aspects are present...

2011-08-04  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Analyze_Full_Type_Declaration): If the declaration is a
	completion and aspects are present, apply them to the entity for the
	type which is currently the partial view, but which is the one that
	will be frozen.
	* sem_ch13.adb (Analyze_Aspect_Specifications): if the predicate
	applies to a partial view, indicate that the full view has predicates
	and delayed aspects.
	(Replace_Type_Reference): Handle properly predicates that apply to the
	full view of a private completion.

From-SVN: r177340
parent fc893455
2011-08-04 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Analyze_Full_Type_Declaration): If the declaration is a
completion and aspects are present, apply them to the entity for the
type which is currently the partial view, but which is the one that
will be frozen.
* sem_ch13.adb (Analyze_Aspect_Specifications): if the predicate
applies to a partial view, indicate that the full view has predicates
and delayed aspects.
(Replace_Type_Reference): Handle properly predicates that apply to the
full view of a private completion.
2011-08-04 Eric Botcazou <ebotcazou@adacore.com>
* layout.adb (Layout_Type): For composite types, do not set Esize.
......
......@@ -695,8 +695,8 @@ package body Sem_Ch13 is
-- Insert pragmas (except Pre/Post/Invariant/Predicate) after this node
-- The general processing involves building an attribute definition
-- clause or a pragma node that corresponds to the access type. Then
-- one of two things happens:
-- clause or a pragma node that corresponds to the aspect. Then one
-- of two things happens:
-- If we are required to delay the evaluation of this aspect to the
-- freeze point, we attach the corresponding pragma/attribute definition
......@@ -1238,6 +1238,14 @@ package body Sem_Ch13 is
-- have a place to build the predicate function).
Set_Has_Predicates (E);
if Is_Private_Type (E)
and then Present (Full_View (E))
then
Set_Has_Predicates (Full_View (E));
Set_Has_Delayed_Aspects (Full_View (E));
end if;
Ensure_Freeze_Node (E);
Set_Is_Delayed_Aspect (Aspect);
Delay_Required := True;
......@@ -4221,8 +4229,13 @@ package body Sem_Ch13 is
Arg2 := Get_Pragma_Arg (Arg2);
-- See if this predicate pragma is for the current type
-- or for its full view. A predicate on a private completion
-- is placed on the partial view beause this is the visible
-- entity that is frozen..
if Entity (Arg1) = Typ then
if Entity (Arg1) = Typ
or else Full_View (Entity (Arg1)) = Typ
then
-- We have a match, this entry is for our subtype
......
......@@ -2500,8 +2500,16 @@ package body Sem_Ch3 is
Set_Optimize_Alignment_Flags (Def_Id);
Check_Eliminated (Def_Id);
-- If the declaration is a completion and aspects are present, apply
-- them to the entity for the type which is currently the partial
-- view, but which is the one that will be frozen.
if Has_Aspects (N) then
Analyze_Aspect_Specifications (N, Def_Id);
if Prev /= Def_Id then
Analyze_Aspect_Specifications (N, Prev);
else
Analyze_Aspect_Specifications (N, Def_Id);
end if;
end if;
end Analyze_Full_Type_Declaration;
......
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