[cfe-dev] Parse AST several times

Argyrios Kyrtzidis akyrtzi at gmail.com
Wed Jan 2 15:01:04 PST 2013


On Jan 2, 2013, at 2:29 PM, Mohammad Adil <madil90 at gmail.com> wrote:

> Hi,
>    While parsing the AST, I am making additions to the code. I want to find out the location of the file where global variables can be added. e.g.
> 
> #include <stdio.h>
> 
> -- Want to find this location to insert global variables here
> 
> int main()
> {
> }
>   
>    How can I find that location.

See Lexer::ComputePreamble()

> Also how does clang represent this statement "using namespace std;"?

Try using the "-ast-dump" compiler argument to explore how the AST is formed from a source file.





More information about the cfe-dev mailing list