https://gcc.gnu.org/g:0c320ec602c1cc2d700925d0163539b18268fc60

commit r16-4995-g0c320ec602c1cc2d700925d0163539b18268fc60
Author: Piotr Trojanek <[email protected]>
Date:   Fri Oct 17 10:33:44 2025 +0200

    ada: Keep source locations for inlined subprograms from predefined units
    
    Frontend inlining, which is now deprecated and only enabled with switch 
-gnatN
    is used, used to reset source locations for subprograms from predefined 
units.
    This was a workaround to prevent the debugger from visiting internal code in
    Ada.Tags, but this problem no longer occurs (even when switch -gnatN is 
used)
    and is no longer needed. This patch removes it, because it confused
    compile-time evaluation, which makes use of source locations to recognize 
code
    within IF statements.
    
    gcc/ada/ChangeLog:
    
            * inline.adb (Process_Sloc): Remove.

Diff:
---
 gcc/ada/inline.adb | 32 --------------------------------
 1 file changed, 32 deletions(-)

diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index 9e60fa81de9e..a966c28351f3 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -3380,15 +3380,6 @@ package body Inline is
       --  be performed in a separate pass, using an instantiation of the
       --  previous subprogram over aspect specifications reachable from N.
 
-      function Process_Sloc (Nod : Node_Id) return Traverse_Result;
-      --  If the call being expanded is that of an internal subprogram, set the
-      --  sloc of the generated block to that of the call itself, so that the
-      --  expansion is skipped by the "next" command in gdb. Same processing
-      --  for a subprogram in a predefined file, e.g. Ada.Tags. If
-      --  Debug_Generated_Code is true, suppress this change to simplify our
-      --  own development. Same in GNATprove mode, to ensure that warnings and
-      --  diagnostics point to the proper location.
-
       procedure Reset_Dispatching_Calls (N : Node_Id);
       --  In subtree N search for occurrences of dispatching calls that use the
       --  Ada 2005 Object.Operation notation and the object is a formal of the
@@ -3647,22 +3638,6 @@ package body Inline is
       procedure Replace_Formals_In_Aspects is
         new Traverse_Proc (Process_Formals_In_Aspects);
 
-      ------------------
-      -- Process_Sloc --
-      ------------------
-
-      function Process_Sloc (Nod : Node_Id) return Traverse_Result is
-      begin
-         if not Debug_Generated_Code then
-            Set_Sloc (Nod, Sloc (N));
-            Set_Comes_From_Source (Nod, False);
-         end if;
-
-         return OK;
-      end Process_Sloc;
-
-      procedure Reset_Slocs is new Traverse_Proc (Process_Sloc);
-
       ------------------------------
       --  Reset_Dispatching_Calls --
       ------------------------------
@@ -4176,13 +4151,6 @@ package body Inline is
       Replace_Formals_In_Aspects (Blk);
       Set_Parent (Blk, N);
 
-      if GNATprove_Mode then
-         null;
-
-      elsif not Comes_From_Source (Subp) or else Is_Predef then
-         Reset_Slocs (Blk);
-      end if;
-
       if Is_Unc_Decl then
 
          --  No action needed since return statement has been already removed

Reply via email to