[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
Tue Nov 4 08:53:38 PST 2025


================
@@ -67,6 +89,17 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(exception_ptr& __x, exception_ptr& __y) _
 class _LIBCPP_EXPORTED_FROM_ABI exception_ptr {
   void* __ptr_;
 
+  static void __do_increment_refcount(void* __ptr) _NOEXCEPT;
+  static void __do_decrement_refcount(void* __ptr) _NOEXCEPT;
+  _LIBCPP_HIDE_FROM_ABI static void __increment_refcount(void* __ptr) _NOEXCEPT {
+    if (__ptr)
+      __do_increment_refcount(__ptr);
+  }
+  _LIBCPP_HIDE_FROM_ABI static void __decrement_refcount(void* __ptr) _NOEXCEPT {
+    if (__ptr)
+      __do_decrement_refcount(__ptr);
+  }
----------------
philnik777 wrote:

I feel like these names are rather poor. It'd either inline these relatively simple functions or rename them so it's obvious they _might_ inc/decrement the refcount.

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


More information about the libcxx-commits mailing list