]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Reuse Boolean_Literals in rewriting of accessibility checks
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 25 Mar 2025 12:34:11 +0000 (13:34 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 4 Jun 2026 08:42:20 +0000 (10:42 +0200)
Code cleanup; semantics is unaffected.

gcc/ada/ChangeLog:

* exp_ch4.adb (Expand_N_In): Rewrite with True/False entity array.

gcc/ada/exp_ch4.adb

index 232ba1be97a2bee483abc525914492ef3e5b0ef6..dc4d32610826367bd01c65668018b1fcca202aad 100644 (file)
@@ -7219,14 +7219,13 @@ package body Exp_Ch4 is
                   --  since we cannot rely on dynamic levels.
 
                   if No_Dynamic_Accessibility_Checks_Enabled (Lop) then
-                     if Static_Accessibility_Level
-                          (Lop, Object_Decl_Level)
-                            > Type_Access_Level (Rtyp)
-                     then
-                        Rewrite (N, New_Occurrence_Of (Standard_False, Loc));
-                     else
-                        Rewrite (N, New_Occurrence_Of (Standard_True, Loc));
-                     end if;
+                     Rewrite (N,
+                       New_Occurrence_Of
+                         (Boolean_Literals
+                            (Static_Accessibility_Level
+                               (Lop, Object_Decl_Level) <=
+                                        Type_Access_Level (Rtyp)),
+                          Loc));
                      Analyze_And_Resolve (N, Restyp);
 
                   --  If a conversion of the anonymous access value to the