public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6456] [Ada] Reuse Make_Temporary where possible
@ 2022-01-11 13:27 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-01-11 13:27 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a8d89c45f8731686842f888f52494107bc410007
commit r12-6456-ga8d89c45f8731686842f888f52494107bc410007
Author: Piotr Trojanek <trojanek@adacore.com>
Date: Tue Jan 4 17:43:22 2022 +0100
[Ada] Reuse Make_Temporary where possible
gcc/ada/
* exp_ch7.adb (Set_Block_Elab_Proc, Unnest_Block, Unnest_Loop,
Unnest_Statement_List): Simplify with Make_Temporary.
* exp_put_image.adb (Build_Image_Call): Likewise.
* inline.adb (Generate_Subprogram_Body): Likewise.
* sem_ch13.adb (Build_Predicate_Functions): Likewise.
* sem_util.adb (New_Copy_Separate_List): Likewise.
Diff:
---
gcc/ada/exp_ch7.adb | 15 ++++-----------
gcc/ada/exp_put_image.adb | 4 ++--
gcc/ada/inline.adb | 2 +-
gcc/ada/sem_ch13.adb | 3 +--
gcc/ada/sem_util.adb | 3 +--
5 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index 8c74808e594..57b381c960a 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -4737,8 +4737,7 @@ package body Exp_Ch7 is
procedure Set_Block_Elab_Proc is
begin
if No (Block_Elab_Proc) then
- Block_Elab_Proc :=
- Make_Defining_Identifier (Loc, Chars => New_Internal_Name ('I'));
+ Block_Elab_Proc := Make_Temporary (Loc, 'I');
end if;
end Set_Block_Elab_Proc;
@@ -9964,9 +9963,7 @@ package body Exp_Ch7 is
Local_Scop := Entity (Identifier (Decl));
Ent := First_Entity (Local_Scop);
- Local_Proc :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('P'));
+ Local_Proc := Make_Temporary (Loc, 'P');
Local_Body :=
Make_Subprogram_Body (Loc,
@@ -10114,9 +10111,7 @@ package body Exp_Ch7 is
Local_Scop := Entity (Identifier (Loop_Stmt));
Ent := First_Entity (Local_Scop);
- Local_Proc :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('P'));
+ Local_Proc := Make_Temporary (Loc, 'P');
Local_Body :=
Make_Subprogram_Body (Loc,
@@ -10170,9 +10165,7 @@ package body Exp_Ch7 is
New_Stmts : constant List_Id := Empty_List;
begin
- Local_Proc :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('P'));
+ Local_Proc := Make_Temporary (Loc, 'P');
Local_Body :=
Make_Subprogram_Body (Loc,
diff --git a/gcc/ada/exp_put_image.adb b/gcc/ada/exp_put_image.adb
index 32ca26cb3c9..50e0569a801 100644
--- a/gcc/ada/exp_put_image.adb
+++ b/gcc/ada/exp_put_image.adb
@@ -1072,7 +1072,7 @@ package body Exp_Put_Image is
Loc : constant Source_Ptr := Sloc (N);
U_Type : constant Entity_Id := Underlying_Type (Entity (Prefix (N)));
Sink_Entity : constant Entity_Id :=
- Make_Defining_Identifier (Loc, Chars => New_Internal_Name ('S'));
+ Make_Temporary (Loc, 'S');
Sink_Decl : constant Node_Id :=
Make_Object_Declaration (Loc,
Defining_Identifier => Sink_Entity,
@@ -1090,7 +1090,7 @@ package body Exp_Put_Image is
New_Occurrence_Of (Sink_Entity, Loc),
Image_Prefix));
Result_Entity : constant Entity_Id :=
- Make_Defining_Identifier (Loc, Chars => New_Internal_Name ('R'));
+ Make_Temporary (Loc, 'R');
Result_Decl : constant Node_Id :=
Make_Object_Declaration (Loc,
Defining_Identifier => Result_Entity,
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index 49d034de322..da67fd2296b 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -2189,7 +2189,7 @@ package body Inline is
-- conflicts when the non-inlined body N is analyzed.
Set_Defining_Unit_Name (Specification (Body_To_Inline),
- Make_Defining_Identifier (Sloc (N), New_Internal_Name ('P')));
+ Make_Temporary (Sloc (N), 'P'));
Set_Corresponding_Spec (Body_To_Inline, Empty);
end Generate_Subprogram_Body;
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 52f3df0b1f7..78415e666f4 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -10666,8 +10666,7 @@ package body Sem_Ch13 is
-- what happens if a return appears within a return.
BTemp :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('B'));
+ Make_Temporary (Loc, 'B');
FBody :=
Make_Subprogram_Body (Loc,
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 3534e83c6a9..3c55dda5a85 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -23435,8 +23435,7 @@ package body Sem_Util is
Elmt := First_Elmt (Decls);
while Present (Elmt) loop
Decl := Node (Elmt);
- New_E := Make_Defining_Identifier (Sloc (Decl),
- New_Internal_Name ('P'));
+ New_E := Make_Temporary (Sloc (Decl), 'P');
if Nkind (Decl) = N_Expression_Function then
Decl := Specification (Decl);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-11 13:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 13:27 [gcc r12-6456] [Ada] Reuse Make_Temporary where possible 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).