https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101010

--- Comment #2 from Hedayat Vatankhah <hedayat.fwd at gmail dot com> ---
(In reply to Martin Sebor from comment #1)
> Does the type_info::name() string match what you're looking for?

No, not at all. Looks like I've not clearly described my intent. 

First of all, type_info::name() is a runtime function. Both builtins I asked
are compile-time builtins: they should be replaced at compile time with the
desired string or symbol.

Also, I want the symbol name of the referred function or variable, not its
type. What your sample program outputs is the mangled name of type "void
(MyClass::*)(MyClass*, int)", but what I want is the mangled name of symbol
"void MyClass::member(MyClass*, int)". 

Finally, I asked about two distinct type of builtins:
1. The first kind is replaced at compile time with the mangled name as a
string. This kind, makes the following possible (note that probably dropping &
makes it more clear):
void f() __attribute__ ((weak, alias (__builtin_mangle(MyClass::member))));
Should become same as the following:
void f() __attribute__ ((weak, alias ("_ZN7MyClass6memberEi")));


2. The second kind, does not generate a "string"; It generates a symbol at
compile time. Consider the example I provided in comment 0, it should be
converted to the following at compile time:

void __wrap__ZN7MyClass6memberEi(MyClass *mc_this, int a)
{
   if (call_real)
       __real__ZN7MyClass6memberEi(mc_this, a);
   else
   {...}
}

Reply via email to