diff mbox series

[COMMITTED,2/9] ada: Cleanup expansion of object declarations

Message ID 20240902082430.1863631-2-poulhies@adacore.com
State New
Headers show
Series [COMMITTED,1/9] ada: Remove repeated guards in validity checks | expand

Commit Message

Marc Poulhiès Sept. 2, 2024, 8:24 a.m. UTC
From: Piotr Trojanek <trojanek@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/exp_ch3.adb | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 4f6fa4cf6b7..ff808aadea8 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -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"));