]> gcc.gnu.org Git - gcc.git/commitdiff
ada: Maximize use of existing constant
authorRonan Desplanques <desplanques@adacore.com>
Fri, 3 Mar 2023 11:33:21 +0000 (12:33 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 25 May 2023 07:44:16 +0000 (09:44 +0200)
This patch does not change the behavior of the compiler and is
intended as a readability improvement.

gcc/ada/

* sem_ch3.adb (Replace_Type): Use existing constant wherever
possible.

gcc/ada/sem_ch3.adb

index c8af679b404c7b2a2339d76c85f348ca78bb481c..0bddfa8446308dfe3835745d435bdf20962426fd 100644 (file)
@@ -15994,7 +15994,7 @@ package body Sem_Ch3 is
             --  of the parent, and we can also use it rather than its base,
             --  which can lead to more efficient code.
 
-            if Etype (Id) = Parent_Type then
+            if Id_Type = Parent_Type then
                if Is_Scalar_Type (Parent_Type)
                  and then
                    Subtypes_Statically_Compatible (Parent_Type, Derived_Type)
@@ -16019,7 +16019,7 @@ package body Sem_Ch3 is
             end if;
 
          else
-            Set_Etype (New_Id, Etype (Id));
+            Set_Etype (New_Id, Id_Type);
          end if;
       end Replace_Type;
 
This page took 0.078414 seconds and 5 git commands to generate.