[SymbolSize] Skip sorting by index, just assign by index.

No functional change intended.

llvm-svn: 240961
This commit is contained in:
Benjamin Kramer 2015-06-29 16:05:00 +00:00
parent 1669e68b57
commit 025f46f367
1 changed files with 3 additions and 7 deletions

View File

@ -31,10 +31,6 @@ static int compareAddress(const SymEntry *A, const SymEntry *B) {
return A->Address - B->Address; 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) { static unsigned getSectionID(const ObjectFile &O, SectionRef Sec) {
if (auto *M = dyn_cast<MachOObjectFile>(&O)) if (auto *M = dyn_cast<MachOObjectFile>(&O))
return M->getSectionID(Sec); return M->getSectionID(Sec);
@ -93,12 +89,12 @@ llvm::object::computeSymbolSizes(const ObjectFile &O) {
P.Address = Size; P.Address = Size;
} }
// Put back in the original order and copy the result // Assign the sorted symbols in the original order.
array_pod_sort(Addresses.begin(), Addresses.end(), compareNumber); Ret.resize(SymNum);
for (SymEntry &P : Addresses) { for (SymEntry &P : Addresses) {
if (P.I == O.symbol_end()) if (P.I == O.symbol_end())
continue; continue;
Ret.push_back({*P.I, P.Address}); Ret[P.Number] = {*P.I, P.Address};
} }
return Ret; return Ret;
} }