public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Marc Poulhi?s <dkm@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r15-176] ada: Adjust source location for degenerate scope master
Date: Mon,  6 May 2024 09:15:56 +0000 (GMT)	[thread overview]
Message-ID: <20240506091556.54D823858C62@sourceware.org> (raw)

https://gcc.gnu.org/g:6cc4ac7d151e432b75da58d44d2ffb53192e04b5

commit r15-176-g6cc4ac7d151e432b75da58d44d2ffb53192e04b5
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Fri Dec 15 13:08:38 2023 +0100

    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.

Diff:
---
 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

                 reply	other threads:[~2024-05-06  9:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240506091556.54D823858C62@sourceware.org \
    --to=dkm@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).