[libcxx-commits] [libcxx] [libc++] Optimize std::swap of locales (PR #209760)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 15 06:53:35 PDT 2026


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 -- libcxx/test/benchmarks/text/localization/locale.bench.cpp libcxx/include/__locale libcxx/test/benchmarks/text/localization/ctype.bench.cpp libcxx/test/benchmarks/text/localization/num_get.bench.cpp libcxx/test/benchmarks/text/localization/num_put.bench.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/__locale b/libcxx/include/__locale
index 8f29d7139..b9cd14ebd 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -147,9 +147,7 @@ private:
   friend void swap(locale&, locale&);
 };
 
-inline void swap(locale& __lhs, locale& __rhs) {
-  std::swap(__lhs.__locale_, __rhs.__locale_);
-}
+inline void swap(locale& __lhs, locale& __rhs) { std::swap(__lhs.__locale_, __rhs.__locale_); }
 
 class _LIBCPP_EXPORTED_FROM_ABI locale::facet : public __shared_count {
 protected:

``````````

</details>


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


More information about the libcxx-commits mailing list