[Ada] Unnesting: handle conditional expressions
authorEd Schonberg <schonberg@adacore.com>
Thu, 4 Jul 2019 08:05:50 +0000 (08:05 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 4 Jul 2019 08:05:50 +0000 (08:05 +0000)
2019-07-04  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* exp_unst.adb: Handle conditional expressions.

From-SVN: r273053

gcc/ada/ChangeLog
gcc/ada/exp_unst.adb

index 07c37477b58cfd0a6a540465761ea1127f3f9cd4..c60ab6dec793f079bad0c5add54db0a4781e50af 100644 (file)
@@ -1,3 +1,7 @@
+2019-07-04  Ed Schonberg  <schonberg@adacore.com>
+
+       * exp_unst.adb: Handle conditional expressions.
+
 2019-07-04  Yannick Moy  <moy@adacore.com>
 
        * sem_spark.adb (Check_Package_Spec, Check_Package_Body): Only
index b81b1b97a2d4f64fe34a6a8effe125fe8bcd7037..6717610bfbe12d8344f5807b556a4db25aa0c3c6 100644 (file)
@@ -598,6 +598,33 @@ package body Exp_Unst is
                   then
                      Note_Uplevel_Bound (Prefix (N), Ref);
 
+                  --  Conditional expressions.
+
+                  elsif Nkind (N) = N_If_Expression then
+                     declare
+                        Expr : Node_Id;
+
+                     begin
+                        Expr := First (Expressions (N));
+                        while Present (Expr) loop
+                           Note_Uplevel_Bound (Expr, Ref);
+                           Next (Expr);
+                        end loop;
+                     end;
+
+                  elsif Nkind (N) = N_Case_Expression then
+                     declare
+                        Alternative : Node_Id;
+
+                     begin
+                        Note_Uplevel_Bound (Expression (N), Ref);
+
+                        Alternative := First (Alternatives (N));
+                        while Present (Alternative) loop
+                           Note_Uplevel_Bound (Expression (Alternative), Ref);
+                        end loop;
+                     end;
+
                   --  Conversion case
 
                   elsif Nkind (N) = N_Type_Conversion then