diff mbox series

[Ada] Reuse Is_Object where possible

Message ID 20200616130745.GA87033@adacore.com
State New
Headers show
Series [Ada] Reuse Is_Object where possible | expand

Commit Message

Pierre-Marie de Rodat June 16, 2020, 1:07 p.m. UTC
Reuse a high-level Is_Object, which is meant to be more readable than a
low-level membership test with Ekind. Semantics is unaffected.

Tested on x86_64-pc-linux-gnu, committed on trunk

2020-06-16  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* einfo.adb, exp_spark.adb, exp_util.adb, sem_eval.adb: Replace
	"Ekind ... in Object_Kind" with "Is_Object (...)".
diff mbox series

Patch

--- gcc/ada/einfo.adb
+++ gcc/ada/einfo.adb
@@ -997,7 +997,7 @@  package body Einfo is
 
    function Current_Value (Id : E) return N is
    begin
-      pragma Assert (Ekind (Id) in Object_Kind);
+      pragma Assert (Is_Object (Id));
       return Node9 (Id);
    end Current_Value;
 

--- gcc/ada/exp_spark.adb
+++ gcc/ada/exp_spark.adb
@@ -434,7 +434,7 @@  package body Exp_SPARK is
    begin
       --  Replace a reference to a renaming with the actual renamed object
 
-      if Ekind (Obj_Id) in Object_Kind then
+      if Is_Object (Obj_Id) then
          Ren := Renamed_Object (Obj_Id);
 
          if Present (Ren) then

--- gcc/ada/exp_util.adb
+++ gcc/ada/exp_util.adb
@@ -6396,7 +6396,7 @@  package body Exp_Util is
 
       --  Immediate return, nothing doing, if this is not an object
 
-      if Ekind (Ent) not in Object_Kind then
+      if not Is_Object (Ent) then
          return;
       end if;
 

--- gcc/ada/sem_eval.adb
+++ gcc/ada/sem_eval.adb
@@ -1001,7 +1001,7 @@  package body Sem_Eval is
                     (Is_Known_Valid (Entity (Opnd))
                       or else Ekind (Entity (Opnd)) = E_In_Parameter
                       or else
-                        (Ekind (Entity (Opnd)) in Object_Kind
+                        (Is_Object (Entity (Opnd))
                           and then Present (Current_Value (Entity (Opnd))))))
            or else Is_OK_Static_Expression (Opnd);
       end Is_Known_Valid_Operand;