pre-process and parsing, getting components of DeclStmt

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

pre-process and parsing, getting components of DeclStmt

Ilya Mirsky
Hi,

I have few questions:
  1. I access the AST through the ASTConsumer interface, but although the ParseAST function receives a Preprocessor object as an argument, it seems that pre-processing isn't performed, and as a result, macros and data types from included headers aren't recognized. In this case, why ParseAST receives the Preprocessor object? How can I activate the Preprocessor, and work with the pre-processed data?
  2. In a DeclStmt of the form "int a = b + c", how can I access the assignment components (Binary Operator +, b, c)?
Any help or direction will be appreciated.

Thanks in advance,

--
Best Regards,
Ilya Mirsky
www.cs.bgu.ac.il/~mirskyil


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: pre-process and parsing, getting components of DeclStmt

Sebastian Redl
On 06.10.2010 11:58, Ilya Mirsky wrote:
> In a DeclStmt of the form "int a = b + c", how can I access the
> assignment components (Binary Operator +, b, c)?Any help or direction
> will be appreciated.
There's no assignment, there's only initialization. Get the DeclGroup
for the DeclStmt, get its first (and only) decl, do a checked cast to
VarDecl, and get its initializer. That should give you the BinaryOperator.

Sebastian
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev