[libcxx-commits] [libcxx] 72d747d - [libc++][test] Move backported algorithms to `libcxx/test/support` (#199431)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun May 24 16:27:07 PDT 2026


Author: A. Jiang
Date: 2026-05-25T07:27:02+08:00
New Revision: 72d747d9576cfd13039cb5f7ed7f8fb69f85daec

URL: https://github.com/llvm/llvm-project/commit/72d747d9576cfd13039cb5f7ed7f8fb69f85daec
DIFF: https://github.com/llvm/llvm-project/commit/72d747d9576cfd13039cb5f7ed7f8fb69f85daec.diff

LOG: [libc++][test] Move backported algorithms to `libcxx/test/support` (#199431)

And namespace `util`. This will make helpers provided more consistently,
and potentially allow us to unify test helper namespaces in the future.

Added: 
    libcxx/test/support/algorithms.h

Modified: 
    

Removed: 
    libcxx/test/std/utilities/memory/specialized.algorithms/destroy.h


################################################################################
diff  --git a/libcxx/test/std/utilities/memory/specialized.algorithms/destroy.h b/libcxx/test/support/algorithms.h
similarity index 74%
rename from libcxx/test/std/utilities/memory/specialized.algorithms/destroy.h
rename to libcxx/test/support/algorithms.h
index e6af0008757c6..83d8b9d5c84d1 100644
--- a/libcxx/test/std/utilities/memory/specialized.algorithms/destroy.h
+++ b/libcxx/test/support/algorithms.h
@@ -7,8 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LIBCPP_TEST_STD_UTILITIES_MEMORY_SPECIALIZED_ALGORITHMS_DESTROY_H
-#define LIBCPP_TEST_STD_UTILITIES_MEMORY_SPECIALIZED_ALGORITHMS_DESTROY_H
+#ifndef TEST_SUPPORT_ALGORITHMS_H
+#define TEST_SUPPORT_ALGORITHMS_H
 
 #include <cstddef>
 #include <memory>
@@ -16,7 +16,9 @@
 
 #include "test_macros.h"
 
-namespace backport {
+// This file intends to provide algorithms backported from newer standard revisions.
+
+namespace util {
 
 template <class T, typename std::enable_if<!std::is_array<T>::value, int>::type = 0>
 TEST_CONSTEXPR_CXX20 void destroy_at(T* p) {
@@ -26,22 +28,22 @@ template <class T, typename std::enable_if<std::is_array<T>::value, int>::type =
 TEST_CONSTEXPR_CXX20 void destroy_at(T* p) {
   static_assert(std::extent<T>::value > 0, "must destroy a bounded array");
   for (std::size_t i = 0; i != std::extent<T>::value; ++i)
-    backport::destroy_at(i + *p);
+    util::destroy_at(i + *p);
 }
 
 template <class Iterator>
 TEST_CONSTEXPR_CXX20 void destroy(Iterator first, Iterator last) {
   for (; first != last; ++first)
-    backport::destroy_at(std::addressof(*first));
+    util::destroy_at(std::addressof(*first));
 }
 
 template <class Iterator, class Size>
 TEST_CONSTEXPR_CXX20 Iterator destroy_n(Iterator first, Size n) {
   for (; n > 0; ++first, (void)--n)
-    backport::destroy_at(std::addressof(*first));
+    util::destroy_at(std::addressof(*first));
   return first;
 }
 
-} // namespace backport
+} // namespace util
 
-#endif // LIBCPP_TEST_STD_UTILITIES_MEMORY_SPECIALIZED_ALGORITHMS_DESTROY_H
+#endif // TEST_SUPPORT_ALGORITHMS_H


        


More information about the libcxx-commits mailing list