<div dir="ltr"><div>Readding cfe-dev.</div><div><br></div>I'm not at all familiar with the Rewriter APIs, so I could be wrong, but ISTM that `Rewriter::InsertTextAfter(Loc, Str)` will insert text *at* Loc (after any other text that was previously inserted at Loc). It also looks like `bo->getLocEnd()` will not return the location of ";" in "foo = bar;". So, it makes sense that things end up a bit off.<div><br></div><div>Have you tried using `InsertTextAfterToken` instead? It looks like that may do what you want. </div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 24, 2016 at 12:13 PM, Awanish <span dir="ltr"><<a href="mailto:avanis1994@gmail.com" target="_blank">avanis1994@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Thank you so much. It was really so helpful.<br>
Can you please help me in. I am getting something very weired<br>
If I a=b+c+d I have to convert this in fun(a,b+c+d)<br>
For this I am doing <br>
rewriter.InsertTextAfter(bo->getLocEnd(),")"); // bo is
pointer to this statement.<br>
My output is <br>
fun(a,b+c+)d<br>
"<u><i><b>) just before last identifier</b></i></u>".<br>
Can you please tell me where I am doing wrong.<div><div><br>
<br>
<div>On Tuesday 19 April 2016 01:48 AM,
George Burgess IV wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Hi!</div>
<div><br>
</div>
ASTMatchers ( <a href="http://clang.llvm.org/docs/LibASTMatchersReference.html" target="_blank">http://clang.llvm.org/docs/LibASTMatchersReference.html</a>
) are probably what you're looking for. If you'd like examples,
clang-tidy's SimplifyBooleanExprCheck seems to create
ASTMatchers for assignment operations.
<div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Apr 18, 2016 at 2:27 AM,
Awanish via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank"></a><a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear
All,<br>
<br>
I want to retrieve all assignment operator from a given
C program. Can anyone please inform me how to do
it?Thanks in advance:-) .<span><font color="#888888"><br>
<br>
-- <br>
Thanks and Regards<br>
Awanish Pandey<br>
PhD, CSE<br>
IIT Kanpur<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</font></span></blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
<br>
<pre cols="72">--
Thanks and Regards
Awanish Pandey
PhD, CSE
IIT Kanpur</pre>
</div></div></div>
</blockquote></div><br></div></div>