[cfe-dev] AST for preprocessor directives

Douglas Gregor dgregor at apple.com
Mon Feb 7 10:06:59 PST 2011


On Feb 7, 2011, at 9:39 AM, Andrey Tarasevich wrote:

> Hello!
> 
> At the moment I'm doing some source-to-source manipulations with clang. I using the RewriteObjC.cpp as an example of such manipulations, but as far as I understand the AST is not produced for the preprocessor directives, like for instance - #define value 1
> Is the manual parsing the only way to deal with preprocessor directives or there is a way to translate them into AST? 

You can implement your own PPCallbacks subclass to watch all of the preprocessor activity.

> Also where I can get list of all DeclNodes for the C language? Are they mixed with Objective-C and C++ in DeclNodes.inc?

Yes, they're mixed in DeclNodes.inc. The C-specific nodes are all defined in include/clang/AST/Decl.h

	- Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110207/43edfe34/attachment.html>


More information about the cfe-dev mailing list