[libcxx-commits] [libcxx] [libc++] Check correctly ref-qualified __is_callable in algorithms (PR #101553)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 1 13:16:41 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 451bba6fbf0bc9a2bfff9253ac45caf7c57d38b9 8f6ed8eb81e445e5ced87590624827b3999668e2 --extensions cpp,h -- libcxx/test/libcxx/algorithms/callable-requirements-rvalue.compile.pass.cpp libcxx/test/libcxx/algorithms/callable-requirements.verify.cpp libcxx/include/__algorithm/equal_range.h libcxx/include/__algorithm/includes.h libcxx/include/__algorithm/is_permutation.h libcxx/include/__algorithm/lower_bound.h libcxx/include/__algorithm/max_element.h libcxx/include/__algorithm/min_element.h libcxx/include/__algorithm/minmax.h libcxx/include/__algorithm/minmax_element.h libcxx/include/__algorithm/partial_sort_copy.h libcxx/include/__algorithm/search.h libcxx/include/__algorithm/search_n.h libcxx/include/__algorithm/upper_bound.h libcxx/src/regex.cpp libcxx/test/libcxx/algorithms/ranges_robust_against_copying_projections.pass.cpp libcxx/test/libcxx/algorithms/robust_against_cpp20_hostile_iterators.compile.pass.cpp libcxx/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp libcxx/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp libcxx/test/std/algorithms/alg.nonmodifying/alg.search/search_pred.pass.cpp libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp libcxx/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp
``````````

</details>

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

``````````diff
diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp
index 2fa3e9ffac..ccc948ae1f 100644
--- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp
@@ -32,14 +32,14 @@ TEST_CONSTEXPR bool test_constexpr() {
     }
 #endif
 
-struct count_equal {
-  static unsigned count;
-  template <class T>
-  bool operator()(const T& x, const T& y) const {
-    ++count;
-    return x == y;
-  }
-};
+    struct count_equal {
+      static unsigned count;
+      template <class T>
+      bool operator()(const T& x, const T& y) const {
+        ++count;
+        return x == y;
+      }
+    };
 
 unsigned count_equal::count = 0;
 
diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp
index 3010df8f0c..c310ca7510 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp
@@ -46,13 +46,11 @@ test(Iter first, Iter last, const T& value)
 }
 
 struct Val {
-    int val;
+  int val;
 };
 
 struct Comparator {
-    bool operator()(Val const& t, int x) const {
-        return t.val < x;
-    }
+  bool operator()(Val const& t, int x) const { return t.val < x; }
 };
 
 template <class Iter>
@@ -75,9 +73,9 @@ test()
 
     // Make sure upper_bound works with a value that differs from the sequence's element type
     {
-        int array[] = {1, 2, 3};
-        Iter result = std::upper_bound(Iter(array), Iter(array + 3), Val{2}, Comparator{});
-        assert(result == Iter(array + 2));
+      int array[] = {1, 2, 3};
+      Iter result = std::upper_bound(Iter(array), Iter(array + 3), Val{2}, Comparator{});
+      assert(result == Iter(array + 2));
     }
 }
 

``````````

</details>


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


More information about the libcxx-commits mailing list