[libcxx-commits] [libcxx] [libc++] Inline fast path for`exception_ptr` copy constructor & destructor (PR #165909)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 6 07:21:46 PST 2025
================
@@ -36,6 +29,21 @@ exception_ptr exception_ptr::__from_native_exception_pointer(void* __e) noexcept
return ptr;
}
+exception_ptr::~exception_ptr() noexcept { __decrement_refcount(__ptr_); }
+
+exception_ptr::exception_ptr(const exception_ptr& other) noexcept : __ptr_(other.__ptr_) {
+ __increment_refcount(__ptr_);
+}
+
+exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept {
+ if (__ptr_ != other.__ptr_) {
+ __increment_refcount(other.__ptr_);
+ __decrement_refcount(__ptr_);
+ __ptr_ = other.__ptr_;
+ }
+ return *this;
----------------
philnik777 wrote:
Can we maybe merge these implementations now?
https://github.com/llvm/llvm-project/pull/165909
More information about the libcxx-commits
mailing list