[cfe-dev] Source to Source Transformation guide lines
mtzrgb at gmail.com
Mon Apr 5 01:48:12 PDT 2010
I haven't used CIndex so I can't help you on that, but others of course can
To get started, take a look at clang/lib/Frontend/RewriteObjC.cpp. This code
rewrites objc to C. There are two approaches for tsource-to-source
transformation (Rewriting, AST re-build). Im the Rewriting approach the AST
is traversed and the transformed code is generated as you traverse the AST,
this is what is used in RewriteObjC. The other approach is to build the
transformed AST from the original AST and then use the prettyprinter to
generate the code. This approach is flexible and allows you to apply a chain
of transformations on the AST.
You can copy the Clang main file and start your tool under clang/tools. Try
to trace the main file to know how the ObjC rewritter is invoked.
Hope this helps,
On Sun, Apr 4, 2010 at 2:08 PM, Mohamed Yousef <harrrrpo at gmail.com> wrote:
> I'm working in a project involving source to source transformation of some
> arbitrary c code , i'm looking forward to using Clang
> my main problem is where to start , i can find approx. no documentation on
> 1) how complete is the CIndex interface , what limitations can it impose ?
> 2) any existing source to source applications based on clang that can be of
> help as a starting point ?
> 3) can the LLVM Kaleidoscope lessons be of help in understanding how to use
> clang libraries ?
> Mohamed Yousef
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev