]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Cleanup expansion of object declarations
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 8 Aug 2024 15:06:09 +0000 (17:06 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 2 Sep 2024 08:22:49 +0000 (10:22 +0200)
Replace repeated calls to Sloc with uses of local constant Loc.

Code cleanup; behavior is unaffected.

gcc/ada/

* exp_ch3.adb (Expand_N_Object_Declaration): Replace calls to Sloc
with uses of Loc; turn variable Prag into constant.

gcc/ada/exp_ch3.adb

index 4f6fa4cf6b71d24a9ed28e2f9102c03ffe0620f3..ff808aadea887ab38898c02834bc232de8730c86 100644 (file)
@@ -7658,11 +7658,9 @@ package body Exp_Ch3 is
            and then Is_Library_Level_Entity (Def_Id)
          then
             declare
-               Prag : Node_Id;
+               Prag : constant Node_Id :=
+                 Make_Linker_Section_Pragma (Def_Id, Loc, ".persistent.bss");
             begin
-               Prag :=
-                 Make_Linker_Section_Pragma
-                   (Def_Id, Sloc (N), ".persistent.bss");
                Insert_After (N, Prag);
                Analyze (Prag);
             end;
@@ -8349,10 +8347,8 @@ package body Exp_Ch3 is
          --  An Ada 2012 stand-alone object of an anonymous access type
 
          declare
-            Loc : constant Source_Ptr := Sloc (N);
-
             Level : constant Entity_Id :=
-                      Make_Defining_Identifier (Sloc (N),
+                      Make_Defining_Identifier (Loc,
                         Chars =>
                           New_External_Name (Chars (Def_Id), Suffix => "L"));