[libcxx-commits] [PATCH] D128181: [libc++] Make _LIBCPP_DEBUG_RANDOMIZE_RANGE a function

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 21 08:21:10 PDT 2022


ldionne requested changes to this revision.
ldionne added a comment.
This revision now requires changes to proceed.

I like this! I've been meaning to do this but didn't get around to it. I have some comments though.



================
Comment at: libcxx/include/__debug:15
 #include <__config>
 #include <type_traits>
 
----------------
We'll need to include `__algorithm/shuffle.h`. For that reason, I think we need to pull this into another header (to avoid a bunch of headers suddenly including `std::shuffle`).


================
Comment at: libcxx/include/__debug:33-39
+#ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
+#  ifdef _LIBCPP_CXX03_LANG
+#    error Support for unspecified stability is only for C++11 and higher
+#  endif
+
+  if (!__libcpp_is_constant_evaluated())
+    std::shuffle(__first, __last, __libcpp_debug_randomizer());
----------------
For unused params warning.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128181/new/

https://reviews.llvm.org/D128181



More information about the libcxx-commits mailing list