[cfe-users] DeclRefExpr question

David Blaikie via cfe-users cfe-users at lists.llvm.org
Tue Dec 3 10:43:04 PST 2019


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.

On Tue, Dec 3, 2019 at 1:33 PM Robert Ankeney via cfe-users <
cfe-users at lists.llvm.org> wrote:

> 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,
> Robert
>
> _______________________________________________
> cfe-users mailing list
> cfe-users at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20191203/00175857/attachment.html>


More information about the cfe-users mailing list