[cfe-dev] Accessing the declarations that are in scope at an AST node

Alastair Donaldson afd at imperial.ac.uk
Wed Jun 10 11:12:46 PDT 2015


Hi all

I am new to working with the clang AST.

For some analysis I am doing, I'd like to be able to iterate through all the
declarations that are in scope at a given AST node.

For instance, in:

int g;

void foo(int x) {
  int y;
  { int z; }
  { int a;
     y = a; // *
  }
}

at the Stmt node for * I would like to know which variables are in scope,
and see g, x, y and a but not a.

I have been looking for some way to get a symbol table object that would
contain this info, but have not found what I am looking for.

Could someone please point me in the right direction?

Thanks!

Ally




--
View this message in context: http://clang-developers.42468.n3.nabble.com/Accessing-the-declarations-that-are-in-scope-at-an-AST-node-tp4045983.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list