[cfe-dev] newbie wants to do round-trip, source to source C parsing

Douglas Gregor dgregor at apple.com
Mon Apr 12 09:26:20 PDT 2010


On Apr 8, 2010, at 12:22 PM, Simon wrote:

> Hello! I discovered clang from this thread:
> http://stackoverflow.com/questions/239722/ast-from-c-code
> 
> The example link in the thread describing how to perform 'source to
> source' parsing and re-writing using clang doesn't work anymore :-(
> Can anybody give links and/or hints and tips on how to do this and
> where to start?

Check out the Rewriter class, which helps with rewriting specific parts of the source without disturbing the rest of the source. Also, look at the Objective-C rewriter in lib/Frontend/RewriteObjc.cpp.

	- Doug



More information about the cfe-dev mailing list