<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Dec 6, 2013 at 9:04 AM, PavelKatunin <span dir="ltr"><<a href="mailto:wk.katunin@gmail.com" target="_blank">wk.katunin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I want to rewrite all messages in my code, I need replace only selectors, but<br>
I need be able to replace nested expressions f. e. :<br>
<br>
[super foo:[someInstance someMessage:@""] foo2:[someInstance someMessage2]];<br>
I tried do it with clang::Rewriter replaceText and just generate new string,<br>
but there is a problem: It would not be work if I change selectors length,<br>
because I replace nested messages with those old positions.<br></blockquote><div><br></div><div>I don't fully understand what the problem is - can you give an example of what would happen?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
So, I assumed that I need to use clang::Rewriter<br>
ReplaceStmt(originalStatement, newStatement);<br>
<br>
I am using RecursiveASTVisitor to visit all messages, and I want to copy<br>
those messages objects, and replace selectors:<br>
<br>
How can I do that?<br>
<br>
I tried use ObjCMessageExpr::Create but there is so meny args, I don't know<br>
how to get ASTContext &Context and ArrayRef<SourceLocation> SeLocs and Expr<br>
*Receiver parameters from the original message.<br>
<br>
What is the proper way to replace selectors in nested messages using clang<br>
tool (clang tooling interface)?<br></blockquote><div><br></div><div>I'd usually suggest the AST matchers, but you can also use the RAV - the AST matchers make it a little easier to get all information you need together...</div>
<div><br></div><div>Cheers,</div><div>/Manuel</div><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/Clang-Tool-rewrite-ObjCMessageExpr-tp4036492.html" target="_blank">http://clang-developers.42468.n3.nabble.com/Clang-Tool-rewrite-ObjCMessageExpr-tp4036492.html</a><br>

Sent from the Clang Developers mailing list archive at Nabble.com.<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div></div>