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!