> Oh yes. Well, there is a lot of fine-tunning to do but I think that
> would be covered by A.1 and the binary_op expression would have at
> least two locations begin/end pointing to X and r. If we are able to
> print ({break;}), in the example I gave earlier, then we will be able
> to print nice ranges most of the time.
Interestingly, I am working right now on improving location information
in the C (and possibly in the future C++) front-end, for the need of
static analysis tools, and generation of cross-ref information (for use
by IDEs), and have added locally support for additional locations for
many expressions.

The way I did it, since I thought that adding a new location_t field in
the expr struct would likely be a no-no (due to additional memory usage) is to
use a hash table "on the side", and use macros (SET_EXPR_LOCATION2,
GET_EXPR_LOCATION2) that are no-ops by default, and that populate the
hash table when a given switch is enabled.

I was planning to submit these changes at some later point, since this
is still work in progress at this stage, but can work on submitting these
earlier if this would help people in other contexts, and/or avoid duplicate
work.

Note that my patch not only adds support for additional locations (and it
even adds as much locations as needed for each argument of a function call),
but also fixes column number information in several cases.

Arno

Reply via email to