https://gcc.gnu.org/g:d9128914a30615902befa37be7aacab28696d06a

commit r17-4373-gd9128914a30615902befa37be7aacab28696d06a
Author: Pietro Monteiro <[email protected]>
Date:   Wed Sep 16 14:09:00 2026 -0400

    algol68: Improve location tracking
    
    Create a location that covers the node text and has the caret pointing
    to the start of the text.
    
    gcc/algol68/ChangeLog:
    
            * a68-parser.cc (a68_get_node_location): Return a location
            that covers the whole span of the node.
    
    Signed-off-by: Pietro Monteiro <[email protected]>

Diff:
---
 gcc/algol68/a68-parser.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/algol68/a68-parser.cc b/gcc/algol68/a68-parser.cc
index 878d9d6cd9b1..40ebe507492a 100644
--- a/gcc/algol68/a68-parser.cc
+++ b/gcc/algol68/a68-parser.cc
@@ -1155,7 +1155,14 @@ a68_get_node_location (NODE_T *p)
 
   const char *start_pos = CHAR_IN_LINE (INFO (p));
   location_t start_loc = a68_get_line_location (line, start_pos);
-  return start_loc;
+
+  if (NSYMBOL (p) == NO_TEXT)
+    return start_loc;
+
+  const char *end_pos = start_pos + strlen (NSYMBOL (p)) - 1;
+  location_t end_loc = a68_get_line_location (line, end_pos);
+
+  return make_location (start_loc, start_loc, end_loc);
 }
 
 /* Get the location of POS inside LINE as a GCC location.  */

Reply via email to