This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: What tree flags tell me a variable is local?
- From: Richard Henderson <rth at redhat dot com>
- To: Daniel Berlin <dberlin at dberlin dot org>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 15 Jun 2003 18:03:18 -0700
- Subject: Re: What tree flags tell me a variable is local?
- References: <4D1D062C-9E98-11D7-B489-000A95A34564@dberlin.org>
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~