[cfe-dev] does clang have a symbol table ?
dblaikie at gmail.com
Mon May 13 10:44:48 PDT 2013
On Jan 9, 2013 10:39 PM, "kevinlynx" <kevinlynx at gmail.com> wrote:
> Of course clang have a symbol table (or more) I guess. But what I want
is, how to use them ? Here I have some questions related to symbol table:
> (I implement a class inherited from RecursiveASTVisitor, so the question
below is based on this)
> 1. In the same code scope, I define two variables but with the same name.
How to check this by a VarDecl ?
Best way I find to answer questions like this is to write erroneous code
(declare two variables with the same name in the same scope) and compile
it, then break in the debugger in something like clang::Sema::Diag, walk
back up the stack and see how you got there.
> 2. If I define a variable which has the same name as a global variable,
or a variable in the outter scope. How to check this ?
Again, in debugger, compare a successful run with shadowing and the example
in (1), see how they differ.
> 3. I define a struct type, and define a variable with this type, how to
get more type information from QualType ?
What 'more information'?
> ps. I googled for a while and it seems I can use Sema class, but Sema is
a huge class with lots of member functions. So it's really difficult to
start with Sema without any documents/tutorials.
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev