[cfe-dev] Parsing and rewriting ObjC

jahanian fjahanian at apple.com
Sat Jan 28 12:36:06 PST 2012


On Jan 28, 2012, at 11:25 AM, Tayyab Akram wrote:

> Dear all,
> 
> I need some help/advice regarding Clang. My requirement is to do source-to-source transformation. I have to parse Objective C code and build AST and then modify AST (insert, delete or modify AST nodes) and generate finally output custom code having different semantics and syntax (not Objective C). I do not require to generate IR or binary code. Can someone please confirm following understandings,
> 
> 1. I can parse ObjC code using Clang and then write my Visitor class by extending ASTConsumer to transform the AST and finally I will implement a CustomRewriter to generate the output in my custom format.
> 

You may take a look at objective rewriter source code in:  lib/Rewriter/RewriteObjC.cpp

- Fariborz





More information about the cfe-dev mailing list