[COMMITTED] ada: Cleanup analysis of iterated component association

Message ID 20230615080348.938724-1-poulhies@adacore.com
State Committed
Commit be54247f74f54ec883e7677a78d6ec1bd97b1e76
Headers
Series [COMMITTED] ada: Cleanup analysis of iterated component association |

Commit Message

Marc Poulhiès June 15, 2023, 8:03 a.m. UTC
  From: Piotr Trojanek <trojanek@adacore.com>

Cleanups related to analysis of iterated component association for
GNATprove.

gcc/ada/

	* sem_aggr.adb
	(Resolve_Array_Aggregate): Simplify comment.
	(Resolve_Iterated_Component_Association): Tune comment; change variable
	to constant.

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

---
 gcc/ada/sem_aggr.adb | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
  

Patch

diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index c6063c78bf6..39189463871 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -1331,9 +1331,9 @@  package body Sem_Aggr is
       --  In this event we do not resolve Expr unless expansion is disabled.
       --  To know why, see the DELAYED COMPONENT RESOLUTION note above.
       --
-      --  NOTE: In the case of "... => <>", we pass the in the
-      --  N_Component_Association node as Expr, since there is no Expression in
-      --  that case, and we need a Sloc for the error message.
+      --  NOTE: In the case of "... => <>", we pass the N_Component_Association
+      --  node as Expr, since there is no Expression and we need a Sloc for the
+      --  error message.
 
       procedure Resolve_Iterated_Component_Association
         (N         : Node_Id;
@@ -1790,7 +1790,7 @@  package body Sem_Aggr is
          Choice : Node_Id;
          Dummy  : Boolean;
          Scop   : Entity_Id;
-         Expr   : Node_Id;
+         Expr   : constant Node_Id := Expression (N);
 
       --  Start of processing for Resolve_Iterated_Component_Association
 
@@ -1854,14 +1854,12 @@  package body Sem_Aggr is
             Set_Scope (Id, Scop);
          end if;
 
-         --  Analyze  expression without expansion, to verify legality.
+         --  Analyze expression without expansion, to verify legality.
          --  When generating code, we then remove references to the index
          --  variable, because the expression will be analyzed anew after
          --  rewritting as a loop with a new index variable; when not
          --  generating code we leave the analyzed expression as it is.
 
-         Expr := Expression (N);
-
          Dummy := Resolve_Aggr_Expr (Expr, Single_Elmt => False);
 
          if Operating_Mode /= Check_Semantics then