[libcxx-commits] [libcxxabi] [libc++abi] Remove unnecessary dependency on std::unique_ptr (PR #73277)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 8 11:10:56 PST 2024


================
@@ -61,20 +49,30 @@ static void demangling_terminate_handler()
             exception_header + 1;
     const __shim_type_info* thrown_type =
         static_cast<const __shim_type_info*>(exception_header->exceptionType);
-    auto name = demangle(thrown_type->name());
+
+    auto name = [str = thrown_type->name()] {
+#    ifndef LIBCXXABI_NON_DEMANGLING_TERMINATE
+      if (const char* result = __cxxabiv1::__cxa_demangle(str, nullptr, nullptr, nullptr))
----------------
ldionne wrote:

https://reviews.llvm.org/D125268 is relevant for a discussion about whether it's OK to leak here given that we're terminating. I think the answer was "yes, it's fine". Tagging @urnathan for awareness.

I wonder if this could cause problems with sanitizers, though.

https://github.com/llvm/llvm-project/pull/73277


More information about the libcxx-commits mailing list