The GCC plugin API has a PLUGIN_FINISH_TYPE callback which provides an easy way for plugins to enumerate instantiated types in GCC. Unfortunately no such equivalent exists for decls.
Would be great to get a way to get notified when global variable, struct member and static method DECLs are completed in the parser.
Proposed patch at http://gcc.gnu.org/ml/gcc-patches/2009-12/msg01032.html
please, can we finally get this useful hook in 4.5/4.6?
We still have not received copyright assignment paperwork from Brian, so we are not able to accept the patch unfortunately.
What paperwork still needs to be done for this (9 line) patch? The FSF should have my personal copyright assignment, but I could not get one from my employer when I wrote the patch, Stanford University (according to Stanford's policies they would not claim copyright on this patch). I now work for Mozilla, which I think has a company wide copyright assignment.
The last time I tried to add this hook (http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00780.html), the copyright issue seemed OK but the patch was blocked on account of adding a function call to every finish_decl. That issue has since been fixed by making invoke_plugin_callbacks a static inline function.
this feature seems to have been implemented already in gcc 4.7.x, can it be backported to 4.5.x and 4.6.x perhaps? it would make life easier for plugin writers who would like to provide the same features for all the plugin capable gcc series.
(In reply to PaX Team from comment #5)
> this feature seems to have been implemented already in gcc 4.7.x, can it be
> backported to 4.5.x and 4.6.x perhaps?
I would like to see that happen, too. E.g. gcc-lua-cdecl and Gentoo's hardened-sources would benefit from this.
Fixed for 4.7. There are no plans to backport the change to older compilers.