Skip to content

Commit 4065e92

Browse files
committed
Upgrade some instances of std::sort to llvm::sort. NFC.
1 parent 347e31c commit 4065e92

File tree

11 files changed

+27
-29
lines changed

11 files changed

+27
-29
lines changed

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ void Info::mergeBase(Info &&Other) {
187187
// Unconditionally extend the description, since each decl may have a comment.
188188
std::move(Other.Description.begin(), Other.Description.end(),
189189
std::back_inserter(Description));
190-
std::sort(Description.begin(), Description.end());
190+
llvm::sort(Description);
191191
auto Last = std::unique(Description.begin(), Description.end());
192192
Description.erase(Last, Description.end());
193193
}
@@ -202,7 +202,7 @@ void SymbolInfo::merge(SymbolInfo &&Other) {
202202
DefLoc = std::move(Other.DefLoc);
203203
// Unconditionally extend the list of locations, since we want all of them.
204204
std::move(Other.Loc.begin(), Other.Loc.end(), std::back_inserter(Loc));
205-
std::sort(Loc.begin(), Loc.end());
205+
llvm::sort(Loc);
206206
auto Last = std::unique(Loc.begin(), Loc.end());
207207
Loc.erase(Last, Loc.end());
208208
mergeBase(std::move(Other));
@@ -314,7 +314,7 @@ bool Index::operator<(const Index &Other) const {
314314
}
315315

316316
void Index::sort() {
317-
std::sort(Children.begin(), Children.end());
317+
llvm::sort(Children);
318318
for (auto &C : Children)
319319
C.sort();
320320
}

clang-tools-extra/clang-tidy/ClangTidy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ std::vector<std::string> ClangTidyASTConsumerFactory::getCheckNames() {
454454
CheckNames.push_back(AnalyzerCheckNamePrefix + AnalyzerCheck.first);
455455
#endif // CLANG_ENABLE_STATIC_ANALYZER
456456

457-
std::sort(CheckNames.begin(), CheckNames.end());
457+
llvm::sort(CheckNames);
458458
return CheckNames;
459459
}
460460

clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ void ClangTidyDiagnosticConsumer::removeIncompatibleErrors() {
680680
for (auto &FileAndEvents : FileEvents) {
681681
std::vector<Event> &Events = FileAndEvents.second;
682682
// Sweep.
683-
std::sort(Events.begin(), Events.end());
683+
llvm::sort(Events);
684684
int OpenIntervals = 0;
685685
for (const auto &Event : Events) {
686686
if (Event.Type == Event::ET_End)
@@ -726,7 +726,7 @@ struct EqualClangTidyError {
726726
std::vector<ClangTidyError> ClangTidyDiagnosticConsumer::take() {
727727
finalizeLastError();
728728

729-
std::sort(Errors.begin(), Errors.end(), LessClangTidyError());
729+
llvm::sort(Errors, LessClangTidyError());
730730
Errors.erase(std::unique(Errors.begin(), Errors.end(), EqualClangTidyError()),
731731
Errors.end());
732732
if (RemoveIncompatibleErrors)

clang-tools-extra/clangd/index/Relation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ RelationSlab::lookup(const SymbolID &Subject, RelationKind Predicate) const {
2626

2727
RelationSlab RelationSlab::Builder::build() && {
2828
// Sort in SPO order.
29-
std::sort(Relations.begin(), Relations.end());
29+
llvm::sort(Relations);
3030

3131
// Remove duplicates.
3232
Relations.erase(std::unique(Relations.begin(), Relations.end()),

clang-tools-extra/modularize/CoverageChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ bool CoverageChecker::collectFileSystemHeaders() {
338338
}
339339

340340
// Sort it, because different file systems might order the file differently.
341-
std::sort(FileSystemHeaders.begin(), FileSystemHeaders.end());
341+
llvm::sort(FileSystemHeaders);
342342

343343
return true;
344344
}

clang-tools-extra/modularize/Modularize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ class EntityMap : public StringMap<SmallVector<Entry, 2> > {
509509
HEnd = CurHeaderContents.end();
510510
H != HEnd; ++H) {
511511
// Sort contents.
512-
std::sort(H->second.begin(), H->second.end());
512+
llvm::sort(H->second);
513513

514514
// Check whether we've seen this header before.
515515
DenseMap<const FileEntry *, HeaderContents>::iterator KnownH =

clang/tools/clang-scan-deps/ClangScanDeps.cpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -218,16 +218,15 @@ static llvm::json::Array toJSONSorted(const llvm::StringSet<> &Set) {
218218
std::vector<llvm::StringRef> Strings;
219219
for (auto &&I : Set)
220220
Strings.push_back(I.getKey());
221-
std::sort(Strings.begin(), Strings.end());
221+
llvm::sort(Strings);
222222
return llvm::json::Array(Strings);
223223
}
224224

225225
static llvm::json::Array toJSONSorted(std::vector<ClangModuleDep> V) {
226-
std::sort(V.begin(), V.end(),
227-
[](const ClangModuleDep &A, const ClangModuleDep &B) {
228-
return std::tie(A.ModuleName, A.ContextHash) <
229-
std::tie(B.ModuleName, B.ContextHash);
230-
});
226+
llvm::sort(V, [](const ClangModuleDep &A, const ClangModuleDep &B) {
227+
return std::tie(A.ModuleName, A.ContextHash) <
228+
std::tie(B.ModuleName, B.ContextHash);
229+
});
231230

232231
llvm::json::Array Ret;
233232
for (const ClangModuleDep &CMD : V)
@@ -275,16 +274,15 @@ class FullDeps {
275274
std::vector<ContextModulePair> ModuleNames;
276275
for (auto &&M : Modules)
277276
ModuleNames.push_back(M.first);
278-
std::sort(ModuleNames.begin(), ModuleNames.end(),
279-
[](const ContextModulePair &A, const ContextModulePair &B) {
280-
return std::tie(A.ModuleName, A.InputIndex) <
281-
std::tie(B.ModuleName, B.InputIndex);
282-
});
283-
284-
std::sort(Inputs.begin(), Inputs.end(),
285-
[](const InputDeps &A, const InputDeps &B) {
286-
return A.FileName < B.FileName;
287-
});
277+
llvm::sort(ModuleNames,
278+
[](const ContextModulePair &A, const ContextModulePair &B) {
279+
return std::tie(A.ModuleName, A.InputIndex) <
280+
std::tie(B.ModuleName, B.InputIndex);
281+
});
282+
283+
llvm::sort(Inputs, [](const InputDeps &A, const InputDeps &B) {
284+
return A.FileName < B.FileName;
285+
});
288286

289287
using namespace llvm::json;
290288

clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ void BuiltinNameEmitter::GroupBySignature() {
560560
CurSignatureList->push_back(Signature.second);
561561
}
562562
// Sort the list to facilitate future comparisons.
563-
std::sort(CurSignatureList->begin(), CurSignatureList->end());
563+
llvm::sort(*CurSignatureList);
564564

565565
// Check if we have already seen another function with the same list of
566566
// signatures. If so, just add the name of the function.

clang/utils/TableGen/SveEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ void SVEEmitter::createIntrinsic(
604604
}
605605

606606
// Remove duplicate type specs.
607-
std::sort(TypeSpecs.begin(), TypeSpecs.end());
607+
llvm::sort(TypeSpecs);
608608
TypeSpecs.erase(std::unique(TypeSpecs.begin(), TypeSpecs.end()),
609609
TypeSpecs.end());
610610

llvm/lib/Target/AMDGPU/GCNRegBankReassign.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ unsigned GCNRegBankReassign::tryReassign(Candidate &C) {
653653
}
654654
}
655655
}
656-
std::sort(BankStalls.begin(), BankStalls.end());
656+
llvm::sort(BankStalls);
657657

658658
Register OrigReg = VRM->getPhys(C.Reg);
659659
LRM->unassign(LI);

0 commit comments

Comments
 (0)