[libcxx-commits] [libcxx] [libc++] Use std::__{scope, exception}_guard throughout the code base (PR #161322)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 29 23:32:32 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 ,h,cpp -- libcxx/include/__hash_table libcxx/include/__memory/shared_ptr.h libcxx/include/__memory/uninitialized_algorithms.h libcxx/include/__utility/scope_guard.h libcxx/include/__vector/vector_bool.h libcxx/include/deque libcxx/include/forward_list libcxx/include/future libcxx/include/list libcxx/include/string libcxx/include/valarray libcxx/src/filesystem/error.h libcxx/src/filesystem/format_string.h libcxx/src/locale.cpp
``````````

: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/__memory/uninitialized_algorithms.h b/libcxx/include/__memory/uninitialized_algorithms.h
index b48d01bfe..34d065dc9 100644
--- a/libcxx/include/__memory/uninitialized_algorithms.h
+++ b/libcxx/include/__memory/uninitialized_algorithms.h
@@ -108,8 +108,8 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
 __uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) {
   _ForwardIterator __idx = __first;
   auto __guard           = std::__make_exception_guard([&] { std::__destroy(__first, __idx); });
-    for (; __idx != __last; ++__idx)
-      ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(__x);
+  for (; __idx != __last; ++__idx)
+    ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(__x);
   __guard.__complete();
 
   return __idx;

``````````

</details>


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


More information about the libcxx-commits mailing list