diff mbox

[Ada] Use Make_Temporary (5)

Message ID 20100617122637.GA9144@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet June 17, 2010, 12:26 p.m. UTC
This patch is another of several that replaces calls to
Make_Defining_Identifier, with calls to Make_Temporary where
possible, setting Node where possible. This is an internal
cleanup that does not affect compiler functionality in any
way, so no test needed.

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

2010-06-17  Robert Dewar  <dewar@adacore.com>

	* exp_ch3.adb, exp_ch6.adb, exp_smem.adb, exp_util.adb: Use Ekind_In.
	* layout.adb, freeze.adb: Use Make_Temporary.
diff mbox

Patch

Index: freeze.adb
===================================================================
--- freeze.adb	(revision 160892)
+++ freeze.adb	(working copy)
@@ -1145,10 +1145,7 @@  package body Freeze is
       if Nkind_In (Par, N_Object_Declaration, N_Assignment_Statement)
         and then Comes_From_Source (Par)
       then
-         Temp :=
-           Make_Defining_Identifier (Loc,
-             New_Internal_Name ('T'));
-
+         Temp := Make_Temporary (Loc, 'T', E);
          New_N :=
            Make_Object_Declaration (Loc,
              Defining_Identifier => Temp,
@@ -5419,8 +5416,7 @@  package body Freeze is
             --  involve secondary stack expansion.
 
             else
-               Dnam :=
-                 Make_Defining_Identifier (Loc, New_Internal_Name ('D'));
+               Dnam := Make_Temporary (Loc, 'D');
 
                Dbody :=
                  Make_Subprogram_Body (Loc,
Index: layout.adb
===================================================================
--- layout.adb	(revision 160887)
+++ layout.adb	(working copy)
@@ -3119,11 +3119,7 @@  package body Layout is
       Make_Func : Boolean   := False) return Dynamic_SO_Ref
    is
       Loc  : constant Source_Ptr := Sloc (Ins_Type);
-
-      K : constant Entity_Id :=
-            Make_Defining_Identifier (Loc,
-              Chars => New_Internal_Name ('K'));
-
+      K    : constant Entity_Id := Make_Temporary (Loc, 'K');
       Decl : Node_Id;
 
       Vtype_Primary_View : Entity_Id;
Index: exp_util.adb
===================================================================
--- exp_util.adb	(revision 160897)
+++ exp_util.adb	(working copy)
@@ -2107,9 +2107,7 @@  package body Exp_Util is
    begin
       --  Only consider record types
 
-      if Ekind (Typ) /= E_Record_Type
-        and then Ekind (Typ) /= E_Record_Subtype
-      then
+      if not Ekind_In (Typ, E_Record_Type, E_Record_Subtype) then
          return False;
       end if;
 
@@ -4406,9 +4404,7 @@  package body Exp_Util is
             --  already rewritten a variable node with a constant as
             --  a result of an earlier Force_Evaluation call.
 
-            if Ekind (Entity (N)) = E_Constant
-              or else Ekind (Entity (N)) = E_In_Parameter
-            then
+            if Ekind_In (Entity (N), E_Constant, E_In_Parameter) then
                return True;
 
             --  Functions are not side effect free
Index: exp_smem.adb
===================================================================
--- exp_smem.adb	(revision 160834)
+++ exp_smem.adb	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1998-2008, Free Software Foundation, Inc.         --
+--          Copyright (C) 1998-2010, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -270,10 +270,7 @@  package body Exp_Smem is
          return False;
 
       else
-         if Ekind (Formal) = E_Out_Parameter
-              or else
-            Ekind (Formal) = E_In_Out_Parameter
-         then
+         if Ekind_In (Formal, E_Out_Parameter, E_In_Out_Parameter) then
             Insert_Node := Call;
             return True;
          else
Index: exp_ch6.adb
===================================================================
--- exp_ch6.adb	(revision 160894)
+++ exp_ch6.adb	(working copy)
@@ -2941,9 +2941,8 @@  package body Exp_Ch6 is
          return;
       end if;
 
-      if Ekind (Subp) = E_Function
-        or else Ekind (Subp) = E_Procedure
-      then
+      if Ekind_In (Subp, E_Function, E_Procedure) then
+
          --  We perform two simple optimization on calls:
 
          --  a) replace calls to null procedures unconditionally;
@@ -4338,9 +4337,7 @@  package body Exp_Ch6 is
       --  For a procedure, we add a return for all possible syntactic ends of
       --  the subprogram.
 
-      if Ekind (Spec_Id) = E_Procedure
-        or else Ekind (Spec_Id) = E_Generic_Procedure
-      then
+      if Ekind_In (Spec_Id, E_Procedure, E_Generic_Procedure) then
          Add_Return (Statements (H));
 
          if Present (Exception_Handlers (H)) then
@@ -4707,8 +4704,7 @@  package body Exp_Ch6 is
       --  foreign convention or whose result type has a foreign convention
       --  never qualify.
 
-      if Ekind (E) = E_Function
-        or else Ekind (E) = E_Generic_Function
+      if Ekind_In (E, E_Function, E_Generic_Function)
         or else (Ekind (E) = E_Subprogram_Type
                   and then Etype (E) /= Standard_Void_Type)
       then
Index: exp_ch3.adb
===================================================================
--- exp_ch3.adb	(revision 160893)
+++ exp_ch3.adb	(working copy)
@@ -6221,9 +6221,7 @@  package body Exp_Ch3 is
 
       --  See GNAT Pool packages in the Run-Time for more details
 
-      elsif Ekind (Def_Id) = E_Access_Type
-        or else Ekind (Def_Id) = E_General_Access_Type
-      then
+      elsif Ekind_In (Def_Id, E_Access_Type, E_General_Access_Type) then
          declare
             Loc         : constant Source_Ptr := Sloc (N);
             Desig_Type  : constant Entity_Id  := Designated_Type (Def_Id);