Jason Merrill <ja...@redhat.com> writes: > On 09/20/2011 03:23 AM, Dodji Seketeli wrote: >> Jason Merrill<ja...@redhat.com> writes: > >>> 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. > > In linemap_macro_map_loc_to_def_point you get the token number and > then use that to index into MACRO_MAP_LOCATIONS. Can't you use the > same token number to index into macro->exp.tokens instead?
No, because a macro argument can be made of several tokens. So after the first macro parameter of the replacement-list has been replaced by the tokens of the argument, there is a shift between the indexes of the tokens resulting from the replacement, and the original tokens of the macro replacement list. -- Dodji