Skip to content

Commit 648f7ea

Browse files
author
Mandeep Singh Grang
committed
[MC] Change std::sort to llvm::sort in response to r327219
Summary: r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort. Refer the comments section in D44363 for a list of all the required patches. Reviewers: grosbach, void, ruiu Reviewed By: ruiu Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45138 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330058 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 74fc0f2 commit 648f7ea

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/MC/MachObjectWriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,8 @@ void MachObjectWriter::computeSymbolTable(
593593
}
594594

595595
// External and undefined symbols are required to be in lexicographic order.
596-
std::sort(ExternalSymbolData.begin(), ExternalSymbolData.end());
597-
std::sort(UndefinedSymbolData.begin(), UndefinedSymbolData.end());
596+
llvm::sort(ExternalSymbolData.begin(), ExternalSymbolData.end());
597+
llvm::sort(UndefinedSymbolData.begin(), UndefinedSymbolData.end());
598598

599599
// Set the symbol indices.
600600
Index = 0;

lib/MC/WinCOFFObjectWriter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,10 @@ void WinCOFFObjectWriter::writeSectionHeaders() {
567567
std::vector<COFFSection *> Arr;
568568
for (auto &Section : Sections)
569569
Arr.push_back(Section.get());
570-
std::sort(Arr.begin(), Arr.end(),
571-
[](const COFFSection *A, const COFFSection *B) {
572-
return A->Number < B->Number;
573-
});
570+
llvm::sort(Arr.begin(), Arr.end(),
571+
[](const COFFSection *A, const COFFSection *B) {
572+
return A->Number < B->Number;
573+
});
574574

575575
for (auto &Section : Arr) {
576576
if (Section->Number == -1)

0 commit comments

Comments
 (0)