[libcxx-commits] [libcxx] [libc++] [libc++abi] Initialize exception directly in make_exception_ptr if __cxa_init_primary_exception is available in ABI-library (PR #65534)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 25 21:37:26 PDT 2023


================
@@ -36,13 +36,19 @@ class type_info; // forward declaration
 
 // runtime routines use C calling conventions, but are in __cxxabiv1 namespace
 namespace __cxxabiv1 {
+
+struct __cxa_exception;
+
 extern "C"  {
 
 // 2.4.2 Allocating the Exception Object
 extern _LIBCXXABI_FUNC_VIS void *
 __cxa_allocate_exception(size_t thrown_size) throw();
 extern _LIBCXXABI_FUNC_VIS void
 __cxa_free_exception(void *thrown_exception) throw();
+// This function is an llvm extension
+extern _LIBCXXABI_FUNC_VIS __cxa_exception*
+__cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw();
----------------
itrofimow wrote:

> It's worth noting that you added the libcxxrt extension.

Agreed, didn't mean to try to trick anyone.

The point i'm trying to make is that
a) both libsupc++ and libcxxrt found the extension reasonable
b) libcxx could make use of the extension already present in aforementioned implementation, and it wouldn't be unreasonable to add it into libcxxabi as well

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


More information about the libcxx-commits mailing list