[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 15:58:40 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();
----------------
EricWF wrote:

> * as of recently `libcxxrt` has this function as well: [https://github.com/libcxxrt/libcxxrt/blob/master/src/cxx](https://github.com/libcxxrt/libcxxrt/blob/master/src/cxxabi.h#L211)

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


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


More information about the libcxx-commits mailing list