MaskRay created this revision.
MaskRay added a reviewer: rsmith.
Herald added subscribers: cfe-commits, kadircet, arphaman, mgrang.

The convenience wrapper in STLExtras is available since 
https://reviews.llvm.org/rL342102.


Repository:
  rC Clang

https://reviews.llvm.org/D52576

Files:
  lib/AST/ItaniumMangle.cpp
  lib/AST/VTableBuilder.cpp
  lib/Analysis/LiveVariables.cpp
  lib/Basic/VirtualFileSystem.cpp
  lib/CodeGen/CGBlocks.cpp
  lib/CodeGen/CGObjCGNU.cpp
  lib/CodeGen/CGVTables.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/TargetInfo.cpp
  lib/Driver/Driver.cpp
  lib/Driver/XRayArgs.cpp
  lib/Format/FormatTokenLexer.cpp
  lib/Format/WhitespaceManager.cpp
  lib/Frontend/DiagnosticRenderer.cpp
  lib/Sema/AnalysisBasedWarnings.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaOverload.cpp
  lib/Sema/SemaType.cpp
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriter.cpp
  lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
  lib/StaticAnalyzer/Core/BugReporter.cpp
  lib/StaticAnalyzer/Core/CheckerRegistry.cpp
  lib/Tooling/ASTDiff/ASTDiff.cpp
  lib/Tooling/Core/Replacement.cpp
  lib/Tooling/InterpolatingCompilationDatabase.cpp
  tools/diagtool/DiagTool.cpp
  tools/libclang/CIndex.cpp
  unittests/Basic/VirtualFileSystemTest.cpp
  utils/TableGen/ClangDiagnosticsEmitter.cpp
  utils/TableGen/ClangOptionDocEmitter.cpp
  utils/TableGen/NeonEmitter.cpp

Index: utils/TableGen/NeonEmitter.cpp
===================================================================
--- utils/TableGen/NeonEmitter.cpp
+++ utils/TableGen/NeonEmitter.cpp
@@ -2020,7 +2020,7 @@
     }
   }
 
-  llvm::sort(NewTypeSpecs.begin(), NewTypeSpecs.end());
+  llvm::sort(NewTypeSpecs);
   NewTypeSpecs.erase(std::unique(NewTypeSpecs.begin(), NewTypeSpecs.end()),
 		     NewTypeSpecs.end());
   auto &Entry = IntrinsicMap[Name];
Index: utils/TableGen/ClangOptionDocEmitter.cpp
===================================================================
--- utils/TableGen/ClangOptionDocEmitter.cpp
+++ utils/TableGen/ClangOptionDocEmitter.cpp
@@ -111,25 +111,25 @@
 
   auto DocumentationForOption = [&](Record *R) -> DocumentedOption {
     auto &A = Aliases[R];
-    llvm::sort(A.begin(), A.end(), CompareByName);
+    llvm::sort(A, CompareByName);
     return {R, std::move(A)};
   };
 
   std::function<Documentation(Record *)> DocumentationForGroup =
       [&](Record *R) -> Documentation {
     Documentation D;
 
     auto &Groups = GroupsInGroup[R];
-    llvm::sort(Groups.begin(), Groups.end(), CompareByLocation);
+    llvm::sort(Groups, CompareByLocation);
     for (Record *G : Groups) {
       D.Groups.emplace_back();
       D.Groups.back().Group = G;
       Documentation &Base = D.Groups.back();
       Base = DocumentationForGroup(G);
     }
 
     auto &Options = OptionsInGroup[R];
-    llvm::sort(Options.begin(), Options.end(), CompareByName);
+    llvm::sort(Options, CompareByName);
     for (Record *O : Options)
       D.Options.push_back(DocumentationForOption(O));
 
Index: utils/TableGen/ClangDiagnosticsEmitter.cpp
===================================================================
--- utils/TableGen/ClangDiagnosticsEmitter.cpp
+++ utils/TableGen/ClangDiagnosticsEmitter.cpp
@@ -208,9 +208,9 @@
                                               E = SortedGroups.end();
        I != E; ++I) {
     MutableArrayRef<const Record *> GroupDiags = (*I)->DiagsInGroup;
-    llvm::sort(GroupDiags.begin(), GroupDiags.end(), beforeThanCompare);
+    llvm::sort(GroupDiags, beforeThanCompare);
   }
