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:
int i = 1;
int i = 2;
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.