sem_ch3.adb (Access_Type_Declaration): If designated type is a limited view...
authorEd Schonberg <schonberg@adacore.com>
Fri, 1 Aug 2014 13:50:32 +0000 (13:50 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 1 Aug 2014 13:50:32 +0000 (15:50 +0200)
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

gcc/ada/ChangeLog
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch8.adb

index e7f05cb90e89c7fac35a27216a0fcc71c04a0987..225c24cafa3dec794b31be67880564569a219d80 100644 (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.
index dc09c449a8a4ec76e32e475cda33f66e3bd2d742..a713057db211b498a5a608d7ed3134b28c7b3175 100644 (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 ..
index 43eeeb2a96a56001eab8371dfc7129189209d0b8..5cdb324951658eb77ab1eb7d2c7f586463fb140e 100644 (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).