This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What tree flags tell me a variable is local?


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]