Jason Merrill <[email protected]> writes:
> It is sounding to me like the first location (xI) gets you the next
> virtual location in the unwinding process, whereas the second location
> (yI) gets you the spelling location of the token in the definition of
> a macro.
Right.
> Certainly all the calls to tokens_buff_add_token pass src->src_loc for
> the second. So why don't we look up the second location in the macro
> definition when we need it rather than store a copy in the map?
Because when you have the first location, looking up the second is not
easy. Note that the information about the arguments of a function-like
macro is freed right in enter_macro_context by delete_macro_args once we
have recorded the locations for the macro expansion. Getting the src
that matches the loc of a token coming from an argument of the macro
expansion, once that argument has been freed is not easier than just
storing a copy of the src->src_loc we need. So Tom and I decided to let
that optimization for later once we are sure the whole thing works and
performs well enough.
--
Dodji