-  llvm::sort(SortedGroups.begin(), SortedGroups.end(), beforeThanCompareGroups);
+  llvm::sort(SortedGroups, beforeThanCompareGroups);
 
   // Warn about the same group being used anonymously in multiple places.
   for (SmallVectorImpl<GroupInfo *>::const_iterator I = SortedGroups.begin(),
@@ -1595,7 +1595,7 @@
     Index.push_back(RecordIndexElement(R));
   }
 
-  llvm::sort(Index.begin(), Index.end(),
+  llvm::sort(Index,
              [](const RecordIndexElement &Lhs, const RecordIndexElement &Rhs) {
                return Lhs.Name < Rhs.Name;
             });
@@ -1694,7 +1694,7 @@
 
   std::vector<Record*> DiagGroups =
       Records.getAllDerivedDefinitions("DiagGroup");
-  llvm::sort(DiagGroups.begin(), DiagGroups.end(), diagGroupBeforeByName);
+  llvm::sort(DiagGroups, diagGroupBeforeByName);
 
   DiagGroupParentMap DGParentMap(Records);
 
@@ -1713,9 +1713,9 @@
                               DiagsInPedanticSet.end());
     RecordVec GroupsInPedantic(GroupsInPedanticSet.begin(),
                                GroupsInPedanticSet.end());
