[llvm] 4065e92 - Upgrade some instances of std::sort to llvm::sort. NFC.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 28 11:25:25 PDT 2020
Author: Benjamin Kramer
Date: 2020-03-28T19:23:29+01:00
New Revision: 4065e92195b1815367d619292080a9a1d3032015
URL: https://github.com/llvm/llvm-project/commit/4065e92195b1815367d619292080a9a1d3032015
DIFF: https://github.com/llvm/llvm-project/commit/4065e92195b1815367d619292080a9a1d3032015.diff
LOG: Upgrade some instances of std::sort to llvm::sort. NFC.
Added:
Modified:
clang-tools-extra/clang-doc/Representation.cpp
clang-tools-extra/clang-tidy/ClangTidy.cpp
clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
clang-tools-extra/clangd/index/Relation.cpp
clang-tools-extra/modularize/CoverageChecker.cpp
clang-tools-extra/modularize/Modularize.cpp
clang/tools/clang-scan-deps/ClangScanDeps.cpp
clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
clang/utils/TableGen/SveEmitter.cpp
llvm/lib/Target/AMDGPU/GCNRegBankReassign.cpp
llvm/lib/Target/AMDGPU/GCNRegPressure.h
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-doc/Representation.cpp b/clang-tools-extra/clang-doc/Representation.cpp
index 34d83b438125..8c619d2a0963 100644
--- a/clang-tools-extra/clang-doc/Representation.cpp
+++ b/clang-tools-extra/clang-doc/Representation.cpp
@@ -187,7 +187,7 @@ void Info::mergeBase(Info &&Other) {
// Unconditionally extend the description, since each decl may have a comment.
std::move(Other.Description.begin(), Other.Description.end(),
std::back_inserter(Description));
- std::sort(Description.begin(), Description.end());
+ llvm::sort(Description);
auto Last = std::unique(Description.begin(), Description.end());
Description.erase(Last, Description.end());
}
@@ -202,7 +202,7 @@ void SymbolInfo::merge(SymbolInfo &&Other) {
DefLoc = std::move(Other.DefLoc);
// Unconditionally extend the list of locations, since we want all of them.
std::move(Other.Loc.begin(), Other.Loc.end(), std::back_inserter(Loc));
- std::sort(Loc.begin(), Loc.end());
+ llvm::sort(Loc);
auto Last = std::unique(Loc.begin(), Loc.end());
Loc.erase(Last, Loc.end());
mergeBase(std::move(Other));
@@ -314,7 +314,7 @@ bool Index::operator<(const Index &Other) const {
}
void Index::sort() {
- std::sort(Children.begin(), Children.end());
+ llvm::sort(Children);
for (auto &C : Children)
C.sort();
}
diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp
index 52c217b649f5..05594f191a5f 100644
--- a/clang-tools-extra/clang-tidy/ClangTidy.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp
@@ -454,7 +454,7 @@ std::vector<std::string> ClangTidyASTConsumerFactory::getCheckNames() {
CheckNames.push_back(AnalyzerCheckNamePrefix + AnalyzerCheck.first);
#endif // CLANG_ENABLE_STATIC_ANALYZER
- std::sort(CheckNames.begin(), CheckNames.end());
+ llvm::sort(CheckNames);
return CheckNames;
}
diff --git a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
index 068d56c1a8a8..414da2857cff 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -680,7 +680,7 @@ void ClangTidyDiagnosticConsumer::removeIncompatibleErrors() {
for (auto &FileAndEvents : FileEvents) {
std::vector<Event> &Events = FileAndEvents.second;
// Sweep.
- std::sort(Events.begin(), Events.end());
+ llvm::sort(Events);
int OpenIntervals = 0;
for (const auto &Event : Events) {
if (Event.Type == Event::ET_End)
@@ -726,7 +726,7 @@ struct EqualClangTidyError {
std::vector<ClangTidyError> ClangTidyDiagnosticConsumer::take() {
finalizeLastError();
- std::sort(Errors.begin(), Errors.end(), LessClangTidyError());
+ llvm::sort(Errors, LessClangTidyError());
Errors.erase(std::unique(Errors.begin(), Errors.end(), EqualClangTidyError()),
Errors.end());
if (RemoveIncompatibleErrors)
diff --git a/clang-tools-extra/clangd/index/Relation.cpp b/clang-tools-extra/clangd/index/Relation.cpp
index e28591bb64b0..6daa10a6f95e 100644
--- a/clang-tools-extra/clangd/index/Relation.cpp
+++ b/clang-tools-extra/clangd/index/Relation.cpp
@@ -26,7 +26,7 @@ RelationSlab::lookup(const SymbolID &Subject, RelationKind Predicate) const {
RelationSlab RelationSlab::Builder::build() && {
// Sort in SPO order.
- std::sort(Relations.begin(), Relations.end());
+ llvm::sort(Relations);
// Remove duplicates.
Relations.erase(std::unique(Relations.begin(), Relations.end()),
diff --git a/clang-tools-extra/modularize/CoverageChecker.cpp b/clang-tools-extra/modularize/CoverageChecker.cpp
index 9df53d26c2e9..4246df9483d0 100644
--- a/clang-tools-extra/modularize/CoverageChecker.cpp
+++ b/clang-tools-extra/modularize/CoverageChecker.cpp
@@ -338,7 +338,7 @@ bool CoverageChecker::collectFileSystemHeaders() {
}
// Sort it, because
diff erent file systems might order the file
diff erently.
- std::sort(FileSystemHeaders.begin(), FileSystemHeaders.end());
+ llvm::sort(FileSystemHeaders);
return true;
}
diff --git a/clang-tools-extra/modularize/Modularize.cpp b/clang-tools-extra/modularize/Modularize.cpp
index 5076bd9ee601..b1efb0e7996a 100644
--- a/clang-tools-extra/modularize/Modularize.cpp
+++ b/clang-tools-extra/modularize/Modularize.cpp
@@ -509,7 +509,7 @@ class EntityMap : public StringMap<SmallVector<Entry, 2> > {
HEnd = CurHeaderContents.end();
H != HEnd; ++H) {
// Sort contents.
- std::sort(H->second.begin(), H->second.end());
+ llvm::sort(H->second);
// Check whether we've seen this header before.
DenseMap<const FileEntry *, HeaderContents>::iterator KnownH =
diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
index 9105c616786f..91659e76219a 100644
--- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -218,16 +218,15 @@ static llvm::json::Array toJSONSorted(const llvm::StringSet<> &Set) {
std::vector<llvm::StringRef> Strings;
for (auto &&I : Set)
Strings.push_back(I.getKey());
- std::sort(Strings.begin(), Strings.end());
+ llvm::sort(Strings);
return llvm::json::Array(Strings);
}
static llvm::json::Array toJSONSorted(std::vector<ClangModuleDep> V) {
- std::sort(V.begin(), V.end(),
- [](const ClangModuleDep &A, const ClangModuleDep &B) {
- return std::tie(A.ModuleName, A.ContextHash) <
- std::tie(B.ModuleName, B.ContextHash);
- });
+ llvm::sort(V, [](const ClangModuleDep &A, const ClangModuleDep &B) {
+ return std::tie(A.ModuleName, A.ContextHash) <
+ std::tie(B.ModuleName, B.ContextHash);
+ });
llvm::json::Array Ret;
for (const ClangModuleDep &CMD : V)
@@ -275,16 +274,15 @@ class FullDeps {
std::vector<ContextModulePair> ModuleNames;
for (auto &&M : Modules)
ModuleNames.push_back(M.first);
- std::sort(ModuleNames.begin(), ModuleNames.end(),
- [](const ContextModulePair &A, const ContextModulePair &B) {
- return std::tie(A.ModuleName, A.InputIndex) <
- std::tie(B.ModuleName, B.InputIndex);
- });
-
- std::sort(Inputs.begin(), Inputs.end(),
- [](const InputDeps &A, const InputDeps &B) {
- return A.FileName < B.FileName;
- });
+ llvm::sort(ModuleNames,
+ [](const ContextModulePair &A, const ContextModulePair &B) {
+ return std::tie(A.ModuleName, A.InputIndex) <
+ std::tie(B.ModuleName, B.InputIndex);
+ });
+
+ llvm::sort(Inputs, [](const InputDeps &A, const InputDeps &B) {
+ return A.FileName < B.FileName;
+ });
using namespace llvm::json;
diff --git a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
index b930f2daed42..7c63cf51ecfa 100644
--- a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
+++ b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
@@ -560,7 +560,7 @@ void BuiltinNameEmitter::GroupBySignature() {
CurSignatureList->push_back(Signature.second);
}
// Sort the list to facilitate future comparisons.
- std::sort(CurSignatureList->begin(), CurSignatureList->end());
+ llvm::sort(*CurSignatureList);
// Check if we have already seen another function with the same list of
// signatures. If so, just add the name of the function.
diff --git a/clang/utils/TableGen/SveEmitter.cpp b/clang/utils/TableGen/SveEmitter.cpp
index e02e94dd98ae..a792530a03af 100644
--- a/clang/utils/TableGen/SveEmitter.cpp
+++ b/clang/utils/TableGen/SveEmitter.cpp
@@ -604,7 +604,7 @@ void SVEEmitter::createIntrinsic(
}
// Remove duplicate type specs.
- std::sort(TypeSpecs.begin(), TypeSpecs.end());
+ llvm::sort(TypeSpecs);
TypeSpecs.erase(std::unique(TypeSpecs.begin(), TypeSpecs.end()),
TypeSpecs.end());
diff --git a/llvm/lib/Target/AMDGPU/GCNRegBankReassign.cpp b/llvm/lib/Target/AMDGPU/GCNRegBankReassign.cpp
index d1b9e9b648ee..547fb9f3b38a 100644
--- a/llvm/lib/Target/AMDGPU/GCNRegBankReassign.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNRegBankReassign.cpp
@@ -653,7 +653,7 @@ unsigned GCNRegBankReassign::tryReassign(Candidate &C) {
}
}
}
- std::sort(BankStalls.begin(), BankStalls.end());
+ llvm::sort(BankStalls);
Register OrigReg = VRM->getPhys(C.Reg);
LRM->unassign(LI);
diff --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.h b/llvm/lib/Target/AMDGPU/GCNRegPressure.h
index 909266e6e026..2ef79410719f 100644
--- a/llvm/lib/Target/AMDGPU/GCNRegPressure.h
+++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.h
@@ -216,7 +216,7 @@ getLiveRegMap(Range &&R, bool After, LiveIntervals &LIS) {
auto SI = SII.getInstructionIndex(*I);
Indexes.push_back(After ? SI.getDeadSlot() : SI.getBaseIndex());
}
- std::sort(Indexes.begin(), Indexes.end());
+ llvm::sort(Indexes);
auto &MRI = (*R.begin())->getParent()->getParent()->getRegInfo();
DenseMap<MachineInstr *, GCNRPTracker::LiveRegSet> LiveRegMap;
More information about the llvm-commits
mailing list