[libcxx-commits] [libcxx] [libc++] Optimize `std::exception_ptr` (PR #162773)
Adrian Vogelsgesang via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 17 17:44:20 PDT 2025
================
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+namespace __cxxabiv1 {
+
+extern "C" {
+_LIBCPP_OVERRIDABLE_FUNC_VIS void __cxa_increment_exception_refcount(void*) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void __cxa_decrement_exception_refcount(void*) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void* __cxa_current_primary_exception() _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS void __cxa_rethrow_primary_exception(void*);
+}
+
+} // namespace __cxxabiv1
+
+namespace std {
+
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE inline void exception_ptr::__increment_refcount(void* __ptr) _NOEXCEPT {
----------------
vogelsgesang wrote:
I only added it to `exception_ptr::__{increment,decrement}_refcount` since this was a net-new indirection which I introduced also into already pre-existing functions (such as `exception_ptr::~exception_ptr`) and I considered it to be less risky if I mark this indirection with `_LIBCPP_ALWAYS_INLINE` to make sure the compiler actually removes that indirection again.
That being said, I guess I was overly careful here. I will remove it
https://github.com/llvm/llvm-project/pull/162773
More information about the libcxx-commits
mailing list