aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2014-08-01 13:50:32 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2014-08-01 15:50:32 +0200
commit38cea80dc4d9718ea56f959e199ef9d27303e438 (patch)
tree2baba41748d37eb8c97408b02e552b72cf6fa728
parentbf0b0e5ee1c756b593f8e8d0456504575ac63218 (diff)
downloadgcc-38cea80dc4d9718ea56f959e199ef9d27303e438.zip
gcc-38cea80dc4d9718ea56f959e199ef9d27303e438.tar.gz
gcc-38cea80dc4d9718ea56f959e199ef9d27303e438.tar.bz2
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
-rw-r--r--gcc/ada/ChangeLog10
-rw-r--r--gcc/ada/sem_ch3.adb18
-rw-r--r--gcc/ada/sem_ch8.adb19
3 files changed, 45 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index e7f05cb..225c24c 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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.
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index dc09c449..a713057 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -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 ..
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 43eeeb2..5cdb324 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -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).