This is the mail archive of the
mailing list for the GCC project.
Re: How does one traverse all the global decls
On Wed, Aug 21 2019, Gary Oblock wrote:
> I'm trying to do some analysis code for an optimization
> that involves my code looking at all the declarations and
> types there of during the link time optimizations.
> Note, doing this for the local variables seems to be trivial
> because of FOR_EACH_LOCAL_DECL and there are also
> obvious ways of getting at the type information once I have
> a decl. However, I can't seem to find any similar way of
> getting at the global level decls.
> I'd appreciate your help on this.
Look at FOR_EACH_VARIABLE defined in cgraph.h (because symtab.h does not
exist) and it's various uses throughout the compiler.