+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.
-- 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
-- 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;
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
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;