[PATCH] D123420: [demangler] Rust demangler buffer reuse

Tomasz Miąsko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 08:35:30 PDT 2022


tmiasko added a comment.

In D123420#3442384 <https://reviews.llvm.org/D123420#3442384>, @urnathan wrote:

> In D123420#3440296 <https://reviews.llvm.org/D123420#3440296>, @tmiasko wrote:
>
>> The API thus far was intended to match that of `__cxa_demangle`, where the caller retains the ownership of the provided buffer when demangling fails. This is no longer the case in the new implementation. I would rather avoid diverging from `__cxa_demangle` in such a subtle way.
>
> Ah, it took me a while to figure out where that's happening, I see it now.  Awkward.   I suppose the rust demangler could always return the new buffer (and free any incoming buffer) in the success case?  Something like `if (Buf) std::free(Buf);` instead of that memcpy/free dance?

Sounds good. At that point we might remove `N` and `Buf` parameters altogether? This functionality is not used anywhere in LLVM.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123420/new/

https://reviews.llvm.org/D123420



More information about the llvm-commits mailing list