[PATCH] D44360: [compiler-rt] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 11 18:47:27 PDT 2018
mgrang updated this revision to Diff 137967.
mgrang added a comment.
Fixed indentation.
https://reviews.llvm.org/D44360
Files:
lib/asan/tests/asan_mem_test.cc
lib/fuzzer/FuzzerCorpus.h
lib/fuzzer/FuzzerMerge.cpp
lib/sanitizer_common/tests/sanitizer_common_test.cc
lib/sanitizer_common/tests/sanitizer_linux_test.cc
Index: lib/sanitizer_common/tests/sanitizer_linux_test.cc
===================================================================
--- lib/sanitizer_common/tests/sanitizer_linux_test.cc
+++ lib/sanitizer_common/tests/sanitizer_linux_test.cc
@@ -131,8 +131,8 @@
}
static bool Includes(std::vector<pid_t> first, std::vector<pid_t> second) {
- std::sort(first.begin(), first.end());
- std::sort(second.begin(), second.end());
+ llvm::sort(first.begin(), first.end());
+ llvm::sort(second.begin(), second.end());
return std::includes(first.begin(), first.end(),
second.begin(), second.end());
}
Index: lib/sanitizer_common/tests/sanitizer_common_test.cc
===================================================================
--- lib/sanitizer_common/tests/sanitizer_common_test.cc
+++ lib/sanitizer_common/tests/sanitizer_common_test.cc
@@ -209,7 +209,7 @@
data[j] = create_item(i, j);
}
- std::sort(data.begin(), data.end());
+ llvm::sort(data.begin(), data.end());
for (size_t j = 0; j < i; ++j) {
int val = create_item(i, j);
Index: lib/fuzzer/FuzzerMerge.cpp
===================================================================
--- lib/fuzzer/FuzzerMerge.cpp
+++ lib/fuzzer/FuzzerMerge.cpp
@@ -100,7 +100,7 @@
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 @@
// 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 @@
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);
Index: lib/fuzzer/FuzzerCorpus.h
===================================================================
--- lib/fuzzer/FuzzerCorpus.h
+++ lib/fuzzer/FuzzerCorpus.h
@@ -83,7 +83,7 @@
II.NumFeatures = NumFeatures;
II.MayDeleteFile = MayDeleteFile;
II.UniqFeatureSet = FeatureSet;
- std::sort(II.UniqFeatureSet.begin(), II.UniqFeatureSet.end());
+ llvm::sort(II.UniqFeatureSet.begin(), II.UniqFeatureSet.end());
ComputeSHA1(U.data(), U.size(), II.Sha1);
Hashes.insert(Sha1ToString(II.Sha1));
UpdateCorpusDistribution();
Index: lib/asan/tests/asan_mem_test.cc
===================================================================
--- lib/asan/tests/asan_mem_test.cc
+++ lib/asan/tests/asan_mem_test.cc
@@ -82,7 +82,7 @@
for (size_t i = 0; i < 1000U && !res; i++) {
v.push_back(reinterpret_cast<uintptr_t>(new char[size]));
if (i == 0) continue;
- sort(v.begin(), v.end());
+ llvm::sort(v.begin(), v.end());
for (size_t j = 1; j < v.size(); j++) {
assert(v[j] > v[j-1]);
if ((size_t)(v[j] - v[j-1]) < size * 2) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44360.137967.patch
Type: text/x-patch
Size: 4238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180312/f33f7af5/attachment.bin>
More information about the llvm-commits
mailing list