public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1902] [Ada] Make copies of entities being declared when copying block
@ 2021-06-29 14:26 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-06-29 14:26 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9a2c557b8ba4e33452a27219af1db83ec0cb7e0a
commit r12-1902-g9a2c557b8ba4e33452a27219af1db83ec0cb7e0a
Author: Richard Kenner <kenner@adacore.com>
Date: Wed Apr 21 08:35:24 2021 -0400
[Ada] Make copies of entities being declared when copying block
gcc/ada/
* sem_util.adb (Visit_Node): Add handling for N_Block_Statement
with declarations.
Diff:
---
gcc/ada/sem_util.adb | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 0d509526314..a54326805e5 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -24344,6 +24344,26 @@ package body Sem_Util is
EWA_Inner_Scope_Level := EWA_Inner_Scope_Level + 1;
end if;
+ -- If the node is a block, we need to process all declarations
+ -- in the block and make new entities for each.
+
+ if Nkind (N) = N_Block_Statement and then Present (Declarations (N))
+ then
+ declare
+ Decl : Node_Id := First (Declarations (N));
+
+ begin
+ while Present (Decl) loop
+ if Nkind (Decl) = N_Object_Declaration then
+ Add_New_Entity (Defining_Identifier (Decl),
+ New_Copy (Defining_Identifier (Decl)));
+ end if;
+
+ Next (Decl);
+ end loop;
+ end;
+ end if;
+
declare
procedure Action (U : Union_Id);
procedure Action (U : Union_Id) is
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-29 14:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29 14:26 [gcc r12-1902] [Ada] Make copies of entities being declared when copying block 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).