diff options
author | Mandeep Singh Grang <mgrang@codeaurora.org> | 2018-03-20 00:44:59 +0000 |
---|---|---|
committer | Mandeep Singh Grang <mgrang@codeaurora.org> | 2018-03-20 00:44:59 +0000 |
commit | dc09ebf71b5ad1ac45340ccd24cbb8c2ecffb762 (patch) | |
tree | b11c269f99f2babbb93a34e4b4c06e22f4ab8c85 /compiler-rt/lib/fuzzer/FuzzerMerge.cpp | |
parent | 0d03881eb57e30f99ad3ab811842c90a7a0d8748 (diff) | |
download | bcm5719-llvm-dc09ebf71b5ad1ac45340ccd24cbb8c2ecffb762.tar.gz bcm5719-llvm-dc09ebf71b5ad1ac45340ccd24cbb8c2ecffb762.zip |
[compiler-rt] Change std::sort to llvm::sort in response to r327219
Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.
To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.
Reviewers: kcc, rsmith, RKSimon, eugenis
Reviewed By: RKSimon
Subscribers: efriedma, kubamracek, dberris, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D44360
llvm-svn: 327929
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerMerge.cpp')
-rw-r--r-- | compiler-rt/lib/fuzzer/FuzzerMerge.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerMerge.cpp b/compiler-rt/lib/fuzzer/FuzzerMerge.cpp index 5f3052a39c1..321f2654c73 100644 --- a/compiler-rt/lib/fuzzer/FuzzerMerge.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerMerge.cpp @@ -100,7 +100,7 @@ bool Merger::Parse(std::istream &IS, bool ParseCoverage) { TmpFeatures.clear(); // use a vector from outer scope to avoid resizes. while (ISS1 >> std::hex >> N) TmpFeatures.push_back(N); - std::sort(TmpFeatures.begin(), TmpFeatures.end()); + llvm::sort(TmpFeatures.begin(), TmpFeatures.end()); Files[CurrentFileIdx].Features = TmpFeatures; } } else { @@ -148,12 +148,12 @@ size_t Merger::Merge(const Set<uint32_t> &InitialFeatures, // Sort. Give preference to // * smaller files // * files with more features. - std::sort(Files.begin() + NumFilesInFirstCorpus, Files.end(), - [&](const MergeFileInfo &a, const MergeFileInfo &b) -> bool { - if (a.Size != b.Size) - return a.Size < b.Size; - return a.Features.size() > b.Features.size(); - }); + llvm::sort(Files.begin() + NumFilesInFirstCorpus, Files.end(), + [&](const MergeFileInfo &a, const MergeFileInfo &b) -> bool { + if (a.Size != b.Size) + return a.Size < b.Size; + return a.Features.size() > b.Features.size(); + }); // One greedy pass: add the file's features to AllFeatures. // If new features were added, add this file to NewFiles. @@ -321,10 +321,10 @@ void Fuzzer::CrashResistantMerge(const Vector<std::string> &Args, Vector<SizedFile> AllFiles; GetSizedFilesFromDir(Corpora[0], &AllFiles); size_t NumFilesInFirstCorpus = AllFiles.size(); - std::sort(AllFiles.begin(), AllFiles.end()); + llvm::sort(AllFiles.begin(), AllFiles.end()); for (size_t i = 1; i < Corpora.size(); i++) GetSizedFilesFromDir(Corpora[i], &AllFiles); - std::sort(AllFiles.begin() + NumFilesInFirstCorpus, AllFiles.end()); + llvm::sort(AllFiles.begin() + NumFilesInFirstCorpus, AllFiles.end()); Printf("MERGE-OUTER: %zd files, %zd in the initial corpus\n", AllFiles.size(), NumFilesInFirstCorpus); WriteNewControlFile(CFPath, AllFiles, NumFilesInFirstCorpus); |