public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6359] [Ada] Simplify traversal in hooking of transient scopes
@ 2022-01-07 16:28 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-01-07 16:28 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c31cbf91a0e2740cb317a4339a62cebd1d633475

commit r12-6359-gc31cbf91a0e2740cb317a4339a62cebd1d633475
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Thu Dec 16 16:15:00 2021 +0100

    [Ada] Simplify traversal in hooking of transient scopes
    
    gcc/ada/
    
            * exp_ch7.adb (Process_Transients_In_Scope): Remove unnecessary
            initialization of Must_Hook; change Detect_Subprogram_Call from
            function to procedure; adapt caller.

Diff:
---
 gcc/ada/exp_ch7.adb | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index 367bd3d54ed..84170188187 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -6188,15 +6188,15 @@ package body Exp_Ch7 is
          Last_Object  : Node_Id;
          Related_Node : Node_Id)
       is
-         Must_Hook : Boolean := False;
+         Must_Hook : Boolean;
          --  Flag denoting whether the context requires transient object
          --  export to the outer finalizer.
 
          function Is_Subprogram_Call (N : Node_Id) return Traverse_Result;
-         --  Determine whether an arbitrary node denotes a subprogram call
+         --  Return Abandon if arbitrary node denotes a subprogram call
 
-         procedure Detect_Subprogram_Call is
-           new Traverse_Proc (Is_Subprogram_Call);
+         function Has_Subprogram_Call is
+           new Traverse_Func (Is_Subprogram_Call);
 
          procedure Process_Transient_In_Scope
            (Obj_Decl  : Node_Id;
@@ -6216,7 +6216,6 @@ package body Exp_Ch7 is
             --  A regular procedure or function call
 
             if Nkind (N) in N_Subprogram_Call then
-               Must_Hook := True;
                return Abandon;
 
             --  Special cases
@@ -6226,20 +6225,13 @@ package body Exp_Ch7 is
             --  of the call.
 
             elsif Is_Rewrite_Substitution (N) then
-               Detect_Subprogram_Call (Original_Node (N));
-
-               if Must_Hook then
-                  return Abandon;
-               else
-                  return OK;
-               end if;
+               return Has_Subprogram_Call (Original_Node (N));
 
             --  Generalized indexing always involves a function call
 
             elsif Nkind (N) = N_Indexed_Component
               and then Present (Generalized_Indexing (N))
             then
-               Must_Hook := True;
                return Abandon;
 
             --  Keep searching
@@ -6476,8 +6468,8 @@ package body Exp_Ch7 is
          --  due to the possibility of abnormal call termination.
 
          else
-            Detect_Subprogram_Call (N);
-            Blk_Ins := Last_Object;
+            Must_Hook := Has_Subprogram_Call (N) = Abandon;
+            Blk_Ins   := Last_Object;
          end if;
 
          if Clean then


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-07 16:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07 16:28 [gcc r12-6359] [Ada] Simplify traversal in hooking of transient scopes Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).