preprocessing source using libclang

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)”??

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 ?