public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Piotr Trojanek <trojanek@adacore.com>
Subject: [COMMITED] ada: Delay expansion of iterator specification in preanalysis
Date: Mon, 26 Sep 2022 11:15:05 +0200	[thread overview]
Message-ID: <20220926091505.273202-1-poulhies@adacore.com> (raw)

From: Piotr Trojanek <trojanek@adacore.com>

When preanalysing spec expression (e.g. expression of an expression
function), the name of iterator specification should not be expanded.

This patch simplifies a complicated condition for delaying expansion
within quantified expressions and iterated component associations.

gcc/ada/

	* sem_ch5.adb (Analyze_Iterator_Specification): Delay expansion
	based on Full_Analysis flag.
---
 gcc/ada/sem_ch5.adb | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 6d07f3d09e5..d0f00b31161 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -2429,14 +2429,9 @@ package body Sem_Ch5 is
 
       if not Is_Entity_Name (Iter_Name)
 
-        --  When the context is a quantified expression or iterated component
-        --  association, the renaming declaration is delayed until the
-        --  expansion phase if we are doing expansion.
-
-        and then (Nkind (Parent (N)) not in N_Quantified_Expression
-                                          | N_Iterated_Component_Association
-                   or else (Operating_Mode = Check_Semantics
-                            and then not GNATprove_Mode))
+        --  Do not perform this expansion in preanalysis
+
+        and then Full_Analysis
 
         --  Do not perform this expansion when expansion is disabled, where the
         --  temporary may hide the transformation of a selected component into
-- 
2.25.1


                 reply	other threads:[~2022-09-26  9:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220926091505.273202-1-poulhies@adacore.com \
    --to=poulhies@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=trojanek@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).