On Mon, 2025-01-27 at 15:26 -0500, David Malcolm wrote:

[...snip..]

> > 
> 
> I spent some time stepping through this to get clear in my mind how
> the
> new algorithm works.  FWIW I found the patch below helpful, to
> clarify
> in dumps about the slot index versus the line number of the slot;
> I'll
> commit this as a followup at some point:
> 
> Dave
> 
> diff --git a/gcc/input.cc b/gcc/input.cc
> index 11dd39412ea1..2abd2cd8eb0f 100644
> --- a/gcc/input.cc
> +++ b/gcc/input.cc
> @@ -663,10 +663,11 @@ file_cache_slot::dump (FILE *out, int indent)
> const
>            indent, "", (int)m_missing_trailing_newline);
>    fprintf (out, "%*sline records (%i):\n",
>            indent, "", m_line_record.length ());
> +  int idx = 0;
>    for (auto &line : m_line_record)
> -    fprintf (out, "%*sline %zi: byte offsets: %zi-%zi\n",
> +    fprintf (out, "%*s[%i]: line %zi: byte offsets: %zi-%zi\n",
>              indent + 2, "",
> -            line.line_num, line.start_pos, line.end_pos);
> +            idx++, line.line_num, line.start_pos, line.end_pos);
>  }
>  
>  /* Returns TRUE iff the cache would need to be filled with data
> coming
> 

FWIW I've pushed the above patch (to file_cache_slot::dump) as r15-
7256-g50c37516958319.

Dave

Reply via email to