[compiler-rt] 10089ce - scudo: Switch from std::random_shuffle to std::shuffle in a test.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 16:13:42 PST 2019


Author: Peter Collingbourne
Date: 2019-11-19T16:13:12-08:00
New Revision: 10089ce2027ac15fc04427189b3b22ccec4d8535

URL: https://github.com/llvm/llvm-project/commit/10089ce2027ac15fc04427189b3b22ccec4d8535
DIFF: https://github.com/llvm/llvm-project/commit/10089ce2027ac15fc04427189b3b22ccec4d8535.diff

LOG: scudo: Switch from std::random_shuffle to std::shuffle in a test.

This lets the test build with C++17.

Differential Revision: https://reviews.llvm.org/D70471

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp b/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
index be620a6937c0..047a61653cb2 100644
--- a/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
@@ -14,6 +14,7 @@
 
 #include <condition_variable>
 #include <mutex>
+#include <random>
 #include <thread>
 
 template <class SecondaryT> static void testSecondaryBasic(void) {
@@ -42,7 +43,7 @@ template <class SecondaryT> static void testSecondaryBasic(void) {
   std::vector<void *> V;
   for (scudo::uptr I = 0; I < 32U; I++)
     V.push_back(L->allocate(Size));
-  std::random_shuffle(V.begin(), V.end());
+  std::shuffle(V.begin(), V.end(), std::mt19937(std::random_device()()));
   while (!V.empty()) {
     L->deallocate(V.back());
     V.pop_back();


        


More information about the llvm-commits mailing list