sangeeta chowdhary via llvm-dev
2020-Jun-24 19:10 UTC
[llvm-dev] Function name demangling in llvm ir
Hello, I am doing some program analysis with C++ programs. I need to check if some particular function is called in the program, for that I need the name of the function being called in the call instruction. Since C++ mangles the name of the function, I need a way to demangle the function name in llvm IR. Is there any way to achieve that in llvm pass? Regards, Sangeeta -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200624/dcc1b31a/attachment.html>
Johannes Doerfert via llvm-dev
2020-Jun-24 19:47 UTC
[llvm-dev] Function name demangling in llvm ir
I have not tried it but maybe `std::string llvm::demangle(const std::string &MangledName)` in `llvm/Demangle/Demangle.h` is already what you want. On 6/24/20 2:10 PM, sangeeta chowdhary via llvm-dev wrote:> Hello, > > I am doing some program analysis with C++ programs. I need to check if some > particular function is called in the program, for that I need the name of > the function being called in the call instruction. Since C++ mangles the > name of the function, I need a way to demangle the function name in llvm > IR. Is there any way to achieve that in llvm pass? > > Regards, > Sangeeta > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200624/c1d3d327/attachment.html>
David Blaikie via llvm-dev
2020-Jun-24 20:20 UTC
[llvm-dev] Function name demangling in llvm ir
(though, usual caveat: you /usually/ shouldn't be doing that - instead relying only on whatever semantics the IR actually carries, rather than implying extra semantics based on the demangled name) On Wed, Jun 24, 2020 at 12:48 PM Johannes Doerfert via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > I have not tried it but maybe > > `std::string llvm::demangle(const std::string &MangledName)` > > in `llvm/Demangle/Demangle.h` > > is already what you want. > > > > On 6/24/20 2:10 PM, sangeeta chowdhary via llvm-dev wrote: > > Hello, > > I am doing some program analysis with C++ programs. I need to check if some > particular function is called in the program, for that I need the name of > the function being called in the call instruction. Since C++ mangles the > name of the function, I need a way to demangle the function name in llvm > IR. Is there any way to achieve that in llvm pass? > > Regards, > Sangeeta > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev