<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 5, 2016 at 10:58 AM, Duncan P. N. Exon Smith via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+Kate<br>
<br>
We already have two demangler implementations (LLDB and libcxxabi).  I'd rather not have three.  Have you looked at the LLDB one?  I think Kate has some patches she hasn't had a chance to commit yet that add functionality.  I heard something like 10x faster, and way less stack usage (although not quite fully functional yet).  Seems like a good starting point.<br>
<br>
I don't have a problem with "the one true demangler" living in lib/Support, but ideally we'd find a way to reuse it in libc++abi so that we have one, well-tested, implementation.<br></blockquote><div><br></div><div>IIRC, LLDB has two demanglers: one is a copy of the libc++ demangler and the other is a "fast-path" demangler.  There are some cases that the fast-path demangler cannot handle which leads it to fall back to the libc++ clone.</div><div><br></div><div>My professional opinion, having worked a lot with mangling technology, would be for us to write a new mangler that had incredibly few dependencies on anything.  This would make it easy for us to copy the source or an object file generated by the source.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
> On 2016-May-05, at 06:37, Rafael Espíndola via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
> I really want to start simple. So if adding a demangler the first<br>
> objective is to add one that lets us drop the HAVE_CXXABI_H.<br>
><br>
> After that it can be expanded.<br>
><br>
> Cheers,<br>
> Rafael<br>
><br>
><br>
> On 5 May 2016 at 08:58, David Chisnall <<a href="mailto:David.Chisnall@cl.cam.ac.uk">David.Chisnall@cl.cam.ac.uk</a>> wrote:<br>
>> On 5 May 2016, at 13:47, Rafael Espíndola via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
>>><br>
>>> * Is having an itanium demangler in lib/Support something people find<br>
>>> desirable or at least acceptable?<br>
>><br>
>> Yes.<br>
>><br>
>>> * The libcxxabi code is dual licensed, would the copy in lib/Support be as well?<br>
>><br>
>> Please don’t use the one from libcxxabi.  Howard wrote one that was initially in libcxxabi but was replaced because it had memory requirements that were incompatible with one of the use cases in libcxxabi (on the out-of-memory exception path).  It is far more flexible and allows things to be hooked in at various points in the parse.  I believe that this one was written entirely by Howard during his time as an Apple employee so can likely be relicensed with Chris’s permission if required.<br>
>><br>
>>> * How much llvm-like should we try to make it? Should it take an<br>
>>> StringRef, return an Error and print to a raw_ostream? Or should it<br>
>>> look more like __cxa_demangle to try to make it easier to move code<br>
>>> in?<br>
>><br>
>> I believe that it should be a generally useful demangler.  __cxa_demangle has a very poorly designed interface and is really only useful for turning mangled names into strings.  The earlier one makes it easy, for example, to extract the demangled name of each argument type for a function call.  This is something that I can imagine being useful in JIT FFI contexts, for example.<br>
>><br>
>> David<br>
>><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div></div>