<div dir="ltr">Actually I found out that getLoc works as desired in this case. <div>thanks!</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">--<div>Himanshu</div></div></div>
<br><div class="gmail_quote">On Wed, Jul 27, 2016 at 10:49 AM, Himanshu <span dir="ltr"><<a href="mailto:himanshu@utexas.edu" target="_blank">himanshu@utexas.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi All, <br><br>I am working on a rewriter that needs to replace certain variable declarations. Let me create a simplified example here. Consider the following DeclStmt: <br><br>size_t v, *u = NULL, w = 10;<br><br>In my RecursiveASTVisitor I implement VisitVarDecl, and use the rewriter.replace(SourceRange, ...) API. I create the SourceRange using VarDecl::getLocStart and getLocEnd. But this leads to the whole DeclStmt being replaced even if only want to replace u or w. I tried using the getInnerLocStart, but it leads to the same issue. How should I get the correct start and end locations for each individual VarDecl? <br><br><br>Thanks!<br>-<br>Himanshu<br><div>
</div></div>
</blockquote></div><br></div>