<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thanks.<div class=""><br class=""></div><div class="">It seems Expr::getSourceRange() returns the range of the first token.</div><div class="">Then, in this particular case, what is the most common way to get the last token of the expression? How can I get “x < 10”?</div><div class=""><br class=""></div><div class="">Best,</div><div class="">Kihong<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">2018. 12. 2. 오후 1:30, Richard Smith <<a href="mailto:richard@metafoo.co.uk" class="">richard@metafoo.co.uk</a>> 작성:</div><br class="Apple-interchange-newline"><div class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><div class=""><div class="gmail_quote"><div dir="ltr" class="">On Sat, 1 Dec 2018, 22:16 Alexey Sidorin via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a><span class="Apple-converted-space"> </span>wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">Hi Kihong,<br class="">The problem in your particular case is that the begin location of<span class="Apple-converted-space"> </span><br class="">integer literal is reported as the end location (should we fix it in AST)?<br class=""></blockquote></div></div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">No, that's just how clang represents source ranges: source ranges are inclusive and source locations are the locations of tokens. So the start and end location of an integer literal should be the same, and the user needs to find the end of the last token themselves.</div><div dir="auto" class=""><br class=""></div><div dir="auto" class=""><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">As a workaround, you can try to use Lexer::getLocForEndOfToken() to get<span class="Apple-converted-space"> </span><br class="">the token end location for the location reported by getLocEnd().<br class=""><br class="">02.12.2018 8:36, Kihong Heo via cfe-dev пишет:<br class="">> Hi all,<br class="">><br class="">> How can I get string representations of conditional expressions of IfStmt?<br class="">> The problem is as follows:<br class="">> For example;<br class="">> =============<br class="">> /* source code */<br class="">> if( x < 10) …<br class="">> =============<br class="">><br class="">> “IS->getCond()->getSourceRange()” represents only “x <“. It seems quite strange.<br class="">><br class="">> Thanks,<br class="">> Kihong<br class="">> _______________________________________________<br class="">> cfe-dev mailing list<br class="">><span class="Apple-converted-space"> </span><a href="mailto:cfe-dev@lists.llvm.org" target="_blank" rel="noreferrer" class="">cfe-dev@lists.llvm.org</a><br class="">><span class="Apple-converted-space"> </span><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class=""><br class=""><br class="">_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" target="_blank" rel="noreferrer" class="">cfe-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a></blockquote></div></div></div></div></blockquote></div><br class=""></div></body></html>