]> gcc.gnu.org Git - gcc.git/commitdiff
[Ada] Replace chopped string copy with renaming
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 18 May 2021 22:26:30 +0000 (00:26 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 7 Jul 2021 16:23:12 +0000 (16:23 +0000)
gcc/ada/

* par.adb (Par): A local Name variable is now a renaming of a
constant slice.

gcc/ada/par.adb

index 649d2a08dc05d460bd8f734db89931361b2724e0..312c41100d5e7396063014f5875cedf4eed2b7bd 100644 (file)
@@ -1650,14 +1650,12 @@ begin
                      Uname : constant String :=
                                Get_Name_String
                                  (Unit_Name (Current_Source_Unit));
-                     Name  : String (1 .. Uname'Length - 2);
-
-                  begin
+                     Name  : String renames
+                       Uname (Uname'First .. Uname'Last - 2);
                      --  Because Unit_Name includes "%s"/"%b", we need to strip
                      --  the last two characters to get the real unit name.
 
-                     Name := Uname (Uname'First .. Uname'Last - 2);
-
+                  begin
                      if Name = "ada"         or else
                         Name = "interfaces"  or else
                         Name = "system"
This page took 0.061017 seconds and 5 git commands to generate.