[clang-tools-extra] [libcxxabi] [libcxx] [llvm] [clang] [libc++] [libc++abi] Initialize exception directly in make_exception_ptr if __cxa_init_primary_exception is available in ABI-library (PR #65534)

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 26 02:00:52 PST 2023


================
@@ -51,11 +71,25 @@ class _LIBCPP_EXPORTED_FROM_ABI exception_ptr {
 template <class _Ep>
 _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT {
 #  ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+#    if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
+  using _Ep2 = __decay_t<_Ep>;
+  void* __ex = exception_ptr::__init_native_exception(
+      sizeof(_Ep), const_cast<std::type_info*>(&typeid(_Ep)), exception_ptr::__dest_thunk<_Ep2>);
----------------
itrofimow wrote:

Using lambda here requires C++11, so i guarded all this with `__cplusplus >= 201103L`

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


More information about the llvm-commits mailing list