2008/8/13 Aldy Hernandez <[EMAIL PROTECTED]>:
>
> 1. beginning/ending locations functionality as Joseph suggests.
> 2. make sure the parsers pick the proper token/location.
> 3. error reporting machinery

There are various issues that would need to be addressed to have
decent caret diagnostics:

1) We only track one location for each token, so things that are
macro-expanded are difficult to get right (in some cases we want the
original location and in other occasions we want the macro call
location. In many cases we want both). Ideally we could encode this
information in a single location_t object.

2) During parsing, token locations are underused. Ideally, every
diagnostic should use a explicit location (input_location must die).
Also, most build_something calls should take location info.

3) After parsing, few objects have location (because the
build_something functions do not typically track it). Ideally for a
binary operator we would be able to know the location of the operator
and its operands, so we can print something like (as clang does):

error: invalid operands to binary operator '+'
 ((someA.X + 40) + some.A)
 ~~~~~~~~~~~~~~~~^~~~~~~~~

4) Find a way to move from a location_t to a null-terminated const
char * as efficiently as possible. The patch I just submitted uses the
most straightforward approach but improvements should be possible.

5) Make libcpp use the diagnostics.[ch] machinery. This will simplify
many things, and avoid code duplication.

Most of these things can be tackled independently. I am slowly
tackling 2) and 4).

Cheers,

Manuel.

Reply via email to