"Manuel López-Ibáñez" <[EMAIL PROTECTED]> writes:

> Here is a patch that give us caret diagnostics in C/C++. There a lot
> of things that can be improved but because I wanted to get some
> feedback with my current approach.
> 
> Basically, I store a pointer linebuf in the line_map structure to a
> character in the input file buffer. The character corresponds to the
> first character in the line corresponding to TO_LINE in the line_map
> structure. The downside of this is that the buffer cannot be freed
> anymore. I am not sure whether this is better than storing a duplicate
> of the line as gfortran does. The third approach would be to store an
> offset and when generating diagnostics, reopen the file, fseek to the
> offset and print that line.
> 
> One line_map can contain information about several lines, so we still
> need to find the correct position for a line within linebuf. That is
> what the hack in expand_location is for. It would be nice to have a
> way to point directly to the beginning of each line: multiple pointers
> per line_map?

I like it.  I think the general approach is fine, but I think you
should free all the information when the frontend is complete--e.g.,
when it calls cgraph_finalize_compilation_unit.  That is, only give
caret warnings for diagnostics from the frontend.

Ian

Reply via email to