[cfe-dev] Clang Tool: rewrite ObjCMessageExpr
klimek at google.com
Sat Dec 7 07:16:42 PST 2013
On Fri, Dec 6, 2013 at 9:04 AM, PavelKatunin <wk.katunin at gmail.com> wrote:
> I want to rewrite all messages in my code, I need replace only selectors,
> I need be able to replace nested expressions f. e. :
> [super foo:[someInstance someMessage:@""] foo2:[someInstance
> I tried do it with clang::Rewriter replaceText and just generate new
> but there is a problem: It would not be work if I change selectors length,
> because I replace nested messages with those old positions.
I don't fully understand what the problem is - can you give an example of
what would happen?
> So, I assumed that I need to use clang::Rewriter
> ReplaceStmt(originalStatement, newStatement);
> I am using RecursiveASTVisitor to visit all messages, and I want to copy
> those messages objects, and replace selectors:
> How can I do that?
> I tried use ObjCMessageExpr::Create but there is so meny args, I don't know
> how to get ASTContext &Context and ArrayRef<SourceLocation> SeLocs and Expr
> *Receiver parameters from the original message.
> What is the proper way to replace selectors in nested messages using clang
> tool (clang tooling interface)?
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
> View this message in context:
> Sent from the Clang Developers mailing list archive at Nabble.com.
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev