DeclRefExpr question

Let’s assume I have a DeclRefExpr that is referenceing some variable that is declared as “static const int var;”. How can I determine the variable is static? There is no isStaticLocal() or getStorageClass() call as there would be for the VarDecl. Is there something within the QualType that gets me that info?

Many thanks,

I’d guess you’d call “getDecl” to get the decl the DeclRefExpr is referencing, then dyn_cast that (the decl is a ValueDecl*) to VarDecl to see if it’s a variable that’s being referenced (could be a function, etc, etc) then do whatever you want to do with that VarDecl.

Worked great! Many thanks!