[cfe-dev] Leave conditional directives untouched by Preprocessor
Ivan
ivanhoe12 at gmail.com
Mon Jul 16 15:33:40 PDT 2012
Hello everyone!
I'm experimenting on Clang trying to build some specific C preprocessor.
One thing I don't want him to do is to process conditional directives.
For example if there is such an expression in the code:
#if SOME_CONDITION
int i = 1;
#else
int i = 2;
#endif
a normal preprocessor will process it to "int i = 1;" or "int i = 2;"
depending
on condition. But I want my preprocessor to leave this expression untouched.
I want to ask what is the best way to do this? Is there some option for
Preprocessor or PreprocessorLexer or Lexer class? I've looked through their
code but did't find nothing which can help in this case (I don't want to
modify their code because I want my program to work with vanilla Clang).
Now I'm going to make a derived class of Preprocessor (or Lexer) and
override
appropriate methods. But maybe there is more simple and elegant solution.
Thanks,
Ivan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120717/48bbe9da/attachment.html>
More information about the cfe-dev
mailing list