]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Check predicates for subtypes of private types
authorBob Duff <duff@adacore.com>
Sat, 16 May 2020 15:59:50 +0000 (11:59 -0400)
committerGiuliano Belinassi <giuliano.belinassi@usp.br>
Mon, 17 Aug 2020 16:16:42 +0000 (13:16 -0300)
gcc/ada/

* sem_ch13.adb (Analyze_Aspect_Specifications): Add freeze node
for the Underlying_Full_View if it exists. The freeze node is
what triggers the generation of the predicate function.
* freeze.adb: Minor reformatting.

gcc/ada/freeze.adb
gcc/ada/sem_ch13.adb

index 7c6fac155ee08606430f73a31caae1f237602965..cb32f9d3c139db7a5a1413603b049ba135441216 100644 (file)
@@ -6175,8 +6175,7 @@ package body Freeze is
 
                         if Present (F_Node) then
                            Inherit_Freeze_Node
-                             (Fnod => F_Node,
-                              Typ  => Full_View (E));
+                             (Fnod => F_Node, Typ => Full_View (E));
                         else
                            Set_Has_Delayed_Freeze (Full_View (E), False);
                            Set_Freeze_Node (Full_View (E), Empty);
@@ -6187,9 +6186,7 @@ package body Freeze is
                         F_Node := Freeze_Node (Full_View (E));
 
                         if Present (F_Node) then
-                           Inherit_Freeze_Node
-                             (Fnod => F_Node,
-                              Typ  => E);
+                           Inherit_Freeze_Node (Fnod => F_Node, Typ => E);
                         else
                            --  {Incomplete,Private}_Subtypes with Full_Views
                            --  constrained by discriminants.
index f854711a0a5a0674d66924d9985816437b7a66db..4c8c650b427984001948d0639727e4b565ed4e1c 100644 (file)
@@ -3051,6 +3051,21 @@ package body Sem_Ch13 is
 
                      Set_Has_Delayed_Aspects (Full_View (E));
                      Ensure_Freeze_Node (Full_View (E));
+
+                     --  If there is an Underlying_Full_View, also create a
+                     --  freeze node for that one.
+
+                     if Is_Private_Type (Full_View (E)) then
+                        declare
+                           U_Full : constant Entity_Id :=
+                             Underlying_Full_View (Full_View (E));
+                        begin
+                           if Present (U_Full) then
+                              Set_Has_Delayed_Aspects (U_Full);
+                              Ensure_Freeze_Node (U_Full);
+                           end if;
+                        end;
+                     end if;
                   end if;
 
                --  Predicate_Failure