public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-477] [Ada] Couple of small consistency tweaks
@ 2022-05-16  8:43 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-16  8:43 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2878027c64d62b29091f5a816d95b4ad8830210d

commit r13-477-g2878027c64d62b29091f5a816d95b4ad8830210d
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Tue Mar 8 08:52:10 2022 +0100

    [Ada] Couple of small consistency tweaks
    
    This aligns Analyze_Negation and Analyze_Unary_Op with the other similar
    procedures in Sem_Ch4.  No functional changes.
    
    gcc/ada/
    
            * sem_ch4.adb (Analyze_Negation): Minor tweak.
            (Analyze_Unary_Op): Likewise.

Diff:
---
 gcc/ada/sem_ch4.adb | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index ad7448fedb5..84b7ce199b1 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -3461,8 +3461,9 @@ package body Sem_Ch4 is
    ----------------------
 
    procedure Analyze_Negation (N : Node_Id) is
-      R     : constant Node_Id := Right_Opnd (N);
-      Op_Id : Entity_Id := Entity (N);
+      R : constant Node_Id := Right_Opnd (N);
+
+      Op_Id : Entity_Id;
 
    begin
       Set_Etype (N, Any_Type);
@@ -3470,7 +3471,15 @@ package body Sem_Ch4 is
 
       Analyze_Expression (R);
 
-      if Present (Op_Id) then
+      --  If the entity is already set, the node is the instantiation of a
+      --  generic node with a non-local reference, or was manufactured by a
+      --  call to Make_Op_xxx. In either case the entity is known to be valid,
+      --  and we do not need to collect interpretations, instead we just get
+      --  the single possible interpretation.
+
+      if Present (Entity (N)) then
+         Op_Id := Entity (N);
+
          if Ekind (Op_Id) = E_Operator then
             Find_Negation_Types (R, Op_Id, N);
          else
@@ -6067,8 +6076,9 @@ package body Sem_Ch4 is
    ----------------------
 
    procedure Analyze_Unary_Op (N : Node_Id) is
-      R     : constant Node_Id := Right_Opnd (N);
-      Op_Id : Entity_Id := Entity (N);
+      R : constant Node_Id := Right_Opnd (N);
+
+      Op_Id : Entity_Id;
 
    begin
       Set_Etype (N, Any_Type);
@@ -6076,7 +6086,15 @@ package body Sem_Ch4 is
 
       Analyze_Expression (R);
 
-      if Present (Op_Id) then
+      --  If the entity is already set, the node is the instantiation of a
+      --  generic node with a non-local reference, or was manufactured by a
+      --  call to Make_Op_xxx. In either case the entity is known to be valid,
+      --  and we do not need to collect interpretations, instead we just get
+      --  the single possible interpretation.
+
+      if Present (Entity (N)) then
+         Op_Id := Entity (N);
+
          if Ekind (Op_Id) = E_Operator then
             Find_Unary_Types (R, Op_Id,  N);
          else


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

only message in thread, other threads:[~2022-05-16  8:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16  8:43 [gcc r13-477] [Ada] Couple of small consistency tweaks 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).