This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcd9a5cfd2e4e: Use the range-based overload of llvm::sort
where possible (authored by gribozavr).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130403/new/
https://reviews.llvm.org/D130403
Files:
clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp
clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp
clang-tools-extra/clangd/index/StdLib.cpp
clang/include/clang/Basic/Attr.td
clang/lib/Driver/Multilib.cpp
clang/lib/Frontend/FrontendAction.cpp
clang/lib/Sema/AnalysisBasedWarnings.cpp
lldb/source/Interpreter/OptionValueArray.cpp
lldb/source/Interpreter/OptionValueFileSpecList.cpp
lldb/source/Interpreter/OptionValuePathMappings.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/source/Symbol/ArmUnwindInfo.cpp
lldb/source/Symbol/CompileUnit.cpp
lldb/source/Symbol/Symtab.cpp
lldb/source/Target/DynamicRegisterInfo.cpp
lldb/source/Target/Target.cpp
lldb/source/Utility/ReproducerProvider.cpp
lldb/source/Utility/Timer.cpp
llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
llvm/unittests/ADT/SmallPtrSetTest.cpp
llvm/unittests/TextAPI/TextStubV1Tests.cpp
llvm/unittests/TextAPI/TextStubV2Tests.cpp
llvm/unittests/TextAPI/TextStubV3Tests.cpp
llvm/unittests/TextAPI/TextStubV4Tests.cpp
Index: llvm/unittests/TextAPI/TextStubV4Tests.cpp
===================================================================
--- llvm/unittests/TextAPI/TextStubV4Tests.cpp
+++ llvm/unittests/TextAPI/TextStubV4Tests.cpp
@@ -125,9 +125,9 @@
Sym->isReexported() ? Reexports.emplace_back(std::move(temp))
: Exports.emplace_back(std::move(temp));
}
- llvm::sort(Exports.begin(), Exports.end());
- llvm::sort(Reexports.begin(), Reexports.end());
- llvm::sort(Undefineds.begin(), Undefineds.end());
+ llvm::sort(Exports);
+ llvm::sort(Reexports);
+ llvm::sort(Undefineds);
static ExportedSymbol ExpectedExportedSymbols[] = {
{SymbolKind::GlobalSymbol, "_symA", false, false},
@@ -296,9 +296,9 @@
Sym->isReexported() ? Reexports.emplace_back(std::move(Temp))
: Exports.emplace_back(std::move(Temp));
}
- llvm::sort(Exports.begin(), Exports.end());
- llvm::sort(Reexports.begin(), Reexports.end());
- llvm::sort(Undefineds.begin(), Undefineds.end());
+ llvm::sort(Exports);
+ llvm::sort(Reexports);
+ llvm::sort(Undefineds);
static ExportedSymbol ExpectedExportedSymbols[] = {
{SymbolKind::GlobalSymbol, "_symA", false, false},
Index: llvm/unittests/TextAPI/TextStubV3Tests.cpp
===================================================================
--- llvm/unittests/TextAPI/TextStubV3Tests.cpp
+++ llvm/unittests/TextAPI/TextStubV3Tests.cpp
@@ -111,7 +111,7 @@
ExportedSymbol{Sym->getKind(), std::string(Sym->getName()),
Sym->isWeakDefined(), Sym->isThreadLocalValue()});
}
- llvm::sort(Exports.begin(), Exports.end());
+ llvm::sort(Exports);
EXPECT_EQ(sizeof(TBDv3Symbols) / sizeof(ExportedSymbol), Exports.size());
EXPECT_TRUE(
@@ -203,7 +203,7 @@
Sym->isWeakDefined(),
Sym->isThreadLocalValue()});
}
- llvm::sort(Exports.begin(), Exports.end());
+ llvm::sort(Exports);
EXPECT_EQ(sizeof(TBDv3Symbols) / sizeof(ExportedSymbol), Exports.size());
EXPECT_TRUE(
@@ -228,7 +228,7 @@
Sym->isWeakDefined(),
Sym->isThreadLocalValue()});
}
- llvm::sort(Exports.begin(), Exports.end());
+ llvm::sort(Exports);
ExportedSymbolSeq DocumentSymbols{
{SymbolKind::GlobalSymbol, "_sym5", false, false},
Index: llvm/unittests/TextAPI/TextStubV2Tests.cpp
===================================================================
--- llvm/unittests/TextAPI/TextStubV2Tests.cpp
+++ llvm/unittests/TextAPI/TextStubV2Tests.cpp
@@ -103,7 +103,7 @@
ExportedSymbol{Sym->getKind(), std::string(Sym->getName()),
Sym->isWeakDefined(), Sym->isThreadLocalValue()});
}
- llvm::sort(Exports.begin(), Exports.end());
+ llvm::sort(Exports);
EXPECT_EQ(sizeof(TBDv2Symbols) / sizeof(ExportedSymbol), Exports.size());
EXPECT_TRUE(
Index: llvm/unittests/TextAPI/TextStubV1Tests.cpp
===================================================================
--- llvm/unittests/TextAPI/TextStubV1Tests.cpp
+++ llvm/unittests/TextAPI/TextStubV1Tests.cpp
@@ -102,7 +102,7 @@
ExportedSymbol{Sym->getKind(), std::string(Sym->getName()),
Sym->isWeakDefined(), Sym->isThreadLocalValue()});
}
- llvm::sort(Exports.begin(), Exports.end());
+ llvm::sort(Exports);
EXPECT_EQ(sizeof(TBDv1Symbols) / sizeof(ExportedSymbol), Exports.size());
EXPECT_TRUE(
Index: llvm/unittests/ADT/SmallPtrSetTest.cpp
===================================================================
--- llvm/unittests/ADT/SmallPtrSetTest.cpp
+++ llvm/unittests/ADT/SmallPtrSetTest.cpp
@@ -299,7 +299,7 @@
// Sort. We should hit the first element just once and the final element N
// times.
- llvm::sort(std::begin(Found), std::end(Found));
+ llvm::sort(Found);
for (auto F = std::begin(Found), E = std::end(Found); F != E; ++F)
EXPECT_EQ(F - Found + 1, *F);
}
Index: llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
===================================================================
--- llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -544,7 +544,7 @@
}
// Dedup and order the sources.
- llvm::sort(Sources.begin(), Sources.end());
+ llvm::sort(Sources);
Sources.erase(std::unique(Sources.begin(), Sources.end()), Sources.end());
for (StringRef Name : Sources)
Index: lldb/source/Utility/Timer.cpp
===================================================================
--- lldb/source/Utility/Timer.cpp
+++ lldb/source/Utility/Timer.cpp
@@ -150,7 +150,7 @@
return; // Later code will break without any elements.
// Sort by time
- llvm::sort(sorted.begin(), sorted.end(), CategoryMapIteratorSortCriterion);
+ llvm::sort(sorted, CategoryMapIteratorSortCriterion);
for (const auto &stats : sorted)
s->Printf("%.9f sec (total: %.3fs; child: %.3fs; count: %" PRIu64
Index: lldb/source/Utility/ReproducerProvider.cpp
===================================================================
--- lldb/source/Utility/ReproducerProvider.cpp
+++ lldb/source/Utility/ReproducerProvider.cpp
@@ -131,7 +131,7 @@
return;
// Remove duplicates.
- llvm::sort(m_symbol_files.begin(), m_symbol_files.end());
+ llvm::sort(m_symbol_files);
m_symbol_files.erase(
std::unique(m_symbol_files.begin(), m_symbol_files.end()),
m_symbol_files.end());
Index: lldb/source/Target/Target.cpp
===================================================================
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -776,7 +776,7 @@
for (auto bp_name : m_breakpoint_names) {
names.push_back(bp_name.first.AsCString());
}
- llvm::sort(names.begin(), names.end());
+ llvm::sort(names);
}
bool Target::ProcessIsValid() {
Index: lldb/source/Target/DynamicRegisterInfo.cpp
===================================================================
--- lldb/source/Target/DynamicRegisterInfo.cpp
+++ lldb/source/Target/DynamicRegisterInfo.cpp
@@ -483,7 +483,7 @@
end = m_invalidate_regs_map.end();
pos != end; ++pos) {
if (pos->second.size() > 1) {
- llvm::sort(pos->second.begin(), pos->second.end());
+ llvm::sort(pos->second);
reg_num_collection::iterator unique_end =
std::unique(pos->second.begin(), pos->second.end());
if (unique_end != pos->second.end())
Index: lldb/source/Symbol/Symtab.cpp
===================================================================
--- lldb/source/Symbol/Symtab.cpp
+++ lldb/source/Symbol/Symtab.cpp
@@ -1137,7 +1137,7 @@
}
if (!symbol_indexes.empty()) {
- llvm::sort(symbol_indexes.begin(), symbol_indexes.end());
+ llvm::sort(symbol_indexes);
symbol_indexes.erase(
std::unique(symbol_indexes.begin(), symbol_indexes.end()),
symbol_indexes.end());
Index: lldb/source/Symbol/CompileUnit.cpp
===================================================================
--- lldb/source/Symbol/CompileUnit.cpp
+++ lldb/source/Symbol/CompileUnit.cpp
@@ -63,7 +63,7 @@
sorted_functions.reserve(m_functions_by_uid.size());
for (auto &p : m_functions_by_uid)
sorted_functions.push_back(p.second);
- llvm::sort(sorted_functions.begin(), sorted_functions.end(),
+ llvm::sort(sorted_functions,
[](const lldb::FunctionSP &a, const lldb::FunctionSP &b) {
return a->GetID() < b->GetID();
});
Index: lldb/source/Symbol/ArmUnwindInfo.cpp
===================================================================
--- lldb/source/Symbol/ArmUnwindInfo.cpp
+++ lldb/source/Symbol/ArmUnwindInfo.cpp
@@ -65,7 +65,7 @@
// Sort the entries in the exidx section. The entries should be sorted inside
// the section but some old compiler isn't sorted them.
- llvm::sort(m_exidx_entries.begin(), m_exidx_entries.end());
+ llvm::sort(m_exidx_entries);
}
ArmUnwindInfo::~ArmUnwindInfo() = default;
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
===================================================================
--- lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -1430,10 +1430,9 @@
std::vector<PairType> sorted_items;
sorted_items.reserve(source_map.size());
sorted_items.assign(source_map.begin(), source_map.end());
- llvm::sort(sorted_items.begin(), sorted_items.end(),
- [](const PairType &lhs, const PairType &rhs) {
- return lhs.second < rhs.second;
- });
+ llvm::sort(sorted_items, [](const PairType &lhs, const PairType &rhs) {
+ return lhs.second < rhs.second;
+ });
for (const auto &item : sorted_items) {
DeclFromUser<D> user_decl(const_cast<D *>(item.first));
Index: lldb/source/Interpreter/OptionValuePathMappings.cpp
===================================================================
--- lldb/source/Interpreter/OptionValuePathMappings.cpp
+++ lldb/source/Interpreter/OptionValuePathMappings.cpp
@@ -174,7 +174,7 @@
}
// Sort and then erase in reverse so indexes are always valid
- llvm::sort(remove_indexes.begin(), remove_indexes.end());
+ llvm::sort(remove_indexes);
for (auto index : llvm::reverse(remove_indexes))
m_path_mappings.Remove(index, m_notify_changes);
NotifyValueChanged();
Index: lldb/source/Interpreter/OptionValueFileSpecList.cpp
===================================================================
--- lldb/source/Interpreter/OptionValueFileSpecList.cpp
+++ lldb/source/Interpreter/OptionValueFileSpecList.cpp
@@ -137,7 +137,7 @@
size_t num_remove_indexes = remove_indexes.size();
if (num_remove_indexes) {
// Sort and then erase in reverse so indexes are always valid
- llvm::sort(remove_indexes.begin(), remove_indexes.end());
+ llvm::sort(remove_indexes);
for (size_t j = num_remove_indexes - 1; j < num_remove_indexes; ++j) {
m_current_value.Remove(j);
}
Index: lldb/source/Interpreter/OptionValueArray.cpp
===================================================================
--- lldb/source/Interpreter/OptionValueArray.cpp
+++ lldb/source/Interpreter/OptionValueArray.cpp
@@ -218,7 +218,7 @@
if (num_remove_indexes) {
// Sort and then erase in reverse so indexes are always valid
if (num_remove_indexes > 1) {
- llvm::sort(remove_indexes.begin(), remove_indexes.end());
+ llvm::sort(remove_indexes);
for (std::vector<int>::const_reverse_iterator
pos = remove_indexes.rbegin(),
end = remove_indexes.rend();
Index: clang/lib/Sema/AnalysisBasedWarnings.cpp
===================================================================
--- clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -1575,8 +1575,7 @@
// Sort the uses by their SourceLocations. While not strictly
// guaranteed to produce them in line/column order, this will provide
// a stable ordering.
- llvm::sort(vec->begin(), vec->end(),
- [](const UninitUse &a, const UninitUse &b) {
+ llvm::sort(*vec, [](const UninitUse &a, const UninitUse &b) {
// Prefer a more confident report over a less confident one.
if (a.getKind() != b.getKind())
return a.getKind() > b.getKind();
Index: clang/lib/Frontend/FrontendAction.cpp
===================================================================
--- clang/lib/Frontend/FrontendAction.cpp
+++ clang/lib/Frontend/FrontendAction.cpp
@@ -414,7 +414,7 @@
// Sort header paths and make the header inclusion order deterministic
// across different OSs and filesystems.
- llvm::sort(Headers.begin(), Headers.end(), llvm::less_first());
+ llvm::sort(Headers, llvm::less_first());
for (auto &H : Headers) {
// Include this header as part of the umbrella directory.
Module->addTopHeader(H.second);
@@ -1205,4 +1205,3 @@
WrapperFrontendAction::WrapperFrontendAction(
std::unique_ptr<FrontendAction> WrappedAction)
: WrappedAction(std::move(WrappedAction)) {}
-
Index: clang/lib/Driver/Multilib.cpp
===================================================================
--- clang/lib/Driver/Multilib.cpp
+++ clang/lib/Driver/Multilib.cpp
@@ -267,10 +267,9 @@
}
// Sort multilibs by priority and select the one with the highest priority.
- llvm::sort(Filtered.begin(), Filtered.end(),
- [](const Multilib &a, const Multilib &b) -> bool {
- return a.priority() > b.priority();
- });
+ llvm::sort(Filtered, [](const Multilib &a, const Multilib &b) -> bool {
+ return a.priority() > b.priority();
+ });
if (Filtered[0].priority() > Filtered[1].priority()) {
M = Filtered[0];
Index: clang/include/clang/Basic/Attr.td
===================================================================
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -2703,7 +2703,7 @@
template<class Compare>
ParsedTargetAttr parse(Compare cmp) const {
ParsedTargetAttr Attrs = parse();
- llvm::sort(std::begin(Attrs.Features), std::end(Attrs.Features), cmp);
+ llvm::sort(Attrs.Features, cmp);
return Attrs;
}
Index: clang-tools-extra/clangd/index/StdLib.cpp
===================================================================
--- clang-tools-extra/clangd/index/StdLib.cpp
+++ clang-tools-extra/clangd/index/StdLib.cpp
@@ -80,7 +80,7 @@
"#endif\n",
Mandatory);
- llvm::sort(Headers.begin(), Headers.end());
+ llvm::sort(Headers);
auto Last = std::unique(Headers.begin(), Headers.end());
for (auto Header = Headers.begin(); Header != Last; ++Header) {
OS << llvm::formatv("#if __has_include({0})\n"
Index: clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp
+++ clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp
@@ -104,10 +104,8 @@
consumeError(StatusOrErr.takeError());
IgnoredDoublePointValues.push_back(DoubleValue.convertToDouble());
}
- llvm::sort(IgnoredFloatingPointValues.begin(),
- IgnoredFloatingPointValues.end());
- llvm::sort(IgnoredDoublePointValues.begin(),
- IgnoredDoublePointValues.end());
+ llvm::sort(IgnoredFloatingPointValues);
+ llvm::sort(IgnoredDoublePointValues);
}
}
Index: clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp
===================================================================
--- clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp
+++ clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp
@@ -59,7 +59,7 @@
}
// Sort by the gathered scores. Use file name as a tie breaker so we can
// deduplicate.
- llvm::sort(Symbols.begin(), Symbols.end(),
+ llvm::sort(Symbols,
[&](const SymbolAndSignals &A, const SymbolAndSignals &B) {
auto AS = Score[A.Symbol.getFilePath()];
auto BS = Score[B.Symbol.getFilePath()];
Index: clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
===================================================================
--- clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -193,8 +193,7 @@
// Sort replacements per file to keep consistent behavior when
// clang-apply-replacements run on differents machine.
for (auto &FileAndReplacements : GroupedReplacements) {
- llvm::sort(FileAndReplacements.second.begin(),
- FileAndReplacements.second.end());
+ llvm::sort(FileAndReplacements.second);
}
return GroupedReplacements;
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits