aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2011-08-04 09:11:43 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2011-08-04 11:11:43 +0200
commitdeb4f5ba328e83f81427014132325c7a1d59b7bb (patch)
treedeef39de473ca58b796b1a0c8fd4be7678630b57 /gcc
parentfc893455a5c2c9238f077412cf5a0bdc29abed34 (diff)
downloadgcc-deb4f5ba328e83f81427014132325c7a1d59b7bb.zip
gcc-deb4f5ba328e83f81427014132325c7a1d59b7bb.tar.gz
gcc-deb4f5ba328e83f81427014132325c7a1d59b7bb.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog12
-rw-r--r--gcc/ada/sem_ch13.adb19
-rw-r--r--gcc/ada/sem_ch3.adb10
3 files changed, 37 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 019f5a2..6ce0420 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,15 @@
+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.
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index c3816cc..0423d61 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -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
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index d31aea0..0586b71 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -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;