forked from OSchip/llvm-project
Revert "[compiler-rt] Change std::sort to llvm::sort in response to r327219"
This reverts commit 2ee210e1963e03aacc0f71c50e4994bb5c66586e. llvm-svn: 327936
This commit is contained in:
parent
9e72c541f6
commit
a9e74a9165
|
@ -82,7 +82,7 @@ static bool AllocateTwoAdjacentArrays(char **x1, char **x2, size_t size) {
|
||||||
for (size_t i = 0; i < 1000U && !res; i++) {
|
for (size_t i = 0; i < 1000U && !res; i++) {
|
||||||
v.push_back(reinterpret_cast<uintptr_t>(new char[size]));
|
v.push_back(reinterpret_cast<uintptr_t>(new char[size]));
|
||||||
if (i == 0) continue;
|
if (i == 0) continue;
|
||||||
llvm::sort(v.begin(), v.end());
|
sort(v.begin(), v.end());
|
||||||
for (size_t j = 1; j < v.size(); j++) {
|
for (size_t j = 1; j < v.size(); j++) {
|
||||||
assert(v[j] > v[j-1]);
|
assert(v[j] > v[j-1]);
|
||||||
if ((size_t)(v[j] - v[j-1]) < size * 2) {
|
if ((size_t)(v[j] - v[j-1]) < size * 2) {
|
||||||
|
|
|
@ -83,7 +83,7 @@ class InputCorpus {
|
||||||
II.NumFeatures = NumFeatures;
|
II.NumFeatures = NumFeatures;
|
||||||
II.MayDeleteFile = MayDeleteFile;
|
II.MayDeleteFile = MayDeleteFile;
|
||||||
II.UniqFeatureSet = FeatureSet;
|
II.UniqFeatureSet = FeatureSet;
|
||||||
llvm::sort(II.UniqFeatureSet.begin(), II.UniqFeatureSet.end());
|
std::sort(II.UniqFeatureSet.begin(), II.UniqFeatureSet.end());
|
||||||
ComputeSHA1(U.data(), U.size(), II.Sha1);
|
ComputeSHA1(U.data(), U.size(), II.Sha1);
|
||||||
Hashes.insert(Sha1ToString(II.Sha1));
|
Hashes.insert(Sha1ToString(II.Sha1));
|
||||||
UpdateCorpusDistribution();
|
UpdateCorpusDistribution();
|
||||||
|
|
|
@ -100,7 +100,7 @@ bool Merger::Parse(std::istream &IS, bool ParseCoverage) {
|
||||||
TmpFeatures.clear(); // use a vector from outer scope to avoid resizes.
|
TmpFeatures.clear(); // use a vector from outer scope to avoid resizes.
|
||||||
while (ISS1 >> std::hex >> N)
|
while (ISS1 >> std::hex >> N)
|
||||||
TmpFeatures.push_back(N);
|
TmpFeatures.push_back(N);
|
||||||
llvm::sort(TmpFeatures.begin(), TmpFeatures.end());
|
std::sort(TmpFeatures.begin(), TmpFeatures.end());
|
||||||
Files[CurrentFileIdx].Features = TmpFeatures;
|
Files[CurrentFileIdx].Features = TmpFeatures;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -148,12 +148,12 @@ size_t Merger::Merge(const Set<uint32_t> &InitialFeatures,
|
||||||
// Sort. Give preference to
|
// Sort. Give preference to
|
||||||
// * smaller files
|
// * smaller files
|
||||||
// * files with more features.
|
// * files with more features.
|
||||||
llvm::sort(Files.begin() + NumFilesInFirstCorpus, Files.end(),
|
std::sort(Files.begin() + NumFilesInFirstCorpus, Files.end(),
|
||||||
[&](const MergeFileInfo &a, const MergeFileInfo &b) -> bool {
|
[&](const MergeFileInfo &a, const MergeFileInfo &b) -> bool {
|
||||||
if (a.Size != b.Size)
|
if (a.Size != b.Size)
|
||||||
return a.Size < b.Size;
|
return a.Size < b.Size;
|
||||||
return a.Features.size() > b.Features.size();
|
return a.Features.size() > b.Features.size();
|
||||||
});
|
});
|
||||||
|
|
||||||
// One greedy pass: add the file's features to AllFeatures.
|
// One greedy pass: add the file's features to AllFeatures.
|
||||||
// If new features were added, add this file to NewFiles.
|
// 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;
|
Vector<SizedFile> AllFiles;
|
||||||
GetSizedFilesFromDir(Corpora[0], &AllFiles);
|
GetSizedFilesFromDir(Corpora[0], &AllFiles);
|
||||||
size_t NumFilesInFirstCorpus = AllFiles.size();
|
size_t NumFilesInFirstCorpus = AllFiles.size();
|
||||||
llvm::sort(AllFiles.begin(), AllFiles.end());
|
std::sort(AllFiles.begin(), AllFiles.end());
|
||||||
for (size_t i = 1; i < Corpora.size(); i++)
|
for (size_t i = 1; i < Corpora.size(); i++)
|
||||||
GetSizedFilesFromDir(Corpora[i], &AllFiles);
|
GetSizedFilesFromDir(Corpora[i], &AllFiles);
|
||||||
llvm::sort(AllFiles.begin() + NumFilesInFirstCorpus, AllFiles.end());
|
std::sort(AllFiles.begin() + NumFilesInFirstCorpus, AllFiles.end());
|
||||||
Printf("MERGE-OUTER: %zd files, %zd in the initial corpus\n",
|
Printf("MERGE-OUTER: %zd files, %zd in the initial corpus\n",
|
||||||
AllFiles.size(), NumFilesInFirstCorpus);
|
AllFiles.size(), NumFilesInFirstCorpus);
|
||||||
WriteNewControlFile(CFPath, AllFiles, NumFilesInFirstCorpus);
|
WriteNewControlFile(CFPath, AllFiles, NumFilesInFirstCorpus);
|
||||||
|
|
|
@ -209,7 +209,7 @@ TEST(SanitizerCommon, InternalLowerBoundVsStdLowerBound) {
|
||||||
data[j] = create_item(i, j);
|
data[j] = create_item(i, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::sort(data.begin(), data.end());
|
std::sort(data.begin(), data.end());
|
||||||
|
|
||||||
for (size_t j = 0; j < i; ++j) {
|
for (size_t j = 0; j < i; ++j) {
|
||||||
int val = create_item(i, j);
|
int val = create_item(i, j);
|
||||||
|
|
|
@ -131,8 +131,8 @@ static std::vector<pid_t> ReadTidsToVector(ThreadLister *thread_lister) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Includes(std::vector<pid_t> first, std::vector<pid_t> second) {
|
static bool Includes(std::vector<pid_t> first, std::vector<pid_t> second) {
|
||||||
llvm::sort(first.begin(), first.end());
|
std::sort(first.begin(), first.end());
|
||||||
llvm::sort(second.begin(), second.end());
|
std::sort(second.begin(), second.end());
|
||||||
return std::includes(first.begin(), first.end(),
|
return std::includes(first.begin(), first.end(),
|
||||||
second.begin(), second.end());
|
second.begin(), second.end());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue