How to get type of variable (whether it is int, float ... static .. const .. )

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

How to get type of variable (whether it is int, float ... static .. const .. )

manavender reddy
Hi all,

How can i get the type of variable for eg. const int x = 1;
How can i get information that x is const and int. I have pointer to DeclStmt, from that i can get VarDecl. I am stuck after that.

Thanks
Manavender

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

Re: How to get type of variable (whether it is int, float ... static .. const .. )

Tom Care
From the VarDecl you can get the QualType, which has the information you need. Using the -cc1 parameter -ast-dump can be useful here too, to see what the layout is in the AST.

On Aug 17, 2010, at 3:30 PM, manavender reddy wrote:

Hi all,

How can i get the type of variable for eg. const int x = 1;
How can i get information that x is const and int. I have pointer to DeclStmt, from that i can get VarDecl. I am stuck after that.

Thanks
Manavender
_______________________________________________
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