[LLVMdev] C++ demangling in LLVM
Chris Lattner
clattner at apple.com
Sat Jul 21 17:29:55 PDT 2012
On Jul 4, 2012, at 12:43 PM, Michael Spencer wrote:
> On Wed, Jul 4, 2012 at 8:33 AM, Alexey Samsonov <samsonov at google.com> wrote:
>> Hello!
>>
>> We want to implement in-process symbolizer for {Address,Thread}Sanitizer
>> testing tools that would be based on LLVM libraries.
>> I've noticed that llvm-nm (as well as other tools) doesn't demangle C++
>> names. Is it true, that LLVM doesn't have the code that is capable
>> of that, and if yes, are there any plans to add it?
>> Depending on something like libiberty.a doesn't seem like a good or portable
>> solution.
>>
>> --
>> Alexey Samsonov, MSK
>>
>
> Yes, LLVM currently has no C++ demangler, and it needs one. Although I
> have no idea where it should live. It would be nice if it could live
> in clang next to the mangler, but clang doesn't even need a demangler.
> llvm tools, lld, and compiler-rt do.
libc++abi provides a full C++ demangler, along with an extended API that provides a tree-based representation of the demangled name (implemented for LLDB).
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/include/cxa_demangle.h?revision=HEAD&view=markup
On Jul 4, 2012, at 10:08 PM, Chandler Carruth wrote:
> In the same way that the core LLVM libraries have support routines for DWARF, I think that both mangling and demangling should be provided as well.
You can't really implement mangling without a full C++ (or whatever) AST of some sort to come from. Demangling is a much easier problem, at least structurally. :)
-Chris
More information about the llvm-dev
mailing list