[Ada] Simplify Is_Standard_xxx_Type routines with membership tests
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 14 Oct 2020 20:49:08 +0000 (22:49 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 25 Nov 2020 13:22:35 +0000 (08:22 -0500)
gcc/ada/

* einfo.adb (Is_Standard_Character_Type,
Is_Standard_String_Type): Simplify.
(Last_Formal): Use procedural variant of Next_Formal.

gcc/ada/einfo.adb

index 7f21e45e43d12df7f9a9a049242bafc4b3d0d139..c9b69b9adfd969ce2e05de3a0880ff7d4a32251c 100644 (file)
@@ -8309,21 +8309,10 @@ package body Einfo is
 
    function Is_Standard_Character_Type (Id : E) return B is
    begin
-      if Is_Type (Id) then
-         declare
-            R : constant Entity_Id := Root_Type (Id);
-         begin
-            return
-              R = Standard_Character
-                or else
-              R = Standard_Wide_Character
-                or else
-              R = Standard_Wide_Wide_Character;
-         end;
-
-      else
-         return False;
-      end if;
+      return Is_Type (Id)
+        and then Root_Type (Id) in Standard_Character
+                                 | Standard_Wide_Character
+                                 | Standard_Wide_Wide_Character;
    end Is_Standard_Character_Type;
 
    -----------------------------
@@ -8332,21 +8321,10 @@ package body Einfo is
 
    function Is_Standard_String_Type (Id : E) return B is
    begin
-      if Is_Type (Id) then
-         declare
-            R : constant Entity_Id := Root_Type (Id);
-         begin
-            return
-              R = Standard_String
-                or else
-              R = Standard_Wide_String
-                or else
-              R = Standard_Wide_Wide_String;
-         end;
-
-      else
-         return False;
-      end if;
+      return Is_Type (Id)
+        and then Root_Type (Id) in Standard_String
+                                 | Standard_Wide_String
+                                 | Standard_Wide_Wide_String;
    end Is_Standard_String_Type;
 
    --------------------
@@ -8454,7 +8432,7 @@ package body Einfo is
 
          if Present (Formal) then
             while Present (Next_Formal (Formal)) loop
-               Formal := Next_Formal (Formal);
+               Next_Formal (Formal);
             end loop;
          end if;