[cfe-users] DeclRefExpr question

2019-12-03 Thread Robert Ankeney via cfe-users
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@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


Re: [cfe-users] DeclRefExpr question

2019-12-03 Thread David Blaikie via cfe-users
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@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@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>
___
cfe-users mailing list
cfe-users@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


Re: [cfe-users] DeclRefExpr question

2019-12-03 Thread Robert Ankeney via cfe-users
Worked great! Many thanks!

Robert


On Tue, Dec 3, 2019 at 10:43 AM David Blaikie  wrote:

> 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@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@lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>>
>
___
cfe-users mailing list
cfe-users@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users