[cfe-dev] Interact with the preprocessor

Paolo Bolzoni bolzoni at cs.unipr.it
Tue Feb 10 04:38:16 PST 2009


On Mon, 09 Feb 2009 18:32:33 +0100
Sebastian Redl <sebastian.redl at getdesigned.at> wrote:
> Paolo Bolzoni wrote:
> > dear cfe-list,
> > Is the clang preprocessor easy to interact/interface with?  As far we
> > could understand, the answer should be negative because clang's
> > preprocessor seems to be tightly integrated with the subsequent parsing
> > phases, but we could be wrong (actually, we _hope_ to be wrong), so I
> > asked here. 
> The preprocessor and the main lexer are pretty tightly integrated, but
> the parser is completely separate. You can run some of your validation
> steps as a run separate from actual compilation and replace the parser.
> I'm pretty sure you have enough control over the PP to do what you want.

I am missing what is the best way you are suggesting me.

What does that replace the parser mean? I saw the clang::Preprocessor but I
missed the way to interact with its actions (no virtual functions for example)

Or you mean I should make a completely new parser using clang (as lib) that
makes the checks?

thanks,
pb



More information about the cfe-dev mailing list