[libcxx-commits] [PATCH] D155598: [libc++abi] Use std::abort() instead of std::terminate() on failure to allocate
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 18 07:07:05 PDT 2023
ldionne added a comment.
I have no idea how to reliably test this.
I'm also looking for feedback on whether folks think this is reasonable, or whether we should pursue this alternative explained in the commit message:
Another option would be to properly handle failure-to-allocate inside
ItaniumDemangle.h and to propagate something like an error code or a
std::expected to the caller of all functions in the demangler that
can allocate. Then, we could make sure that cxa_demangle returns
nullptr when it fails to demangle the input due to any error, as it is
supposed to (but today "true" out-of-memory conditions are not handled
properly). The demangling_terminate_handler() would then see that
cxa_demangle failed to do its job and would still print the
appropriate message, simply using the non-demangled exception type.
However, this is akin to a partial rewrite of the demangler code since
a large number of functions would now have to return a std::expected
to account for out-of-memory conditions.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155598/new/
https://reviews.llvm.org/D155598
More information about the libcxx-commits
mailing list