[Lex] getLocForEndOfToken

Hi,

I’m reading the clang source codes, and a little bit confused about why we cannot get the location for end of a token that nested in macros.

e.g.

#define TEST_MACRO(x) ((void) x)

... some codes
TEST_MACRO(a && bbbbbb);

... some codes

I want a location that points to the end of bbbbbb[exactly here].

Is there any efficient way to achieve this? Thanks!

Hi,

do you want the location before or after the macro-expansion?

Best, Jonas

Hi Jonas,

Thanks for your reply, I solved my problem by using Lexer::MeasureTokenLength and getLocWithOffset :slight_smile:

Thanks a lot!

Best Regards,
Xing