[cfe-dev] Rewriting #include in a source-to-source translator

Santosh Nagarakatte santosh.nagarakatte at gmail.com
Tue Nov 30 11:52:52 PST 2010


Hi all,

I am writing a source to source translator for C. I have a rewriter
similar to RewriteObjC.cpp.
I am rewriting all header files and hence during the rewriting phase,
I want to change the #includes " .." in the file being translated to
the appropriate translated file.

To accomplish this, my rewriter currently inherits the ASTConsumer and
PPCallbacks. I have defined the function InclusionDirective in my
rewriter. However the callback is not being called  when I test it on
a simple test file which has #includes.

What am I doing wrong? Any suggestions?

Thanks,
Santosh

-- 
Santosh G Nagarakatte,
PhD Student,
Computer and Information Science Department
University of Pennsylvania,
Philadelphia-19104
http://www.cis.upenn.edu/~santoshn



More information about the cfe-dev mailing list