What tree flags tell me a variable is local?

Richard Henderson rth@redhat.com
Mon Jun 16 11:04:00 GMT 2003


On Sat, Jun 14, 2003 at 02:44:59PM -0400, Daniel Berlin wrote:
> Currently, I check DECL_CONTEXT, and iff it's a FUNCTION_DECL, we say 
> it's local, otherwise, we call decl_function_context and see if it 
> returns NULL.
> 
> Is there a better way?

First, !TREE_STATIC says the variable is automatic.  That's 99%
of what you need to know.  Second, anything TREE_PUBLIC isn't
function-local.  Which only leaves function-local statics, which
I guess you have to check DECL_CONTEXT as you are doing.


r~



More information about the Gcc mailing list