mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Use llvm::stable_sort. NFC
llvm-svn: 358897
This commit is contained in:
parent
36a1b0220b
commit
056369f3a7
@ -956,7 +956,7 @@ static int AnalyzeBitcode() {
|
||||
for (unsigned i = 0, e = Stats.CodeFreq.size(); i != e; ++i)
|
||||
if (unsigned Freq = Stats.CodeFreq[i].NumInstances)
|
||||
FreqPairs.push_back(std::make_pair(Freq, i));
|
||||
std::stable_sort(FreqPairs.begin(), FreqPairs.end());
|
||||
llvm::stable_sort(FreqPairs);
|
||||
std::reverse(FreqPairs.begin(), FreqPairs.end());
|
||||
|
||||
outs() << "\tRecord Histogram:\n";
|
||||
|
@ -189,8 +189,8 @@ void SourceCoverageView::print(raw_ostream &OS, bool WholeFile,
|
||||
|
||||
// We need the expansions and instantiations sorted so we can go through them
|
||||
// while we iterate lines.
|
||||
std::stable_sort(ExpansionSubViews.begin(), ExpansionSubViews.end());
|
||||
std::stable_sort(InstantiationSubViews.begin(), InstantiationSubViews.end());
|
||||
llvm::stable_sort(ExpansionSubViews);
|
||||
llvm::stable_sort(InstantiationSubViews);
|
||||
auto NextESV = ExpansionSubViews.begin();
|
||||
auto EndESV = ExpansionSubViews.end();
|
||||
auto NextISV = InstantiationSubViews.begin();
|
||||
|
@ -1468,11 +1468,9 @@ Error Object::removeSymbols(function_ref<bool(const Symbol &)> ToRemove) {
|
||||
void Object::sortSections() {
|
||||
// Put all sections in offset order. Maintain the ordering as closely as
|
||||
// possible while meeting that demand however.
|
||||
auto CompareSections = [](const SecPtr &A, const SecPtr &B) {
|
||||
llvm::stable_sort(Sections, [](const SecPtr &A, const SecPtr &B) {
|
||||
return A->OriginalOffset < B->OriginalOffset;
|
||||
};
|
||||
std::stable_sort(std::begin(this->Sections), std::end(this->Sections),
|
||||
CompareSections);
|
||||
});
|
||||
}
|
||||
|
||||
static uint64_t alignToAddr(uint64_t Offset, uint64_t Addr, uint64_t Align) {
|
||||
@ -1490,8 +1488,7 @@ static uint64_t alignToAddr(uint64_t Offset, uint64_t Addr, uint64_t Align) {
|
||||
|
||||
// Orders segments such that if x = y->ParentSegment then y comes before x.
|
||||
static void orderSegments(std::vector<Segment *> &Segments) {
|
||||
std::stable_sort(std::begin(Segments), std::end(Segments),
|
||||
compareSegmentsByOffset);
|
||||
llvm::stable_sort(Segments, compareSegmentsByOffset);
|
||||
}
|
||||
|
||||
// This function finds a consistent layout for a list of segments starting from
|
||||
@ -1746,8 +1743,7 @@ Error BinaryWriter::finalize() {
|
||||
for (Segment *Seg : OrderedSegments)
|
||||
Seg->PAddr = Seg->VAddr;
|
||||
|
||||
std::stable_sort(std::begin(OrderedSegments), std::end(OrderedSegments),
|
||||
compareSegmentsByPAddr);
|
||||
llvm::stable_sort(OrderedSegments, compareSegmentsByPAddr);
|
||||
|
||||
// Because we add a ParentSegment for each section we might have duplicate
|
||||
// segments in OrderedSegments. If there were duplicates then LayoutSegments
|
||||
|
@ -317,10 +317,10 @@ static inline std::string formatModuleDetailKind(SymbolKind K) {
|
||||
std::vector<StatCollection::KindAndStat>
|
||||
StatCollection::getStatsSortedBySize() const {
|
||||
std::vector<KindAndStat> SortedStats(Individual.begin(), Individual.end());
|
||||
std::stable_sort(SortedStats.begin(), SortedStats.end(),
|
||||
[](const KindAndStat &LHS, const KindAndStat &RHS) {
|
||||
return LHS.second.Size > RHS.second.Size;
|
||||
});
|
||||
llvm::stable_sort(SortedStats,
|
||||
[](const KindAndStat &LHS, const KindAndStat &RHS) {
|
||||
return LHS.second.Size > RHS.second.Size;
|
||||
});
|
||||
return SortedStats;
|
||||
}
|
||||
|
||||
@ -889,10 +889,10 @@ Error DumpOutputStyle::dumpUdtStats() {
|
||||
std::vector<StrAndStat> NamespacedStatsSorted;
|
||||
for (const auto &Stat : NamespacedStats)
|
||||
NamespacedStatsSorted.push_back({Stat.getKey(), Stat.second});
|
||||
std::stable_sort(NamespacedStatsSorted.begin(), NamespacedStatsSorted.end(),
|
||||
[](const StrAndStat &L, const StrAndStat &R) {
|
||||
return L.Stat.Size > R.Stat.Size;
|
||||
});
|
||||
llvm::stable_sort(NamespacedStatsSorted,
|
||||
[](const StrAndStat &L, const StrAndStat &R) {
|
||||
return L.Stat.Size > R.Stat.Size;
|
||||
});
|
||||
for (const auto &Stat : NamespacedStatsSorted) {
|
||||
std::string Label = formatv("namespace '{0}'", Stat.Key);
|
||||
P.formatLine("{0} | {1:N} {2:N}",
|
||||
|
@ -1593,7 +1593,7 @@ void COFFDumper::printNeededLibraries() {
|
||||
Libs.push_back(Name);
|
||||
}
|
||||
|
||||
std::stable_sort(Libs.begin(), Libs.end());
|
||||
llvm::stable_sort(Libs);
|
||||
|
||||
for (const auto &L : Libs) {
|
||||
outs() << " " << L << "\n";
|
||||
|
@ -1877,7 +1877,7 @@ void ELFDumper<ELFT>::printNeededLibraries() {
|
||||
if (Entry.d_tag == ELF::DT_NEEDED)
|
||||
Libs.push_back(getDynamicString(Entry.d_un.d_val));
|
||||
|
||||
std::stable_sort(Libs.begin(), Libs.end());
|
||||
llvm::stable_sort(Libs);
|
||||
|
||||
for (const auto &L : Libs)
|
||||
W.startLine() << L << "\n";
|
||||
|
@ -694,7 +694,7 @@ void MachODumper::printNeededLibraries() {
|
||||
}
|
||||
}
|
||||
|
||||
std::stable_sort(Libs.begin(), Libs.end());
|
||||
llvm::stable_sort(Libs);
|
||||
|
||||
for (const auto &L : Libs) {
|
||||
outs() << " " << L << "\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user