[cfe-users] about the Lexer::MeasureTokenLength

freebigshow freebigshow at 126.com
Sun Aug 10 20:20:50 PDT 2014


In clang, I can get the token length to reach the end of a line by using Lexer::MeasureTokenLength while it is a token, but when it comes to a macro, I can only get the length of the macro before it expands, leading to the wrong offset of the SourceLocation. For example:
 #define A 1+1
...
    return A;
When I get the SourceLocation of "return A" by using getLocEnd(), I want to reach the end of this line. But now, the Lexer::MeasureTokenLength doesn't work. It only return the length (or offset) of "A" rather than "1+1", then the SourceLocation of the end of the line will be wrong.
What should I do?
Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20140811/17fc0369/attachment.html>


More information about the cfe-users mailing list