[cfe-dev] How do i check the type of a variable?

Adam Smalin acidzombie24 at gmail.com
Wed Jun 22 13:31:15 PDT 2011


I spent the last 2.5hr on this and failed.
How do i do something simple like check the type of a variable?

I have a VarDecl. I tried checking for 1) the type (int vs my own struct),
2) if it is static 3) if it is volatile.
isStaticDataMember() and isStaticLocal() both failed on "static int a=1;", i
did not see anything for volatile including when i tried to find qualifier
flags to do an & IsVolatile. I messed around with get context, definition,
getCanonicalDecl, getType(), etc. Some of them seem to give me the very same
object back. I can check if something is a "Var" or "Record" but simply
getting the name of something is a challenge. This is different from every
reflector and AST i have worked with in the past.


Is there some documentation or manual i can read? I dont think i'll
understand this by looking at definitions and headers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110622/10ebacc8/attachment.html>


More information about the cfe-dev mailing list