[cfe-dev] SourceRange and its end

Chris Lattner clattner at apple.com
Thu Oct 6 17:29:18 PDT 2011


On Oct 6, 2011, at 1:13 AM, Thomas Sanchez wrote:

> Hi,
> I would like to get the end of an expression, for example during a
> visit for a binary operator:
> 
> Expr const *lhs = node->getLHS();
> SourceLocation loc = lhs->getSourceRange().getEnd();
> clang::PresumedLoc ploc = sm.getPresumedLoc(loc);
> size_t column = sm.getSpellingColumnNumber(loc)
> 
> I got only the beginning of the expression (i.e. the beginning == the
> end), how can I get the end or the size of the expression ?

Hi Thomas,

Please see:
http://clang.llvm.org/docs/InternalsManual.html#SourceRange

-Chris



More information about the cfe-dev mailing list