<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jun 7, 2013, at 5:31 AM, Stephan Bergmann <<a href="mailto:sbergman@redhat.com">sbergman@redhat.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Am new here, hope this isn't too dumb a question.  (And from looking at the archives, fits better here than on cfe-users?)<br><br>Anyway, what I want to do is a rewriting Clang plugin that removes one argument from specific function calls.  But where I'm lost is how to determine the SourceLocation of the comma preceding the given argument, to do something like<br></blockquote><div><br></div><div>You could remove this range:</div><div><br></div><div>[loc-for-end-of-token of end location of preceding argument, end location of removed argument]</div><div><br></div><div>like in these examples:</div><div><br></div><div><font face="Monaco">foo(4, 5, 6) --> </font><span style="font-family: Monaco; ">foo(4, 6)</span></div><div><font face="Monaco">     ^-^</font></div><div><br></div><div><font face="Monaco">foo(4 , 5 , 6) --> </font><span style="font-family: Monaco; ">foo(4 , 6)</span></div><div><font face="Monaco">     ^--^</font></div><div><font face="Monaco"><br></font></div><div><div><font face="Monaco">foo(4, 5, 6) --> </font><span style="font-family: Monaco; ">foo(4, 5)</span></div><div><font face="Monaco">        ^-^</font></div></div><div><font face="Monaco"><br></font></div><div><div><div><font face="Monaco">foo( 4 , 5 , 6 ) --> </font><span style="font-family: Monaco; ">foo( 4 , 5 )</span></div><div><font face="Monaco">          ^--^</font></div></div></div><div><font face="Monaco"><br></font></div><blockquote type="cite"><br>  Rewriter.RemoveText(<br>    SourceRange(<br>      /*TODO*/,<br>      callExpr->getArg(1)->getLocEnd()));<br><br>Thanks,<br>Stephan<br>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev<br></blockquote></div><br></body></html>