[Ada] Simplify membership tests with N_Entity subtype
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 23 Jun 2020 08:18:48 +0000 (10:18 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 15 Oct 2020 09:39:09 +0000 (05:39 -0400)
gcc/ada/

* sem_ch12.adb: Replace list of N_Defining_... enumerations with
N_Entity.

gcc/ada/sem_ch12.adb

index cbf27e216eedf9518bd1d055c41daf581bc28d2f..22e6371140aed2fba8bb4b2e8d2b66cc9ac3d753 100644 (file)
@@ -8005,9 +8005,7 @@ package body Sem_Ch12 is
                end if;
 
             elsif No (Ent)
-              or else Nkind (Ent) not in N_Defining_Identifier
-                                       | N_Defining_Character_Literal
-                                       | N_Defining_Operator_Symbol
+              or else Nkind (Ent) not in N_Entity
               or else No (Scope (Ent))
               or else
                 (Scope (Ent) = Current_Instantiated_Parent.Gen_Id
@@ -8174,9 +8172,7 @@ package body Sem_Ch12 is
                   then
                      Set_Entity (New_N, Entity (Name (Assoc)));
 
-                  elsif Nkind (Assoc) in N_Defining_Identifier
-                                       | N_Defining_Character_Literal
-                                       | N_Defining_Operator_Symbol
+                  elsif Nkind (Assoc) in N_Entity
                     and then Expander_Active
                   then
                      --  Inlining case: we are copying a tree that contains
@@ -15656,10 +15652,7 @@ package body Sem_Ch12 is
             --  preserve in this case, since the expansion will be redone in
             --  the instance.
 
-            if Nkind (E) not in N_Defining_Character_Literal
-                              | N_Defining_Identifier
-                              | N_Defining_Operator_Symbol
-            then
+            if Nkind (E) not in N_Entity then
                Set_Associated_Node (N, Empty);
                Set_Etype (N, Empty);
                return;