* [COMMITTED] ada: Adjust source location for degenerate scope master
@ 2024-05-06 9:17 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2024-05-06 9:17 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
From: Eric Botcazou <ebotcazou@adacore.com>
When the finalization scope master degenerates into a simple master node,
the latter must inherit the source location that the former would have had.
gcc/ada/
* exp_ch7.adb (Build_Finalizer.Process_Object_Declaration): Adjust
the Sloc of the master node declaration in the degenerate case.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/exp_ch7.adb | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index 75c9e223956..4382de9b6b2 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -2875,6 +2875,7 @@ package body Exp_Ch7 is
Master_Node_Decl : Node_Id;
Master_Node_Id : Entity_Id;
Master_Node_Ins : Node_Id;
+ Master_Node_Loc : Source_Ptr;
Obj_Ref : Node_Id;
-- Start of processing for Process_Object_Declaration
@@ -2936,11 +2937,20 @@ package body Exp_Ch7 is
end if;
else
+ -- For one object, use the Sloc the scope master would have had
+
+ if Counter_Val = 1 then
+ Master_Node_Loc := Sloc (N);
+ else
+ Master_Node_Loc := Loc;
+ end if;
+
Master_Node_Id :=
- Make_Defining_Identifier (Loc,
+ Make_Defining_Identifier (Master_Node_Loc,
Chars => New_External_Name (Chars (Obj_Id), Suffix => "MN"));
Master_Node_Decl :=
- Make_Master_Node_Declaration (Loc, Master_Node_Id, Obj_Id);
+ Make_Master_Node_Declaration (Master_Node_Loc,
+ Master_Node_Id, Obj_Id);
Push_Scope (Scope (Obj_Id));
if Counter_Val = 1 then
--
2.43.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-06 9:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-06 9:17 [COMMITTED] ada: Adjust source location for degenerate scope master Marc Poulhiès
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).