[libcxx-commits] [libcxx] [libc++] Inline fast path for`exception_ptr` copy constructor & destructor (PR #165909)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 31 12:11:09 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h,inc -- libcxx/test/std/language.support/support.exception/propagation/exception_ptr_move_assignment.pass.cpp libcxx/test/std/language.support/support.exception/propagation/exception_ptr_move_ctr.pass.cpp libcxx/test/std/language.support/support.exception/propagation/exception_ptr_swap.pass.cpp libcxx/include/__exception/exception_ptr.h libcxx/modules/std/exception.inc libcxx/src/exception.cpp libcxx/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/__exception/exception_ptr.h b/libcxx/include/__exception/exception_ptr.h
index ce0cdd835..0f081c6bc 100644
--- a/libcxx/include/__exception/exception_ptr.h
+++ b/libcxx/include/__exception/exception_ptr.h
@@ -40,14 +40,14 @@ _LIBCPP_PUSH_MACROS
// the functions to be emitted and included in the library. When users of libc++
// compile their code, the __gnu_inline__ attribute will suppress generation of
// these functions while making their definitions available for inlining.
-#ifdef _LIBCPP_EMIT_CODE_FOR_EXCEPTION_PTR
-# define _LIBCPP_EXPORTED_FROM_LIB_INLINEABLE _LIBCPP_EXPORTED_FROM_ABI
-#else
-# if !__has_cpp_attribute(__gnu__::__gnu_inline__)
-# error "GNU inline attribute is not supported"
+# ifdef _LIBCPP_EMIT_CODE_FOR_EXCEPTION_PTR
+# define _LIBCPP_EXPORTED_FROM_LIB_INLINEABLE _LIBCPP_EXPORTED_FROM_ABI
+# else
+# if !__has_cpp_attribute(__gnu__::__gnu_inline__)
+# error "GNU inline attribute is not supported"
+# endif
+# define _LIBCPP_EXPORTED_FROM_LIB_INLINEABLE [[__gnu__::__gnu_inline__]] inline
# endif
-# define _LIBCPP_EXPORTED_FROM_LIB_INLINEABLE [[__gnu__::__gnu_inline__]] inline
-#endif
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgnu-inline-cpp-without-extern")
@@ -91,8 +91,14 @@ class _LIBCPP_EXPORTED_FROM_ABI exception_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); }
+ _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);
+ }
static exception_ptr __from_native_exception_pointer(void*) _NOEXCEPT;
``````````
</details>
https://github.com/llvm/llvm-project/pull/165909
More information about the libcxx-commits
mailing list