-    llvm::sort(DiagsInPedantic.begin(), DiagsInPedantic.end(),
+    llvm::sort(DiagsInPedantic,
                beforeThanCompare);
-    llvm::sort(GroupsInPedantic.begin(), GroupsInPedantic.end(),
+    llvm::sort(GroupsInPedantic,
                beforeThanCompare);
     PedDiags.DiagsInGroup.insert(PedDiags.DiagsInGroup.end(),
                                  DiagsInPedantic.begin(),
Index: unittests/Basic/VirtualFileSystemTest.cpp
===================================================================
--- unittests/Basic/VirtualFileSystemTest.cpp
+++ unittests/Basic/VirtualFileSystemTest.cpp
@@ -553,8 +553,8 @@
   for (DirIter E; !EC && I != E; I.increment(EC))
     InputToCheck.push_back(I->path());
 
-  llvm::sort(InputToCheck.begin(), InputToCheck.end());
-  llvm::sort(Expected.begin(), Expected.end());
+  llvm::sort(InputToCheck);
+  llvm::sort(Expected);
   EXPECT_EQ(InputToCheck.size(), Expected.size());
 
   unsigned LastElt = std::min(InputToCheck.size(), Expected.size());
Index: tools/libclang/CIndex.cpp
===================================================================
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -1044,7 +1044,7 @@
   }
 
   // Now sort the Decls so that they appear in lexical order.
-  llvm::sort(DeclsInContainer.begin(), DeclsInContainer.end(),
+  llvm::sort(DeclsInContainer,
              [&SM](Decl *A, Decl *B) {
                SourceLocation L_A = A->getBeginLoc();
                SourceLocation L_B = B->getBeginLoc();
@@ -7803,7 +7803,7 @@
   if (AvailabilityAttrs.empty())
     return;
 
-  llvm::sort(AvailabilityAttrs.begin(), AvailabilityAttrs.end(),
+  llvm::sort(AvailabilityAttrs,
              [](AvailabilityAttr *LHS, AvailabilityAttr *RHS) {
                return LHS->getPlatform()->getName() <
                       RHS->getPlatform()->getName();
Index: tools/diagtool/DiagTool.cpp
===================================================================
--- tools/diagtool/DiagTool.cpp
+++ tools/diagtool/DiagTool.cpp
@@ -48,7 +48,7 @@
     if (len > maxName)
       maxName = len;    
   }
-  llvm::sort(toolNames.begin(), toolNames.end());
+  llvm::sort(toolNames);
 
   for (std::vector<llvm::StringRef>::iterator it = toolNames.begin(),
        ei = toolNames.end(); it != ei; ++it) {
Index: lib/Tooling/InterpolatingCompilationDatabase.cpp
===================================================================
--- lib/Tooling/InterpolatingCompilationDatabase.cpp
+++ lib/Tooling/InterpolatingCompilationDatabase.cpp
@@ -321,7 +321,7 @@
   FileIndex(std::vector<std::string> Files)
       : OriginalPaths(std::move(Files)), Strings(Arena) {
     // Sort commands by filename for determinism (index is a tiebreaker later).
-    llvm::sort(OriginalPaths.begin(), OriginalPaths.end());
+    llvm::sort(OriginalPaths);
     Paths.reserve(OriginalPaths.size());
     Types.reserve(OriginalPaths.size());
     Stems.reserve(OriginalPaths.size());
@@ -336,9 +336,9 @@
         if (Dir->size() > ShortDirectorySegment) // not trivial ones
           Components.emplace_back(*Dir, I);
     }
-    llvm::sort(Paths.begin(), Paths.end());
-    llvm::sort(Stems.begin(), Stems.end());
-    llvm::sort(Components.begin(), Components.end());
+    llvm::sort(Paths);
+    llvm::sort(Stems);
+    llvm::sort(Components);
   }
 
   bool empty() const { return Paths.empty(); }
Index: lib/Tooling/Core/Replacement.cpp
===================================================================
--- lib/Tooling/Core/Replacement.cpp
+++ lib/Tooling/Core/Replacement.cpp
@@ -483,7 +483,7 @@
 // Returns a set of non-overlapping and sorted ranges that is equivalent to
 // \p Ranges.
 static std::vector<Range> combineAndSortRanges(std::vector<Range> Ranges) {
-  llvm::sort(Ranges.begin(), Ranges.end(),
+  llvm::sort(Ranges,
              [](const Range &LHS, const Range &RHS) {
                if (LHS.getOffset() != RHS.getOffset())
                  return LHS.getOffset() < RHS.getOffset();
Index: lib/Tooling/ASTDiff/ASTDiff.cpp
===================================================================
--- lib/Tooling/ASTDiff/ASTDiff.cpp
+++ lib/Tooling/ASTDiff/ASTDiff.cpp
@@ -741,7 +741,7 @@
       List.pop();
     }
     // TODO this is here to get a stable output, not a good heuristic
-    llvm::sort(Result.begin(), Result.end());
+    llvm::sort(Result);
     return Result;
   }
   int peekMax() const {
Index: lib/StaticAnalyzer/Core/CheckerRegistry.cpp
===================================================================
--- lib/StaticAnalyzer/Core/CheckerRegistry.cpp
+++ lib/StaticAnalyzer/Core/CheckerRegistry.cpp
@@ -103,7 +103,7 @@
 void CheckerRegistry::initializeManager(CheckerManager &checkerMgr,
                                   SmallVectorImpl<CheckerOptInfo> &opts) const {
   // Sort checkers for efficient collection.
-  llvm::sort(Checkers.begin(), Checkers.end(), checkerNameLT);
+  llvm::sort(Checkers, checkerNameLT);
 
   // Collect checkers enabled by the options.
   CheckerInfoSet enabledCheckers;
@@ -143,7 +143,7 @@
   // FIXME: Alphabetical sort puts 'experimental' in the middle.
   // Would it be better to name it '~experimental' or something else
   // that's ASCIIbetically last?
-  llvm::sort(Checkers.begin(), Checkers.end(), checkerNameLT);
+  llvm::sort(Checkers, checkerNameLT);
 
   // FIXME: Print available packages.
 
@@ -178,7 +178,7 @@
 
 void CheckerRegistry::printList(
     raw_ostream &out, SmallVectorImpl<CheckerOptInfo> &opts) const {
-  llvm::sort(Checkers.begin(), Checkers.end(), checkerNameLT);
+  llvm::sort(Checkers, checkerNameLT);
 
   // Collect checkers enabled by the options.
   CheckerInfoSet enabledCheckers;
Index: lib/StaticAnalyzer/Core/BugReporter.cpp
===================================================================
--- lib/StaticAnalyzer/Core/BugReporter.cpp
+++ lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -2386,7 +2386,7 @@
   }
 
   // Sort the error paths from longest to shortest.
-  llvm::sort(ReportNodes.begin(), ReportNodes.end(),
+  llvm::sort(ReportNodes,
              PriorityCompare<true>(PriorityMap));
 }
 
Index: lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
+++ lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
@@ -237,7 +237,7 @@
     };
     std::transform(RD->field_begin(), RD->field_end(),
                    std::back_inserter(Fields), GatherSizesAndAlignments);
-    llvm::sort(Fields.begin(), Fields.end());
+    llvm::sort(Fields);
     // This lets us skip over vptrs and non-virtual bases,
     // so that we can just worry about the fields in our object.
     // Note that this does cause us to miss some cases where we
Index: lib/Serialization/ASTWriter.cpp
===================================================================
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -2495,7 +2495,7 @@
       MacroIdentifiers.push_back(Id.second);
   // Sort the set of macro definitions that need to be serialized by the
   // name of the macro, to provide a stable ordering.
-  llvm::sort(MacroIdentifiers.begin(), MacroIdentifiers.end(),
+  llvm::sort(MacroIdentifiers,
              llvm::less_ptr<IdentifierInfo>());
 
   // Emit the macro directives as a list and associate the offset with the
@@ -3230,7 +3230,7 @@
 
   SmallVector<std::pair<FileID, DeclIDInFileInfo *>, 64> SortedFileDeclIDs(
       FileDeclIDs.begin(), FileDeclIDs.end());
-  llvm::sort(SortedFileDeclIDs.begin(), SortedFileDeclIDs.end(),
+  llvm::sort(SortedFileDeclIDs,
              llvm::less_first());
 
   // Join the vectors of DeclIDs from all files.
@@ -3737,7 +3737,7 @@
       IIs.push_back(ID.second);
     // Sort the identifiers lexicographically before getting them references so
     // that their order is stable.
-    llvm::sort(IIs.begin(), IIs.end(), llvm::less_ptr<IdentifierInfo>());
+    llvm::sort(IIs, llvm::less_ptr<IdentifierInfo>());
     for (const IdentifierInfo *II : IIs)
       if (Trait.isInterestingNonMacroIdentifier(II))
         getIdentifierRef(II);
@@ -4035,7 +4035,7 @@
   }
 
   // Sort the names into a stable order.
-  llvm::sort(Names.begin(), Names.end());
+  llvm::sort(Names);
 
   if (auto *D = dyn_cast<CXXRecordDecl>(DC)) {
     // We need to establish an ordering of constructor and conversion function
@@ -4172,7 +4172,7 @@
             std::make_pair(Entry.first, Entry.second.getLookupResult()));
     }
 
-    llvm::sort(LookupResults.begin(), LookupResults.end(), llvm::less_first());
+    llvm::sort(LookupResults, llvm::less_first());
     for (auto &NameAndResult : LookupResults) {
       DeclarationName Name = NameAndResult.first;
       DeclContext::lookup_result Result = NameAndResult.second;
@@ -4875,7 +4875,7 @@
         IIs.push_back(II);
     }
     // Sort the identifiers to visit based on their name.
-    llvm::sort(IIs.begin(), IIs.end(), llvm::less_ptr<IdentifierInfo>());
+    llvm::sort(IIs, llvm::less_ptr<IdentifierInfo>());
     for (const IdentifierInfo *II : IIs) {
       for (IdentifierResolver::iterator D = SemaRef.IdResolver.begin(II),
                                      DEnd = SemaRef.IdResolver.end();
@@ -5112,7 +5112,7 @@
       };
 
       // Sort and deduplicate module IDs.
-      llvm::sort(Imports.begin(), Imports.end(), Cmp);
+      llvm::sort(Imports, Cmp);
       Imports.erase(std::unique(Imports.begin(), Imports.end(), Eq),
                     Imports.end());
 
Index: lib/Serialization/ASTReaderDecl.cpp
===================================================================
--- lib/Serialization/ASTReaderDecl.cpp
+++ lib/Serialization/ASTReaderDecl.cpp
@@ -275,7 +275,7 @@
 
       if (auto &Old = LazySpecializations) {
         IDs.insert(IDs.end(), Old + 1, Old + 1 + Old[0]);
-        llvm::sort(IDs.begin(), IDs.end());
+        llvm::sort(IDs);
         IDs.erase(std::unique(IDs.begin(), IDs.end()), IDs.end());
       }
 
Index: lib/Serialization/ASTReader.cpp
===================================================================
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -396,8 +396,8 @@
                                              ExistingTargetOpts.FeaturesAsWritten.end());
   SmallVector<StringRef, 4> ReadFeatures(TargetOpts.FeaturesAsWritten.begin(),
                                          TargetOpts.FeaturesAsWritten.end());
-  llvm::sort(ExistingFeatures.begin(), ExistingFeatures.end());
-  llvm::sort(ReadFeatures.begin(), ReadFeatures.end());
+  llvm::sort(ExistingFeatures);
+  llvm::sort(ReadFeatures);
 
   // We compute the set difference in both directions explicitly so that we can
   // diagnose the differences differently.
@@ -9190,7 +9190,7 @@
   NextCursor:
     // De-serialized SourceLocations get negative FileIDs for other modules,
     // potentially invalidating the original order. Sort it again.
-    llvm::sort(Comments.begin(), Comments.end(),
+    llvm::sort(Comments,
                BeforeThanCompare<RawComment>(SourceMgr));
     Context.Comments.addDeserializedComments(Comments);
   }
Index: lib/Sema/SemaType.cpp
===================================================================
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -4986,7 +4986,7 @@
         if (Chunk.Fun.TypeQuals & Qualifiers::Restrict)
           RemovalLocs.push_back(Chunk.Fun.getRestrictQualifierLoc());
         if (!RemovalLocs.empty()) {
-          llvm::sort(RemovalLocs.begin(), RemovalLocs.end(),
+          llvm::sort(RemovalLocs,
                      BeforeThanCompare<SourceLocation>(S.getSourceManager()));
           RemovalRange = SourceRange(RemovalLocs.front(), RemovalLocs.back());
           Loc = RemovalLocs.front();
Index: lib/Sema/SemaOverload.cpp
===================================================================
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -10810,7 +10810,7 @@
     // in general, want to list every possible builtin candidate.
   }
 
-  llvm::sort(Cands.begin(), Cands.end(),
+  llvm::sort(Cands,
              CompareTemplateSpecCandidatesForDisplay(S));
 
   // FIXME: Perhaps rename OverloadsShown and getShowOverloads()
Index: lib/Sema/SemaLookup.cpp
===================================================================
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -187,7 +187,7 @@
     }
 
     void done() {
-      llvm::sort(list.begin(), list.end(), UnqualUsingEntry::Comparator());
+      llvm::sort(list, UnqualUsingEntry::Comparator());
     }
 
     typedef ListTy::const_iterator const_iterator;
Index: lib/Sema/SemaDeclAttr.cpp
===================================================================
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -5206,7 +5206,7 @@
     return;
 
   // Store tags sorted and without duplicates.
-  llvm::sort(Tags.begin(), Tags.end());
+  llvm::sort(Tags);
   Tags.erase(std::unique(Tags.begin(), Tags.end()), Tags.end());
 
   D->addAttr(::new (S.Context)
Index: lib/Sema/AnalysisBasedWarnings.cpp
===================================================================
--- lib/Sema/AnalysisBasedWarnings.cpp
+++ lib/Sema/AnalysisBasedWarnings.cpp
@@ -1391,7 +1391,7 @@
 
   // Sort by first use so that we emit the warnings in a deterministic order.
   SourceManager &SM = S.getSourceManager();
-  llvm::sort(UsesByStmt.begin(), UsesByStmt.end(),
+  llvm::sort(UsesByStmt,
              [&SM](const StmtUsesPair &LHS, const StmtUsesPair &RHS) {
                return SM.isBeforeInTranslationUnit(LHS.first->getBeginLoc(),
                                                    RHS.first->getBeginLoc());
Index: lib/Frontend/DiagnosticRenderer.cpp
===================================================================
--- lib/Frontend/DiagnosticRenderer.cpp
+++ lib/Frontend/DiagnosticRenderer.cpp
@@ -337,8 +337,8 @@
   SmallVector<FileID, 4> EndArgExpansions;
   getMacroArgExpansionFileIDs(Begin, BeginArgExpansions, /*IsBegin=*/true, SM);
   getMacroArgExpansionFileIDs(End, EndArgExpansions, /*IsBegin=*/false, SM);
-  llvm::sort(BeginArgExpansions.begin(), BeginArgExpansions.end());
-  llvm::sort(EndArgExpansions.begin(), EndArgExpansions.end());
+  llvm::sort(BeginArgExpansions);
+  llvm::sort(EndArgExpansions);
   std::set_intersection(BeginArgExpansions.begin(), BeginArgExpansions.end(),
                         EndArgExpansions.begin(), EndArgExpansions.end(),
                         std::back_inserter(CommonArgExpansions));
Index: lib/Format/WhitespaceManager.cpp
===================================================================
--- lib/Format/WhitespaceManager.cpp
+++ lib/Format/WhitespaceManager.cpp
@@ -90,7 +90,7 @@
   if (Changes.empty())
     return Replaces;
 
-  llvm::sort(Changes.begin(), Changes.end(), Change::IsBeforeInFile(SourceMgr));
+  llvm::sort(Changes, Change::IsBeforeInFile(SourceMgr));
   calculateLineBreakInformation();
   alignConsecutiveDeclarations();
   alignConsecutiveAssignments();
Index: lib/Format/FormatTokenLexer.cpp
===================================================================
--- lib/Format/FormatTokenLexer.cpp
+++ lib/Format/FormatTokenLexer.cpp
@@ -38,7 +38,7 @@
 
   for (const std::string &ForEachMacro : Style.ForEachMacros)
     ForEachMacros.push_back(&IdentTable.get(ForEachMacro));
-  llvm::sort(ForEachMacros.begin(), ForEachMacros.end());
+  llvm::sort(ForEachMacros);
 }
 
 ArrayRef<FormatToken *> FormatTokenLexer::lex() {
Index: lib/Driver/XRayArgs.cpp
===================================================================
--- lib/Driver/XRayArgs.cpp
+++ lib/Driver/XRayArgs.cpp
@@ -165,7 +165,7 @@
       }
 
     // Then we want to sort and unique the modes we've collected.
-    llvm::sort(Modes.begin(), Modes.end());
+    llvm::sort(Modes);
     Modes.erase(std::unique(Modes.begin(), Modes.end()), Modes.end());
   }
 }
Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1516,7 +1516,7 @@
   // deterministic order. We could sort in any way, but we chose
   // case-insensitive sorting for consistency with the -help option
   // which prints out options in the case-insensitive alphabetical order.
-  llvm::sort(SuggestedCompletions.begin(), SuggestedCompletions.end(),
+  llvm::sort(SuggestedCompletions,
              [](StringRef A, StringRef B) {
                if (int X = A.compare_lower(B))
                  return X < 0;
Index: lib/CodeGen/TargetInfo.cpp
===================================================================
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -8598,7 +8598,7 @@
     // The ABI requires unions to be sorted but not structures.
     // See FieldEncoding::operator< for sort algorithm.
     if (RT->isUnionType())
-      llvm::sort(FE.begin(), FE.end());
+      llvm::sort(FE);
     // We can now complete the TypeString.
     unsigned E = FE.size();
     for (unsigned I = 0; I != E; ++I) {
@@ -8642,7 +8642,7 @@
       EnumEnc += '}';
       FE.push_back(FieldEncoding(!I->getName().empty(), EnumEnc));
     }
-    llvm::sort(FE.begin(), FE.end());
+    llvm::sort(FE);
     unsigned E = FE.size();
     for (unsigned I = 0; I != E; ++I) {
       if (I)
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -1423,7 +1423,7 @@
     AddedAttr = true;
   }
   if (!Features.empty()) {
-    llvm::sort(Features.begin(), Features.end());
+    llvm::sort(Features);
     Attrs.addAttribute("target-features", llvm::join(Features, ","));
     AddedAttr = true;
   }
Index: lib/CodeGen/CGVTables.cpp
===================================================================
--- lib/CodeGen/CGVTables.cpp
+++ lib/CodeGen/CGVTables.cpp
@@ -1022,7 +1022,7 @@
                                 AP.second.AddressPointIndex));
 
   // Sort the address points for determinism.
-  llvm::sort(AddressPoints.begin(), AddressPoints.end(),
+  llvm::sort(AddressPoints,
              [this](const AddressPoint &AP1, const AddressPoint &AP2) {
     if (&AP1 == &AP2)
       return false;
Index: lib/CodeGen/CGObjCGNU.cpp
===================================================================
--- lib/CodeGen/CGObjCGNU.cpp
+++ lib/CodeGen/CGObjCGNU.cpp
@@ -3544,7 +3544,7 @@
     std::vector<Selector> allSelectors;
     for (auto &entry : table)
       allSelectors.push_back(entry.first);
-    llvm::sort(allSelectors.begin(), allSelectors.end());
+    llvm::sort(allSelectors);
 
     for (auto &untypedSel : allSelectors) {
       std::string selNameStr = untypedSel.getAsString();
Index: lib/CodeGen/CGBlocks.cpp
===================================================================
--- lib/CodeGen/CGBlocks.cpp
+++ lib/CodeGen/CGBlocks.cpp
@@ -1729,7 +1729,7 @@
   }
 
   // Sort the captures by offset.
-  llvm::sort(ManagedCaptures.begin(), ManagedCaptures.end());
+  llvm::sort(ManagedCaptures);
 }
 
 namespace {
Index: lib/Basic/VirtualFileSystem.cpp
===================================================================
--- lib/Basic/VirtualFileSystem.cpp
+++ lib/Basic/VirtualFileSystem.cpp
@@ -2064,7 +2064,7 @@
 }
 
 void YAMLVFSWriter::write(llvm::raw_ostream &OS) {
-  llvm::sort(Mappings.begin(), Mappings.end(),
+  llvm::sort(Mappings,
              [](const YAMLVFSEntry &LHS, const YAMLVFSEntry &RHS) {
     return LHS.VPath < RHS.VPath;
   });
Index: lib/Analysis/LiveVariables.cpp
===================================================================
--- lib/Analysis/LiveVariables.cpp
+++ lib/Analysis/LiveVariables.cpp
@@ -597,7 +597,7 @@
        it != ei; ++it) {
     vec.push_back(it->first);
   }
-  llvm::sort(vec.begin(), vec.end(), [](const CFGBlock *A, const CFGBlock *B) {
+  llvm::sort(vec, [](const CFGBlock *A, const CFGBlock *B) {
     return A->getBlockID() < B->getBlockID();
   });
 
@@ -617,7 +617,7 @@
       declVec.push_back(*si);
     }
 
-    llvm::sort(declVec.begin(), declVec.end(),
+    llvm::sort(declVec,
                [](const Decl *A, const Decl *B) {
                  return A->getBeginLoc() < B->getBeginLoc();
                });
Index: lib/AST/VTableBuilder.cpp
===================================================================
--- lib/AST/VTableBuilder.cpp
+++ lib/AST/VTableBuilder.cpp
@@ -2105,7 +2105,7 @@
       const CXXMethodDecl *MD = I.second;
 
       ThunkInfoVectorTy ThunksVector = Thunks[MD];
-      llvm::sort(ThunksVector.begin(), ThunksVector.end(),
+      llvm::sort(ThunksVector,
                  [](const ThunkInfo &LHS, const ThunkInfo &RHS) {
         assert(LHS.Method == nullptr && RHS.Method == nullptr);
         return std::tie(LHS.This, LHS.Return) < std::tie(RHS.This, RHS.Return);
@@ -3345,7 +3345,7 @@
   PathsSorted.reserve(Paths.size());
   for (auto& P : Paths)
     PathsSorted.push_back(*P);
-  llvm::sort(PathsSorted.begin(), PathsSorted.end(),
+  llvm::sort(PathsSorted,
              [](const VPtrInfo &LHS, const VPtrInfo &RHS) {
     return LHS.MangledPath < RHS.MangledPath;
   });
Index: lib/AST/ItaniumMangle.cpp
===================================================================
--- lib/AST/ItaniumMangle.cpp
+++ lib/AST/ItaniumMangle.cpp
@@ -323,7 +323,7 @@
                        AdditionalAbiTags->end());
       }
 
-      llvm::sort(TagList.begin(), TagList.end());
+      llvm::sort(TagList);
       TagList.erase(std::unique(TagList.begin(), TagList.end()), TagList.end());
 
       writeSortedUniqueAbiTags(Out, TagList);
@@ -339,7 +339,7 @@
     }
 
     const AbiTagList &getSortedUniqueUsedAbiTags() {
-      llvm::sort(UsedAbiTags.begin(), UsedAbiTags.end());
+      llvm::sort(UsedAbiTags);
       UsedAbiTags.erase(std::unique(UsedAbiTags.begin(), UsedAbiTags.end()),
                         UsedAbiTags.end());
       return UsedAbiTags;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D52576: l... Fangrui Song via Phabricator via cfe-commits

Reply via email to