C++ mangling, function name to mangled name (or tree)
Romain Geissler
romain.geissler@gmail.com
Thu Jul 14 10:52:00 GMT 2011
Le 13 juil. 2011 à 18:35, Pierre Vittet a écrit :
> Hello,
>
> sorry to answer that late (I didn't saw your mail in my mailbox.... + I was preparing me for RMLL/Libre software meeting).
Yeah i know, i wanted to be there for your RMLL session, but i had to work on tuesday !
>
> Your solution looks to be a nice one, I am goiing to try it and I will post the result of my experiment. I was not aware of that hook.
>
> Thanks!
>
> Pierre Vittet
At that time i didn't know you were working on Melt, and for now the few things i know about it is that it's mainly abut hooking the pass manager (or am i wrong ?) So all those useful events like PLUGIN_PRE_GENERICIZE or PLUGIN_FINISH_TYPE don't seems to be catchable through the Melt API (again, i'm maybe wrong, but if not it should be easy to add that feature to Melt).
The main drawback of using PLUGIN_PRE_GENERICIZE to catch symbol declaration is that it is fired only for function body declaration. That's why i pinged an old patch adding a new event PLUGIN_FINISH_DECL. See http://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg09792.html
To get the full name of any declaration (ie like my_namespace::my_class::my_value or int::my_namespace::my_class::my_method (int, const char *)) just do:
const char *fullname = lang_hooks.decl_printable_name (my_dec, 2l);
(with #include "langhooks.h")
That's exactly what current_function_name() does with current_function_decl.
Romain Geissler
More information about the Gcc
mailing list