[cfe-dev] Interact with clang's preprocessor
Paolo Bolzoni
bolzoni at cs.unipr.it
Thu Feb 12 07:33:57 PST 2009
dear cfe-list,
I would like to interface with the clang preprocessor in order to check
programming-style rules. For instance:
`Arguments to a function-like macro shall not contain tokens that look
like preprocessing directives.'
An example of violation.
------->
#define AB define
#define C A ## B
#define macro(X) X
int define;
int f() {
return macro(C);
}
-------<
My own code (which checks the arguments' text) should be called:
- *before* function-macro expansion, but
- *after* the expansion of the arguments.
Is there a way to do this using the clang preprocessor (e.g., by
suitably registering my own code as a callback function)?
What is the simplest way to achieve this?
Thanks
pb
More information about the cfe-dev
mailing list