[PATCH] D123420: [demangler] Rust demangler buffer reuse
Tomasz Miąsko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 8 17:02:34 PDT 2022
tmiasko added a comment.
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 divering from `__cxa_demangle` in such a subtle way.
The Itanium demangler gets away with the direct use of the buffer because it separates fallible parsing from infallible printing.
> the length of the incoming buffer will have come from a previous call, which was the length of the demangled string
I think this is a bug in the implementation. The *N should have been updated to reflect allocated memory size. From Demangler API in Itanium C++ ABI:
> In either case, the new buffer size will be stored in *n.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123420/new/
https://reviews.llvm.org/D123420
More information about the llvm-commits
mailing list