[lld] Use llvm::stable_sort (NFC) (#140488)
This commit is contained in:
parent
325281631a
commit
91a7085faf
@ -65,7 +65,7 @@ static SymbolMapTy getSectionSyms(ArrayRef<DefinedRegular *> syms) {
|
||||
// Sort symbols by address.
|
||||
for (auto &it : ret) {
|
||||
SmallVectorImpl<DefinedRegular *> &v = it.second;
|
||||
std::stable_sort(v.begin(), v.end(), [](DefinedRegular *a, DefinedRegular *b) {
|
||||
llvm::stable_sort(v, [](DefinedRegular *a, DefinedRegular *b) {
|
||||
return a->getRVA() < b->getRVA();
|
||||
});
|
||||
}
|
||||
|
@ -4677,10 +4677,9 @@ createMemtagGlobalDescriptors(Ctx &ctx,
|
||||
|
||||
bool MemtagGlobalDescriptors::updateAllocSize(Ctx &ctx) {
|
||||
size_t oldSize = getSize();
|
||||
std::stable_sort(symbols.begin(), symbols.end(),
|
||||
[&ctx = ctx](const Symbol *s1, const Symbol *s2) {
|
||||
return s1->getVA(ctx) < s2->getVA(ctx);
|
||||
});
|
||||
llvm::stable_sort(symbols, [&ctx = ctx](const Symbol *s1, const Symbol *s2) {
|
||||
return s1->getVA(ctx) < s2->getVA(ctx);
|
||||
});
|
||||
return oldSize != getSize();
|
||||
}
|
||||
|
||||
|
@ -1050,18 +1050,18 @@ void Writer::createOutputSegments() {
|
||||
}
|
||||
|
||||
// Sort segments by type, placing .bss last
|
||||
std::stable_sort(segments.begin(), segments.end(),
|
||||
[](const OutputSegment *a, const OutputSegment *b) {
|
||||
auto order = [](StringRef name) {
|
||||
return StringSwitch<int>(name)
|
||||
.StartsWith(".tdata", 0)
|
||||
.StartsWith(".rodata", 1)
|
||||
.StartsWith(".data", 2)
|
||||
.StartsWith(".bss", 4)
|
||||
.Default(3);
|
||||
};
|
||||
return order(a->name) < order(b->name);
|
||||
});
|
||||
llvm::stable_sort(segments,
|
||||
[](const OutputSegment *a, const OutputSegment *b) {
|
||||
auto order = [](StringRef name) {
|
||||
return StringSwitch<int>(name)
|
||||
.StartsWith(".tdata", 0)
|
||||
.StartsWith(".rodata", 1)
|
||||
.StartsWith(".data", 2)
|
||||
.StartsWith(".bss", 4)
|
||||
.Default(3);
|
||||
};
|
||||
return order(a->name) < order(b->name);
|
||||
});
|
||||
|
||||
for (size_t i = 0; i < segments.size(); ++i)
|
||||
segments[i]->index = i;
|
||||
|
Loading…
x
Reference in New Issue
Block a user