[cfe-dev] Get mangled names C++
rjmccall at apple.com
Fri Jul 16 00:35:07 PDT 2010
On Jul 15, 2010, at 11:55 PM, Frank Fuchs wrote:
> Ok I need and want native performance - it's a scientific application and although very complex things will be referred to the core methods I cannot stop users from writing large loops and complain about the performance. In the worst case they crash the whole thing ... but I'm willing to take that risk :D.
Well, your call.
> Now concerning your answer I do not see how it might help me. If I understand it correctly you have implemented a way to get information about the Decl of jitted methods. Now how does that help me, because I still think I need to declare the mangled names to the JIT, and for this purpose I need to now them at compile time of the host application.
Oh, are you just asking for a way to figure out a mangling statically? I'm sorry, I really thought you were trying to do this dynamically. I'm afraid there really isn't a convenient way of getting a mangling for a declaration string from the command line. It'd be a fun little hack, but nobody's done it yet.
Honestly, I'd suggest just looking in your executable: if you know what .o file contains that symbol, just nm that file and grep for the name, which is always a substring of the mangling.
For example, there's a method on Sema called GetTypeForDeclarator that's implemented in SemaType.cpp.
% nm lib/Sema/Debug+Asserts/SemaType.o | grep GetTypeForDeclarator
00000000001ebd90 s L___func__._ZN5clang4Sema20GetTypeForDeclaratorERNS_10DeclaratorEPNS_5ScopeEPPNS_7TagDeclE
0000000000002670 T __ZN5clang4Sema20GetTypeForDeclaratorERNS_10DeclaratorEPNS_5ScopeEPPNS_7TagDeclE
00000000001eea38 S __ZN5clang4Sema20GetTypeForDeclaratorERNS_10DeclaratorEPNS_5ScopeEPPNS_7TagDeclE.eh
The function is the one in the middle; the mangled name is that, minus the first leading underscore.
More information about the cfe-dev