[cfe-dev] Preprocessor/Parser interaction
jason.haslam at gmail.com
Fri Feb 17 12:45:26 PST 2012
On Feb 17, 2012, at 11:38 AM, Aditya Kumar wrote:
> For my project(related to source code analysis of C++ program) I need to traverse the clang AST to figure out all the places
> where the preprocessor macros are called in the program.
> I am fairly new to clang to be honest.
If you only need information about where macros are used then there's no need to traverse the AST at all. The PPCallbacks mechanism allows clients to observe the interesting aspects of preprocessing. In particular the MacroExpands callback is invoked every time a macro is used.
> 1. What i want to know is whether the preprocessor gets called before the parser or
> it gets called from the parser as each token is seen by it.
> 2. How can I obtain the AST of a C++ program which has been generated without any preprocessing.
> Even if there is some syntax-error in doing so, it is okay.
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev