From 5964c7d960385186b5fa3970c191f5b265fd39ad Mon Sep 17 00:00:00 2001 From: Jacob Faibussowitsch Date: Fri, 17 Jul 2026 13:09:23 -0400 Subject: [PATCH 1/3] Fix some miscellaneous clang-tidy errors --- .../include/cuda/std/__algorithm/sort.h | 23 ++++++++++++++++--- .../std/__random/linear_congruential_engine.h | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/libcudacxx/include/cuda/std/__algorithm/sort.h b/libcudacxx/include/cuda/std/__algorithm/sort.h index 644c4c901a5..97d2f914fc6 100644 --- a/libcudacxx/include/cuda/std/__algorithm/sort.h +++ b/libcudacxx/include/cuda/std/__algorithm/sort.h @@ -601,8 +601,12 @@ __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last, } else { - while (++__first < __last && !__comp(__pivot, *__first)) + while (++__first < __last) { + if (__comp(__pivot, *__first)) + { + break; + } } } // Find the last element less than or equal to the pivot. @@ -705,8 +709,14 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte // Find the last element less than the pivot. if (__begin == __first - difference_type(1)) { - while (__first < __last && !__comp(*--__last, __pivot)) - ; + while (__first < __last) + { + --__last; + if (__comp(*--__last, __pivot)) + { + break; + } + } } else { @@ -780,6 +790,13 @@ __partition_with_equals_on_left(_RandomAccessIterator __first, _RandomAccessIter while (++__first < __last && !__comp(__pivot, *__first)) { } + while (++__first < __last) + { + if (__comp(__pivot, *__first)) + { + break; + } + } } if (__first < __last) diff --git a/libcudacxx/include/cuda/std/__random/linear_congruential_engine.h b/libcudacxx/include/cuda/std/__random/linear_congruential_engine.h index f2eb6a47ef1..63bd82ca14a 100644 --- a/libcudacxx/include/cuda/std/__random/linear_congruential_engine.h +++ b/libcudacxx/include/cuda/std/__random/linear_congruential_engine.h @@ -214,7 +214,7 @@ class _CCCL_TYPE_VISIBILITY_DEFAULT linear_congruential_engine private: result_type __x_{}; - static constexpr const result_type _Mp = result_type(~0); + static constexpr result_type _Mp = result_type{~0}; static_assert(__M == 0 || __A < __M, "linear_congruential_engine invalid parameters"); static_assert(__M == 0 || __C < __M, "linear_congruential_engine invalid parameters"); From 8da74e0202e3a5f3bfb4bcc6c0be783a72139384 Mon Sep 17 00:00:00 2001 From: Jacob Faibussowitsch Date: Fri, 17 Jul 2026 13:10:54 -0400 Subject: [PATCH 2/3] fixup! Fix some miscellaneous clang-tidy errors --- libcudacxx/include/cuda/std/__algorithm/sort.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libcudacxx/include/cuda/std/__algorithm/sort.h b/libcudacxx/include/cuda/std/__algorithm/sort.h index 97d2f914fc6..96fd3e25452 100644 --- a/libcudacxx/include/cuda/std/__algorithm/sort.h +++ b/libcudacxx/include/cuda/std/__algorithm/sort.h @@ -712,7 +712,7 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte while (__first < __last) { --__last; - if (__comp(*--__last, __pivot)) + if (__comp(*__last, __pivot)) { break; } @@ -787,9 +787,6 @@ __partition_with_equals_on_left(_RandomAccessIterator __first, _RandomAccessIter } else { - while (++__first < __last && !__comp(__pivot, *__first)) - { - } while (++__first < __last) { if (__comp(__pivot, *__first)) From e38f515ca3a75162f287b273e154d471a1f26ac3 Mon Sep 17 00:00:00 2001 From: Jacob Faibussowitsch Date: Fri, 17 Jul 2026 14:15:54 -0400 Subject: [PATCH 3/3] fixup! Fix some miscellaneous clang-tidy errors --- .../include/cuda/std/__random/linear_congruential_engine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcudacxx/include/cuda/std/__random/linear_congruential_engine.h b/libcudacxx/include/cuda/std/__random/linear_congruential_engine.h index 63bd82ca14a..0c27eba1429 100644 --- a/libcudacxx/include/cuda/std/__random/linear_congruential_engine.h +++ b/libcudacxx/include/cuda/std/__random/linear_congruential_engine.h @@ -214,7 +214,7 @@ class _CCCL_TYPE_VISIBILITY_DEFAULT linear_congruential_engine private: result_type __x_{}; - static constexpr result_type _Mp = result_type{~0}; + static constexpr result_type _Mp = static_cast(~0); static_assert(__M == 0 || __A < __M, "linear_congruential_engine invalid parameters"); static_assert(__M == 0 || __C < __M, "linear_congruential_engine invalid parameters");