I'm using the clang library to do some c++ AST manipulation. I would like to get the location of the right parenthesis of a condition of an IfStmt
.
I tried:
auto condLocEnd = statement->getCond()->getLocEnd();
auto condLoc = Lexer::findLocationAfterToken(condLocEnd, tok::r_paren, sm, LangOptions(), false);
Unfortunately condLoc
is invalid when the condition contains a macro.
Eg: if(p == NULL)
. I can't figure out how to get the location. How to get it ?