[llvm-branch-commits] [libcxx] [NFC][libc++] Guard agains operator& hijacking. (PR #128351)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Feb 22 03:22:22 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 0e79268c4ac3b91dd5742bc04d8d5658bf587b0e 6614bf3ed9221cf47baeede6d06f2c9f2455dfe1 --extensions ,h -- libcxx/include/__atomic/atomic.h libcxx/include/__atomic/atomic_ref.h libcxx/include/__charconv/traits.h libcxx/include/__filesystem/path.h libcxx/include/__functional/hash.h libcxx/include/__iterator/aliasing_iterator.h libcxx/include/__locale libcxx/include/__mdspan/layout_left.h libcxx/include/__mdspan/layout_right.h libcxx/include/__mdspan/layout_stride.h libcxx/include/__mdspan/mdspan.h libcxx/include/__memory/shared_count.h libcxx/include/__ostream/basic_ostream.h libcxx/include/__split_buffer libcxx/include/__stop_token/intrusive_shared_ptr.h libcxx/include/__string/constexpr_c_functions.h libcxx/include/__thread/thread.h libcxx/include/cwchar libcxx/include/fstream libcxx/include/future libcxx/include/locale libcxx/include/regex libcxx/include/string
``````````

</details>

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

``````````diff
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 617431efca..c04cbc316d 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -2177,7 +2177,8 @@ void __bracket_expression<_CharT, _Traits>::__exec(__state& __s) const {
             }
           }
           if (!__equivalences_.empty()) {
-            string_type __s2 = __traits_.transform_primary(std::addressof(__ch2.first), std::addressof(__ch2.first) + 2);
+            string_type __s2 =
+                __traits_.transform_primary(std::addressof(__ch2.first), std::addressof(__ch2.first) + 2);
             for (size_t __i = 0; __i < __equivalences_.size(); ++__i) {
               if (__s2 == __equivalences_[__i]) {
                 __found = true;
@@ -2225,7 +2226,8 @@ void __bracket_expression<_CharT, _Traits>::__exec(__state& __s) const {
       }
     }
     if (!__ranges_.empty()) {
-      string_type __s2 = __collate_ ? __traits_.transform(std::addressof(__ch), std::addressof(__ch) + 1) : string_type(1, __ch);
+      string_type __s2 =
+          __collate_ ? __traits_.transform(std::addressof(__ch), std::addressof(__ch) + 1) : string_type(1, __ch);
       for (size_t __i = 0; __i < __ranges_.size(); ++__i) {
         if (__ranges_[__i].first <= __s2 && __s2 <= __ranges_[__i].second) {
           __found = true;
@@ -5678,7 +5680,8 @@ template <class _BidirectionalIterator, class _CharT, class _Traits>
 bool regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator==(const regex_token_iterator& __x) const {
   if (__result_ == nullptr && __x.__result_ == nullptr)
     return true;
-  if (__result_ == std::addressof(__suffix_) && __x.__result_ == std::addressof(__x.__suffix_) && __suffix_ == __x.__suffix_)
+  if (__result_ == std::addressof(__suffix_) && __x.__result_ == std::addressof(__x.__suffix_) &&
+      __suffix_ == __x.__suffix_)
     return true;
   if (__result_ == nullptr || __x.__result_ == nullptr)
     return false;

``````````

</details>


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


More information about the llvm-branch-commits mailing list