[Lex] getLocForEndOfToken


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.


#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!


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,