public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-1674] [Ada] Fix detection of overlapping actuals with renamings
Date: Mon, 21 Jun 2021 11:05:03 +0000 (GMT)	[thread overview]
Message-ID: <20210621110503.15A6A388A40F@sourceware.org> (raw)

https://gcc.gnu.org/g:58484cdf4e7c95dbdc503cf4a8427f44bfe02921

commit r12-1674-g58484cdf4e7c95dbdc503cf4a8427f44bfe02921
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Thu Mar 25 13:15:30 2021 +0100

    [Ada] Fix detection of overlapping actuals with renamings
    
    gcc/ada/
    
            * sem_util.adb (Is_Object_Renaming): Rename from Is_Renaming;
            simplify; adapt callers.

Diff:
---
 gcc/ada/sem_util.adb | 45 +++++++++++++--------------------------------
 1 file changed, 13 insertions(+), 32 deletions(-)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index fb44823d409..6727e15d2d2 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -7262,8 +7262,8 @@ package body Sem_Util is
    -------------------------
 
    function Denotes_Same_Object (A1, A2 : Node_Id) return Boolean is
-      function Is_Renaming (N : Node_Id) return Boolean;
-      --  Return true if N names a renaming entity
+      function Is_Object_Renaming (N : Node_Id) return Boolean;
+      --  Return true if N names an object renaming entity
 
       function Is_Valid_Renaming (N : Node_Id) return Boolean;
       --  For renamings, return False if the prefix of any dereference within
@@ -7271,35 +7271,16 @@ package body Sem_Util is
       --  renamed object_name contains references to variables or calls on
       --  nonstatic functions; otherwise return True (RM 6.4.1(6.10/3))
 
-      -----------------
-      -- Is_Renaming --
-      -----------------
+      ------------------------
+      -- Is_Object_Renaming --
+      ------------------------
 
-      function Is_Renaming (N : Node_Id) return Boolean is
+      function Is_Object_Renaming (N : Node_Id) return Boolean is
       begin
-         if not Is_Entity_Name (N) then
-            return False;
-         end if;
-
-         case Ekind (Entity (N)) is
-            when E_Variable | E_Constant =>
-               return Present (Renamed_Object (Entity (N)));
-
-            when E_Exception
-               | E_Function
-               | E_Generic_Function
-               | E_Generic_Package
-               | E_Generic_Procedure
-               | E_Operator
-               | E_Package
-               | E_Procedure
-            =>
-               return Present (Renamed_Entity (Entity (N)));
-
-            when others =>
-               return False;
-         end case;
-      end Is_Renaming;
+         return Is_Entity_Name (N)
+           and then Ekind (Entity (N)) in E_Variable | E_Constant
+           and then Present (Renamed_Object (Entity (N)));
+      end Is_Object_Renaming;
 
       -----------------------
       -- Is_Valid_Renaming --
@@ -7307,7 +7288,7 @@ package body Sem_Util is
 
       function Is_Valid_Renaming (N : Node_Id) return Boolean is
       begin
-         if Is_Renaming (N)
+         if Is_Object_Renaming (N)
            and then not Is_Valid_Renaming (Renamed_Entity (Entity (N)))
          then
             return False;
@@ -7494,12 +7475,12 @@ package body Sem_Util is
       --  no references to variables nor calls on nonstatic functions (RM
       --  6.4.1(6.11/3)).
 
-      elsif Is_Renaming (A1)
+      elsif Is_Object_Renaming (A1)
         and then Is_Valid_Renaming (A1)
       then
          return Denotes_Same_Object (Renamed_Entity (Entity (A1)), A2);
 
-      elsif Is_Renaming (A2)
+      elsif Is_Object_Renaming (A2)
         and then Is_Valid_Renaming (A2)
       then
          return Denotes_Same_Object (A1, Renamed_Entity (Entity (A2)));


                 reply	other threads:[~2021-06-21 11:05 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=20210621110503.15A6A388A40F@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).