[cfe-dev] Getting preprocessor statements
dgregor at apple.com
Thu Apr 15 15:11:10 PDT 2010
On Apr 15, 2010, at 12:54 PM, Jim Crafton wrote:
> I have a couple of pre-processor questions:
> How to collect any #includes in a translation unit?
> How to collect any macros that are defined?
You can write a subclass of PPCallbacks and attach an object of that subclass to the preprocessor. Then, you'll see whenever we #include a file, #define a macro, etc.
Alternatively, you could extend the (optionally-built) PreprocessingRecord to specifically track #includes (it already tracks macro definitions) and use that information.
More information about the cfe-dev