[cfe-dev] getEndLoc of a DeclRefExpr

Nico Weber thakis at chromium.org
Sun Oct 24 18:28:13 PDT 2010


Hi,

DeclRefExpr::getEndLoc() always returns the same as
DeclRefExpr::getBeginLoc(). Is there a reason for this? It's a bit
annoying when using the Rewriter with DeclRefExprs.

This happens because getEndLoc() delegates to the SourceRange of the
DeclRefExpr's NameInfo (see DeclRefExpr::getSourceRange() in
Expr.cpp).

If this is not by design: The attached patch fixes the problem. All
tests still pass.

Nico
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-declrefinfo-endloc.patch
Type: application/octet-stream
Size: 681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101024/4786d87e/attachment.obj>


More information about the cfe-dev mailing list