[libcxx-commits] [PATCH] D125268: [libc++abi][NFC] Refactor exception type demangling into a separate function
Nathan Sidwell via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue May 10 06:07:42 PDT 2022
urnathan added inline comments.
================
Comment at: libcxxabi/src/cxa_default_handlers.cpp:64-65
static_cast<const __shim_type_info*>(exception_header->exceptionType);
-#if !defined(LIBCXXABI_NON_DEMANGLING_TERMINATE)
- // Try to get demangled name of thrown_type
- int status;
char buf[1024];
- size_t len = sizeof(buf);
- const char* name = __cxa_demangle(thrown_type->name(), buf, &len, &status);
- if (status != 0)
- name = thrown_type->name();
-#else
- const char* name = thrown_type->name();
-#endif
+ char const* name = demangle(thrown_type->name(), buf);
// If the uncaught exception can be caught with std::exception&
----------------
This isn't code you're changing the meaning of, but this is broken. the buffer passed to __cxa_demangle must come from malloc. If ever a thrown type demangles to more than 1024 chars, people are going to be sad.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125268/new/
https://reviews.llvm.org/D125268
More information about the libcxx-commits
mailing list