diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2017-02-16 14:37:03 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2017-02-16 14:37:03 +0000 |
commit | e9110d71dd9f7c2cce0e50f7d34eb3a5d75121a1 (patch) | |
tree | 33a7c5377cefb88b47b0d938ff0f8bc80467d3f0 /llvm/tools/llvm-stress/llvm-stress.cpp | |
parent | 908a3d342091e7e3be64b01366087166d0039952 (diff) | |
download | bcm5719-llvm-e9110d71dd9f7c2cce0e50f7d34eb3a5d75121a1.tar.gz bcm5719-llvm-e9110d71dd9f7c2cce0e50f7d34eb3a5d75121a1.zip |
Remove uses of deprecated std::random_shuffle in the LLVM code base. Reviewed as https://reviews.llvm.org/D29780.
llvm-svn: 295325
Diffstat (limited to 'llvm/tools/llvm-stress/llvm-stress.cpp')
-rw-r--r-- | llvm/tools/llvm-stress/llvm-stress.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/tools/llvm-stress/llvm-stress.cpp b/llvm/tools/llvm-stress/llvm-stress.cpp index 731a24d0ac2..fdfa197e601 100644 --- a/llvm/tools/llvm-stress/llvm-stress.cpp +++ b/llvm/tools/llvm-stress/llvm-stress.cpp @@ -28,6 +28,7 @@ #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/ToolOutputFile.h" #include <algorithm> +#include <random> #include <vector> namespace llvm { @@ -113,6 +114,12 @@ public: return Rand64() % y; } + /// Make this like a C++11 random device + typedef uint32_t result_type; + uint32_t operator()() { return Rand32(); } + static constexpr result_type min() { return 0; } + static constexpr result_type max() { return 0x7ffff; } + private: unsigned Seed; }; @@ -662,7 +669,7 @@ static void IntroduceControlFlow(Function *F, Random &R) { BoolInst.push_back(&Instr); } - std::random_shuffle(BoolInst.begin(), BoolInst.end(), R); + std::shuffle(BoolInst.begin(), BoolInst.end(), R); for (auto *Instr : BoolInst) { BasicBlock *Curr = Instr->getParent(); |