From patchwork Mon Sep 5 07:25:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 973 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp58089wrt; Mon, 5 Sep 2022 00:34:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR4po7iWl2x3BP74HNmzkgm2w8NK1Kcwg3KGv32M+tD6RhjXdpVvek3od0SnFY0LRzDpcKAx X-Received: by 2002:a17:906:ef90:b0:730:9cd8:56d7 with SMTP id ze16-20020a170906ef9000b007309cd856d7mr33041444ejb.94.1662363240607; Mon, 05 Sep 2022 00:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662363240; cv=none; d=google.com; s=arc-20160816; b=CQp3brS7nTiYsQViMjll+oOi1EKmtDDUNdPSL8AGEVRuO6ek7xyovowzl0YNdGhogi u+dtGsfAmw3n5atQS/64O0aulz85IS4kzFKCnjnyanwGavVZjSYrMyvK5dr/FO6C5OAY HzVO1XodozYOVnAdTl0OQRRXv0ArMWLqWOJnKmoJhKk4Pd9KiE666i9GgcV6kCmLvN7a edrBN04Lxe/dVD1IlHWtQRuUuHq0UhgEpZ/ifikYdlXGyi8q5BsZqIf4ns/NTS1WzxgE tkcSqZ2inCuIxF2AkODY4IMIlWAejb4rcgd0Laqri4hK/DGkZ0Oe3e+lFoaJZVVHBbKc gfWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=8q4EcVTCZ3E/Py7hUP2Y8w42+iI9YCEZjMugxNc7XRE=; b=aBqy5LXqE/eImeDvvJV8zpv0P5y6qmFxfHtCNLpBwj+SYTEV04KJ0XMf9Whn5GO+eV rQTvmWhRHboHnW5d5yyB/3cKl++UlUEkCHVkCL2DEdW4wumvbaO5uVfqxB9loAdoRkds vxT2H/oYlrg5aAAgQ2tYzlnCGefwNfbHPhe503NaizhSEg7hoO5LZ9lsrOobavoEv2Hr xf7SzxuMWiwYiMzvWrfc3nE49NFBXroyyBk0j29VG/fNi/GBKmD1bBySIkynRvAwlAjw SsqEEgNKOJ+tz8PY7+mGAjVoJ8QojoQ/pOa4VPWzgectDYIIf8VE/XlHuKxKYw1DEJe3 clhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=x7bCPipM; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id x6-20020a056402414600b0044e9c289ae5si891967eda.155.2022.09.05.00.34.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 00:34:00 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=x7bCPipM; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8977C385BC23 for ; Mon, 5 Sep 2022 07:29:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8977C385BC23 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662362980; bh=8q4EcVTCZ3E/Py7hUP2Y8w42+iI9YCEZjMugxNc7XRE=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=x7bCPipMHz3Pc9O8BDA15qfUn/JxYX3c0seIx0KeEf3PZFK1xoza3cVtvBzfi7fa/ 12XFAh6uTgGqa1qiDEErwZxqbLmF3DO5m/ZJ0AySV9FYeNrBwP52arwjBK2e0kw4I4 lmFcfzfYaqspYwux/3GVS/QAsVmqZRS31d9LS2z8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 2E2723856DC8 for ; Mon, 5 Sep 2022 07:25:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2E2723856DC8 Received: by mail-wm1-x32b.google.com with SMTP id j26so4791244wms.0 for ; Mon, 05 Sep 2022 00:25:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=8q4EcVTCZ3E/Py7hUP2Y8w42+iI9YCEZjMugxNc7XRE=; b=HREm/NoA6pXae2IV3S8oQ7/qVTuwqFOQIcr4rQWJr9gQdTooHF06V8qBv1jogWyxy2 VUagpID351d2WzxDXv7VewkeMTBzhBKpByDMLCnVVr1liSwQgnWagZnnIAM26EC7cMSV 4SuY99i5KSfll8NImA1esuCqD6BstGRautMv8f7mT/sPNVuf/x6si5VaaWD/CwyK2o8b 3BO5sD2KeIND4FU0gx98NCF1YTcf073WfgMenuq1O802X36E6wmiclczS6Ua1NyzEfoQ XdrZLkb1y3tLlvwEIab9sAVfM8G7NhHKdzItAbPZEz1Nt5ukCVwoWhgPfjQSQACOSB3P lDWA== X-Gm-Message-State: ACgBeo3Z+SxKQs3g1W0z4hQP8OesJd3uy7Y4SUZcmK4fBLkQQijxFSe8 QtlYYHRimwmsMZM9D2nmQKKDq9knYwoOcA== X-Received: by 2002:a05:600c:4fcd:b0:3a6:2694:e3ba with SMTP id o13-20020a05600c4fcd00b003a62694e3bamr10279801wmq.160.1662362758832; Mon, 05 Sep 2022 00:25:58 -0700 (PDT) Received: from poulhies-Precision-5550 (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id m5-20020adff385000000b00228c792aaaasm210671wro.100.2022.09.05.00.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 00:25:58 -0700 (PDT) Date: Mon, 5 Sep 2022 09:25:57 +0200 To: gcc-patches@gcc.gnu.org Subject: [Ada] Cleanup resolution of iterated component association Message-ID: <20220905072557.GA1174593@poulhies-Precision-5550> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: Marc =?iso-8859-1?q?Poulhi=E8s?= Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743114197286306070?= X-GMAIL-MSGID: =?utf-8?q?1743114197286306070?= Tune names of local entities. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_aggr.adb (Resolve_Iterated_Component_Association): Change generic name Ent to a more intuitive Scop; rename Remove_Ref to Remove_Reference, so it can be instantiated as a traversal routine with plural name. diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -1748,11 +1748,11 @@ package body Sem_Aggr is -- Remove_References -- ----------------------- - function Remove_Ref (N : Node_Id) return Traverse_Result; - -- Remove references to the entity Id after analysis, so it can be + function Remove_Reference (N : Node_Id) return Traverse_Result; + -- Remove reference to the entity Id after analysis, so it can be -- properly reanalyzed after construct is expanded into a loop. - function Remove_Ref (N : Node_Id) return Traverse_Result is + function Remove_Reference (N : Node_Id) return Traverse_Result is begin if Nkind (N) = N_Identifier and then Present (Entity (N)) @@ -1763,15 +1763,15 @@ package body Sem_Aggr is end if; Set_Analyzed (N, False); return OK; - end Remove_Ref; + end Remove_Reference; - procedure Remove_References is new Traverse_Proc (Remove_Ref); + procedure Remove_References is new Traverse_Proc (Remove_Reference); -- Local variables Choice : Node_Id; Dummy : Boolean; - Ent : Entity_Id; + Scop : Entity_Id; Expr : Node_Id; -- Start of processing for Resolve_Iterated_Component_Association @@ -1841,10 +1841,10 @@ package body Sem_Aggr is -- visible in the expression for the component, and needed for its -- analysis. - Ent := New_Internal_Entity (E_Loop, Current_Scope, Loc, 'L'); - Set_Etype (Ent, Standard_Void_Type); - Set_Parent (Ent, Parent (N)); - Push_Scope (Ent); + Scop := New_Internal_Entity (E_Loop, Current_Scope, Loc, 'L'); + Set_Etype (Scop, Standard_Void_Type); + Set_Parent (Scop, Parent (N)); + Push_Scope (Scop); -- Insert and decorate the index variable in the current scope. -- The expression has to be analyzed once the index variable is @@ -1853,7 +1853,7 @@ package body Sem_Aggr is Enter_Name (Id); Set_Etype (Id, Id_Typ); Mutate_Ekind (Id, E_Variable); - Set_Scope (Id, Ent); + Set_Scope (Id, Scop); -- Analyze expression without expansion, to verify legality. -- When generating code, we then remove references to the index