[cfe-dev] Clang and code transformation
Chris Lattner
clattner at apple.com
Thu Jan 8 14:56:45 PST 2009
On Jan 8, 2009, at 5:23 AM, forumer at smartmobili.com wrote:
> Hi,
>
> I would like to find a tool to add some trace inside some C files
> from GCC.
> I tried with some regexp but without success so I would like to know
> if
> clang
> would allow me to parse C files and add some frpintf() like this :
Sure, clang can do this short of thing. It supports rewriting
interfaces to insert strings into existing files. Please take a look
at the ObjC->C rewriter for some examples.
For example:
$ cat t.m
char * test() { return @encode(int); }
$ clang t.m -rewrite-objc -o -
...
char * test() { return "i"; }
-Chris
More information about the cfe-dev
mailing list