[cfe-dev] preprocessing source using libclang
Argyrios Kyrtzidis
akyrtzi at gmail.com
Wed Jan 2 14:55:37 PST 2013
On Dec 31, 2012, at 2:07 AM, Alex Turbov <i.zaufi at gmail.com> wrote:
> ALL,
>
> is there any way to get macro expansion using libclang? I mean, for example, in code like this:
>
> #define FOO(x) foo(x, x)
> FOO(123)
>
> to get expansion of FOO(123) at line 2 as text "foo(123,123)"??
No, though this would be a great feature to add.
IMO, instead of just giving back a string with the final tokens, we should provide structured information for the macro expansion, so that a client can distinguish and pinpoint nested macros and how each one was expanded; it could be similar to how code-competion uses "chunks".
Since we preserve the macro history now, we could get the relevant info via an on-demand re-tokenization.
Could you open an enhancement request via bugzilla ?
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list