does clang have a symbol table ?

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

does clang have a symbol table ?

kevinlynx
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 ?
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 ?
3. I define a struct type, and define a variable with this type, how to get more type information from QualType ?

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.

Thanks.


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

Re: does clang have a symbol table ?

Rambo
I have the same question with you and I also want to find the symbol table.are you have solved it,if so ,please tell me ,if not ,we can talk over it.thank you!
Reply | Threaded
Open this post in threaded view
|

Re: does clang have a symbol table ?

David Blaikie
In reply to this post by kevinlynx


On Jan 9, 2013 10:39 PM, "kevinlynx" <[hidden email]> 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.
>
> Thanks.
>
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>


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