[libcxx-commits] [libcxx] [libcxxabi] [WebAssembly] Upstream misc. EH changes (PR #92990)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 21 21:09:44 PDT 2024


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 d53c6cdbc108729ce5dc7d4e9184db025206fefc e9b94cdff7fe222130af626063408b6e78def8cf -- libcxx/include/__exception/exception_ptr.h libcxx/include/__locale libcxxabi/include/cxxabi.h libcxxabi/src/cxa_exception.cpp libcxxabi/src/cxa_exception.h
``````````

</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 868fd7c015..a67299fae0 100644
--- a/libcxx/include/__exception/exception_ptr.h
+++ b/libcxx/include/__exception/exception_ptr.h
@@ -97,15 +97,16 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT {
   void* __ex = __cxxabiv1::__cxa_allocate_exception(sizeof(_Ep));
 #      ifdef __wasm__
   // In Wasm, a destructor returns its argument
-  (void)__cxxabiv1::__cxa_init_primary_exception(__ex, const_cast<std::type_info*>(&typeid(_Ep)), [](void* __p) -> void* {
+  (void)__cxxabiv1::__cxa_init_primary_exception(
+      __ex, const_cast<std::type_info*>(&typeid(_Ep)), [](void* __p) -> void* {
 #      else
   (void)__cxxabiv1::__cxa_init_primary_exception(__ex, const_cast<std::type_info*>(&typeid(_Ep)), [](void* __p) {
 #      endif
-    std::__destroy_at(static_cast<_Ep2*>(__p));
+        std::__destroy_at(static_cast<_Ep2*>(__p));
 #      ifdef __wasm__
-    return __p;
+        return __p;
 #      endif
-  });
+      });
 
   try {
     ::new (__ex) _Ep2(__e);
diff --git a/libcxxabi/include/cxxabi.h b/libcxxabi/include/cxxabi.h
index 0e3969084e..27507dc298 100644
--- a/libcxxabi/include/cxxabi.h
+++ b/libcxxabi/include/cxxabi.h
@@ -48,21 +48,20 @@ extern _LIBCXXABI_FUNC_VIS void
 __cxa_free_exception(void *thrown_exception) throw();
 // This function is an LLVM extension, which mirrors the same extension in libsupc++ and libcxxrt
 extern _LIBCXXABI_FUNC_VIS __cxa_exception*
-#ifdef __wasm__
+#  ifdef __wasm__
 // In Wasm, a destructor returns its argument
 __cxa_init_primary_exception(void* object, std::type_info* tinfo, void*(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw();
-#else
+#  else
 __cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw();
-#endif
+#  endif
 
 // 2.4.3 Throwing the Exception Object
-extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
-__cxa_throw(void *thrown_exception, std::type_info *tinfo,
-#ifdef __wasm__
-            void *(_LIBCXXABI_DTOR_FUNC *dest)(void *));
-#else
+extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_throw(void* thrown_exception, std::type_info* tinfo,
+#  ifdef __wasm__
+                                                                void*(_LIBCXXABI_DTOR_FUNC* dest)(void*));
+#  else
             void (_LIBCXXABI_DTOR_FUNC *dest)(void *));
-#endif
+#  endif
 
 // 2.5.3 Exception Handlers
 extern _LIBCXXABI_FUNC_VIS void *
diff --git a/libcxxabi/src/cxa_exception.cpp b/libcxxabi/src/cxa_exception.cpp
index ff69a4c65e..0d3f37a607 100644
--- a/libcxxabi/src/cxa_exception.cpp
+++ b/libcxxabi/src/cxa_exception.cpp
@@ -208,8 +208,8 @@ void __cxa_free_exception(void *thrown_object) throw() {
 
 __cxa_exception* __cxa_init_primary_exception(void* object, std::type_info* tinfo,
 #ifdef __wasm__
-// In Wasm, a destructor returns its argument
-                                              void *(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw() {
+                                              // In Wasm, a destructor returns its argument
+                                              void*(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw() {
 #else
                                               void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw() {
 #endif
@@ -274,7 +274,7 @@ exception.
 void
 #ifdef __wasm__
 // In Wasm, a destructor returns its argument
-__cxa_throw(void *thrown_object, std::type_info *tinfo, void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)) {
+__cxa_throw(void* thrown_object, std::type_info* tinfo, void*(_LIBCXXABI_DTOR_FUNC* dest)(void*)) {
 #else
 __cxa_throw(void *thrown_object, std::type_info *tinfo, void (_LIBCXXABI_DTOR_FUNC *dest)(void *)) {
 #endif

``````````

</details>


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


More information about the libcxx-commits mailing list