I'm dumping the AST of some headers like this:
clang -cc1 -ast-dump -fblocks header.h
However, any #define
s on the header are not showing on the dump. Is there a way of adding them?
I'm dumping the AST of some headers like this:
clang -cc1 -ast-dump -fblocks header.h
However, any #define
s on the header are not showing on the dump. Is there a way of adding them?
It's true, #defines are handled by the preprocessor, not the compiler. So you need a preprocessor parser stage. I know of two:
Boost Wave can preprocess the input for you, and/or give you hooks to trigger on macro definitions or uses.
The Clang tool pp-trace uses a Clang library that can do callbacks on many preprocessor events, including macro definitions.