aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-12-15 13:08:38 +0100
committerMarc Poulhiès <poulhies@adacore.com>2024-05-06 11:11:25 +0200
commit6cc4ac7d151e432b75da58d44d2ffb53192e04b5 (patch)
tree2cda95ade53c0a251a9f4b42c2909109746948db /gcc
parentcdf15b4b661c5fa1a210642e0b2a508969faf197 (diff)
downloadgcc-6cc4ac7d151e432b75da58d44d2ffb53192e04b5.zip
gcc-6cc4ac7d151e432b75da58d44d2ffb53192e04b5.tar.gz
gcc-6cc4ac7d151e432b75da58d44d2ffb53192e04b5.tar.bz2
ada: Adjust source location for degenerate scope master
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_ch7.adb14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index 75c9e22..4382de9 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