diff options
author | Kostya Serebryany <kcc@google.com> | 2019-02-12 01:00:08 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2019-02-12 01:00:08 +0000 |
commit | f458106da45068ed68820b6b55c66ad943477770 (patch) | |
tree | ef91b2805fda0d17a326a952d01695dd3e40df52 | |
parent | bd1c0708ac075a7f82883e70caac41accd8880b6 (diff) | |
download | compiler-rt-f458106da45068ed68820b6b55c66ad943477770.tar.gz |
[libFuzzer] replace slow std::mt19937 with a much faster std::minstd_rand; second attempt after failed r352732, this time with a fix for cmake
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@353782 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/fuzzer/FuzzerRandom.h | 6 | ||||
-rw-r--r-- | lib/fuzzer/tests/CMakeLists.txt | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/fuzzer/FuzzerRandom.h b/lib/fuzzer/FuzzerRandom.h index af8e1a4eb..659283eee 100644 --- a/lib/fuzzer/FuzzerRandom.h +++ b/lib/fuzzer/FuzzerRandom.h @@ -14,10 +14,10 @@ #include <random> namespace fuzzer { -class Random : public std::mt19937 { +class Random : public std::minstd_rand { public: - Random(unsigned int seed) : std::mt19937(seed) {} - result_type operator()() { return this->std::mt19937::operator()(); } + Random(unsigned int seed) : std::minstd_rand(seed) {} + result_type operator()() { return this->std::minstd_rand::operator()(); } size_t Rand() { return this->operator()(); } size_t RandBool() { return Rand() % 2; } size_t SkewTowardsLast(size_t n) { diff --git a/lib/fuzzer/tests/CMakeLists.txt b/lib/fuzzer/tests/CMakeLists.txt index 6abb72def..485153be7 100644 --- a/lib/fuzzer/tests/CMakeLists.txt +++ b/lib/fuzzer/tests/CMakeLists.txt @@ -46,7 +46,8 @@ if(COMPILER_RT_DEFAULT_TARGET_ARCH IN_LIST FUZZER_SUPPORTED_ARCH) FOLDER "Compiler-RT Runtime tests") if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH) - set(LIBFUZZER_TEST_RUNTIME_DEPS libcxx_fuzzer_${arch}-build) + file(GLOB libfuzzer_headers ../*.h) + set(LIBFUZZER_TEST_RUNTIME_DEPS libcxx_fuzzer_${arch}-build ${libfuzzer_headers}) set(LIBFUZZER_TEST_RUNTIME_CFLAGS -isystem ${LIBCXX_${arch}_PREFIX}/include/c++/v1) set(LIBFUZZER_TEST_RUNTIME_LINK_FLAGS ${LIBCXX_${arch}_PREFIX}/lib/libc++.a) endif() |