[cfe-dev] Right parenthesis of a condition.

Alexey Knyshev via cfe-dev cfe-dev at lists.llvm.org
Wed Feb 28 01:21:41 PST 2018


Hi Dorian,

Hope it would be helpful:
https://stackoverflow.com/a/24223347

Regards, Alexey K

2018-02-28 12:11 GMT+03:00 Dorian Haglund via cfe-dev <
cfe-dev at lists.llvm.org>:

> Hello,
>
> I'm using the clang library to monitor (among other things) the if
> statements in my program.
>
> i need to get the location of the right parenthesis of the condition of
> the if (and while) statements.
>
> I've tried things such as:
>
> 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 of the right
> parenthesis.
>
> Do you know how to get it ? If it is not possible, could you explain why ?
> Best regards,
>
>
> --
> Dorian Haglund
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>


-- 
linkedin.com/profile
<https://www.linkedin.com/profile/view?id=AAMAABn6oKQBDhBteiQnWsYm-S9yxT7wQkfWhSw>

github.com/alexeyknyshev
bitbucket.org/alexeyknyshev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180228/9c934abc/attachment.html>


More information about the cfe-dev mailing list