Use the range-based overload of llvm::sort where possible

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D130403

GitOrigin-RevId: cd9a5cfd2e4e4d583c9bf5ef1100acaf5e96f29e
diff --git a/source/Interpreter/OptionValueArray.cpp b/source/Interpreter/OptionValueArray.cpp
index 4468fe5..c202a18 100644
--- a/source/Interpreter/OptionValueArray.cpp
+++ b/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();
diff --git a/source/Interpreter/OptionValueFileSpecList.cpp b/source/Interpreter/OptionValueFileSpecList.cpp
index 6566eee..9b4114e 100644
--- a/source/Interpreter/OptionValueFileSpecList.cpp
+++ b/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);
           }
diff --git a/source/Interpreter/OptionValuePathMappings.cpp b/source/Interpreter/OptionValuePathMappings.cpp
index 543b0e1..6096f45 100644
--- a/source/Interpreter/OptionValuePathMappings.cpp
+++ b/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();
diff --git a/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index 1bf29ef..f8443d6 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/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));
diff --git a/source/Symbol/ArmUnwindInfo.cpp b/source/Symbol/ArmUnwindInfo.cpp
index 0785248..ae6cddf 100644
--- a/source/Symbol/ArmUnwindInfo.cpp
+++ b/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;
diff --git a/source/Symbol/CompileUnit.cpp b/source/Symbol/CompileUnit.cpp
index cacb78d..2bae08c 100644
--- a/source/Symbol/CompileUnit.cpp
+++ b/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();
              });
diff --git a/source/Symbol/Symtab.cpp b/source/Symbol/Symtab.cpp
index eb2447e..936ee04 100644
--- a/source/Symbol/Symtab.cpp
+++ b/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());
diff --git a/source/Target/DynamicRegisterInfo.cpp b/source/Target/DynamicRegisterInfo.cpp
index e2962b0..14c3faa 100644
--- a/source/Target/DynamicRegisterInfo.cpp
+++ b/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())
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index 292ace6..6ffe6d3 100644
--- a/source/Target/Target.cpp
+++ b/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() {
diff --git a/source/Utility/ReproducerProvider.cpp b/source/Utility/ReproducerProvider.cpp
index 0d1581a..44f24e4 100644
--- a/source/Utility/ReproducerProvider.cpp
+++ b/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());
diff --git a/source/Utility/Timer.cpp b/source/Utility/Timer.cpp
index b190f35..477541d 100644
--- a/source/Utility/Timer.cpp
+++ b/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