[SymbolSize] Skip sorting by index, just assign by index.
No functional change intended.
llvm-svn: 240961
diff --git a/llvm/lib/Object/SymbolSize.cpp b/llvm/lib/Object/SymbolSize.cpp
index 730e54c..1d5cd78 100644
--- a/llvm/lib/Object/SymbolSize.cpp
+++ b/llvm/lib/Object/SymbolSize.cpp
@@ -31,10 +31,6 @@
return A->Address - B->Address;
}
-static int compareNumber(const SymEntry *A, const SymEntry *B) {
- return A->Number - B->Number;
-}
-
static unsigned getSectionID(const ObjectFile &O, SectionRef Sec) {
if (auto *M = dyn_cast<MachOObjectFile>(&O))
return M->getSectionID(Sec);
@@ -93,12 +89,12 @@
P.Address = Size;
}
- // Put back in the original order and copy the result
- array_pod_sort(Addresses.begin(), Addresses.end(), compareNumber);
+ // Assign the sorted symbols in the original order.
+ Ret.resize(SymNum);
for (SymEntry &P : Addresses) {
if (P.I == O.symbol_end())
continue;
- Ret.push_back({*P.I, P.Address});
+ Ret[P.Number] = {*P.I, P.Address};
}
return Ret;
}