[PATCH 1/2] gcc symbol database

Yunfeng ZHANG zyf.zeroos@gmail.com
Wed Jul 18 02:11:00 GMT 2012


> It took me a couple of minutes to understand what you meant here, so
> please let me re-phrase to make sure I got it.
>
> You are saying that the callback function of the cb_lex_token event is
> set by the callback function of the macro_start_expand event.
>
> Is that correct?

Yes.

> And this makes me wonder why you'd need the second parameter of
> macro_start_expand (the token).  I believe you should have all the
> information you need with the first, second, and last parameter.  As I
> said in my previous email, you can get the file offset of the token in
> your client code by doing 'file_offset = line + column'.  So that token
> should not be needed.  Thus, calling macro_start_expand from inside
> funlike_invocation_p once you are sure the expansion of the macro is
> going to take place, is possible.

The only thing is the file-offset or source_location of the macro leader token.
I don't know how to get it when macro_start_expand is called in
funlike_invocation_p intern. The parameter `result' of enter_macro_context
doesn't be delivered down. And file_offset = sum(`all former
column_total_count' + current column_number'), so it can't be deduced from
current line_map + source_location desgin.

BTW, I can change my plugin to use line/column instead of fileoffset, there
ins't design limitation, only time.

Yunfeng



More information about the Gcc-patches mailing list