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

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.


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.