[cfe-dev] Source rewrite
Abramo Bagnara
abramobagnara at tin.it
Thu Dec 17 04:05:33 PST 2009
In an application that uses clang libraries we need to transform some
specially written comments in C construct.
e.g:
int p() {
int a = 3;
/* #instrument(a)# */
}
should be parsed as
int p() {
int a = 3;
instrument(a);
}
I've added a CommentHandler to Preprocessor to catch comments and I
thought to use Rewriter class to manipulate the input buffer inserting
after the comment the text to be parsed, but then I've realized that
Rewriter class is not designed to rewrite lexer input buffers, but to
build a separate object where original text and changes live together.
Now I'm a bit confused: what's the proper way to cope with the need
described above?
More information about the cfe-dev
mailing list