]> gcc.gnu.org Git - gcc.git/commitdiff
ada: Cleanup getting of actual subtypes
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 25 Sep 2023 22:17:26 +0000 (00:17 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 7 Nov 2023 09:15:01 +0000 (10:15 +0100)
Avoid potentially unnecessary call to Etype.

gcc/ada/

* sem_util.adb (Get_Actual_Subtype_If_Available): Only call Etype
when necessary.

gcc/ada/sem_util.adb

index da531e53466cdc2c76b7727fd57e260792eb3fe3..d5df05b88e127845ab29b619f57be780eebc1eba 100644 (file)
@@ -10218,8 +10218,6 @@ package body Sem_Util is
    -------------------------------------
 
    function Get_Actual_Subtype_If_Available (N : Node_Id) return Entity_Id is
-      Typ : constant Entity_Id := Etype (N);
-
    begin
       --  If what we have is an identifier that references a subprogram
       --  formal, or a variable or constant object, then we get the actual
@@ -10245,7 +10243,7 @@ package body Sem_Util is
       --  Otherwise the Etype of N is returned unchanged
 
       else
-         return Typ;
+         return Etype (N);
       end if;
    end Get_Actual_Subtype_If_Available;
 
This page took 0.079614 seconds and 5 git commands to generate.