[Lex] getLocForEndOfToken

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lex] getLocForEndOfToken

Yvan Roux via cfe-dev
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.
```cpp
#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!

Best Regards,
Xing


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Lex] getLocForEndOfToken

Yvan Roux via cfe-dev

Hi,

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

Best, Jonas


Am 21.09.2018 um 07:21 schrieb Xing GUO via cfe-dev:
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.
```cpp
#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!

Best Regards,
Xing



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Lex] getLocForEndOfToken

Yvan Roux via cfe-dev
Hi Jonas,
Thanks for your reply, I solved my problem by using `Lexer::MeasureTokenLength` and `getLocWithOffset` :-)

Thanks a lot!

Best Regards,
Xing

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev