Hello,
I am working on a plugin which permits simple static analysis. I would
like my plugin to work with C++ but I have to take in account the C++
mangling.
I would like user of the plugin to give in arguments the name of the
functions on which he would like a test to be run. That means that I
must convert the string containing a function name (like
"myclass::init") and get either the mangled name or the tree
corresponding to the function. I know that there might be several
results (functions with the same name and different arguments), a good
policy for me would be to recover every concerned functions (at least
for the moment).
I guess what I want to do is possible, because there are already some
tools doing it (like gdb).
Also, when I use fdump-ipa-all, I get something interesting in the
.visibility file:
int Application::test(int)/1 @0xb6cff6b4 (asm: _ZN11Application4testEi)
availability:available analyzed reachable body externally_visible finalized
called by: int main()/2 (1.00 per call) (can throw external)
calls: int printf(const char*, ...)/4 (1.00 per call) (can throw
external)
We get both the "real name" and the mangled one
(_ZN11Application4testEi). But I don't know where I can find such
translating.
I have looked at cp/mangle.c, which has some interesting function, for
exemple giving the mangle named from the corresponding tree, but in this
case, how can I get the tree?
If you have any idea, thanks!
Cheers,
Pierre Vittet