[cfe-dev] getSourceRange of an Expr Stmt covering the closing "; "?

Ilya Biryukov via cfe-dev cfe-dev at lists.llvm.org
Tue Oct 29 02:58:24 PDT 2019


Hi Stephan,

It's a common problem, there's a helper in Clang Tooling library that
solves this.
Take a look at the getExtendedRange function from
"include/clang/Tooling/Transformer/SourceCode.h".

On Tue, Oct 29, 2019 at 10:48 AM Stephan Bergmann via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Because of how Expr is derived from Stmt, e.getSourceRange() for an Expr
> e that constitutes an expression-statement doesn't include the closing ";".
>
> Is there perhaps some code already somewhere that provides the extended
> SourceRange?  (I'd imagined that SourceManager might provide something
> like that, but couldn't find anything.)
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>


-- 
Regards,
Ilya Biryukov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191029/5bc4c2e3/attachment.html>


More information about the cfe-dev mailing list