[libcxx-commits] [libcxx] Reapply "[libc++] Simplify the implementation of reserve() and shrink_to_fit() (#113453)" (PR #125888)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 5 09:23:42 PST 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 7ef636e1c4c49b175833dc91c44ed338b899c29b 32ccdb4c4c72c6adbc5ff4c00c5cd68c3ff8afe5 --extensions ,cpp -- libcxx/include/string libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/string b/libcxx/include/string
index 249b18bb77..b7f2d12269 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -3402,9 +3402,9 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat
     return;
   }
 
-#if _LIBCPP_HAS_EXCEPTIONS
+#  if _LIBCPP_HAS_EXCEPTIONS
   try {
-#endif // _LIBCPP_HAS_EXCEPTIONS
+#  endif // _LIBCPP_HAS_EXCEPTIONS
     __annotation_guard __g(*this);
     auto __size       = size();
     auto __allocation = std::__allocate_at_least(__alloc_, __target_capacity + 1);
@@ -3423,11 +3423,11 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat
     __alloc_traits::deallocate(__alloc_, __ptr, __get_long_cap());
     __set_long_cap(__allocation.count);
     __set_long_pointer(__allocation.ptr);
-#if _LIBCPP_HAS_EXCEPTIONS
+#  if _LIBCPP_HAS_EXCEPTIONS
   } catch (...) {
     return;
   }
-#endif // _LIBCPP_HAS_EXCEPTIONS
+#  endif // _LIBCPP_HAS_EXCEPTIONS
 }
 
 template <class _CharT, class _Traits, class _Allocator>

``````````

</details>


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


More information about the libcxx-commits mailing list