diff mbox series

[COMMITTED,23/26] ada: Simplify manipulation of the list with loop actions

Message ID 20240802071210.413366-23-poulhies@adacore.com
State New
Headers show
Series [COMMITTED,01/26] ada: Fix detection of suspicious loop patterns | expand

Commit Message

Marc Poulhiès Aug. 2, 2024, 7:11 a.m. UTC
From: Piotr Trojanek <trojanek@adacore.com>

Code cleanup; behavior is unaffected.

gcc/ada/

	* exp_aggr.adb (Add_Loop_Actions): Change manipulation of list
	to avoid unnecessary calls to Parent and Loop_Actions.

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

---
 gcc/ada/exp_aggr.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 7a2d0570dbd..8496fcd9b00 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -1262,9 +1262,9 @@  package body Exp_Aggr is
             elsif Nkind (Parent (Expr)) = N_Component_Association
               and then Present (Loop_Actions (Parent (Expr)))
             then
-               Append_List (Lis, Loop_Actions (Parent (Expr)));
                Res := Loop_Actions (Parent (Expr));
                Set_Loop_Actions (Parent (Expr), No_List);
+               Append_List (Lis, To => Res);
                return Res;
 
             else