[llvm-dev] Get the class name of the function

zxhuan via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 26 22:55:13 PST 2020


Hey guys,

I'm wondering if there is a way to write an llvm pass to get the class name
of the functions. I am not talking about the simple self-written functions
like foo::bar(...), but those STL container functions like
_ZNKSt4lessINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEclERKS5_S8_,
demangles as std::less<std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >
>::operator()(std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&) const. In this case,
the class name should be std::less<std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, and the function name
is operator().

I have tried to do this with clang tools, but the template parameters are
not expanded and you can get pretty less information, which is not what
I am looking for.

PS. This is specifically for C++.

Any help would be appreciated!

Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200227/7d170453/attachment.html>


More information about the llvm-dev mailing list