diff options
| author | Tim Shen <timshen91@gmail.com> | 2017-10-04 01:05:34 +0000 |
|---|---|---|
| committer | Tim Shen <timshen91@gmail.com> | 2017-10-04 01:05:34 +0000 |
| commit | 83fd6a1243d2c704332ca7633c2d4ebe02b4a86d (patch) | |
| tree | 059e6b974533d1e74c5eb1241400c3a76f91240a /llvm/lib | |
| parent | 7d1f5fd8409320a58b912b2667cc7bee63b2efe7 (diff) | |
| download | bcm5719-llvm-83fd6a1243d2c704332ca7633c2d4ebe02b4a86d.tar.gz bcm5719-llvm-83fd6a1243d2c704332ca7633c2d4ebe02b4a86d.zip | |
[FuzzerUtil] Partially revert D38481 on FuzzerUtil
This is because lib/Fuzzer doesn't really depend on llvm infrastucture.
It's not easy to access the llvm hardware_concurrency here.
Differential Reivision: https://reviews.llvm.org/D38481
llvm-svn: 314870
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Fuzzer/FuzzerUtil.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerUtil.cpp b/llvm/lib/Fuzzer/FuzzerUtil.cpp index 5f76ddc3678..f5a77737449 100644 --- a/llvm/lib/Fuzzer/FuzzerUtil.cpp +++ b/llvm/lib/Fuzzer/FuzzerUtil.cpp @@ -195,7 +195,15 @@ void PrintPC(const char *SymbolizedFMT, const char *FallbackFMT, uintptr_t PC) { Printf(FallbackFMT, PC); } -unsigned NumberOfCpuCores() { return hardware_concurrency(); } +unsigned NumberOfCpuCores() { + unsigned N = std::thread::hardware_concurrency(); + if (!N) { + Printf("WARNING: std::thread::hardware_concurrency not well defined for " + "your platform. Assuming CPU count of 1.\n"); + N = 1; + } + return N; +} size_t SimpleFastHash(const uint8_t *Data, size_t Size) { size_t Res = 0; |

