<p dir="ltr"><br>
On Jan 9, 2013 10:39 PM, "kevinlynx" <<a href="mailto:kevinlynx@gmail.com">kevinlynx@gmail.com</a>> wrote:<br>
><br>
> 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:<br>
><br>
> (I implement a class inherited from RecursiveASTVisitor, so the question below is based on this)<br>
><br>
> 1. In the same code scope, I define two variables but with the same name. How to check this by a VarDecl ?</p>
<p dir="ltr">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.</p>

<p dir="ltr">> 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 ?</p>
<p dir="ltr">Again, in debugger, compare a successful run with shadowing and the example in (1), see how they differ.</p>
<p dir="ltr">> 3. I define a struct type, and define a variable with this type, how to get more type information from QualType ?</p>
<p dir="ltr">What 'more information'?</p>
<p dir="ltr">><br>
> 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. <br>
><br>
> Thanks.<br>
><br>
><br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
><br>
</p>