]> granicus.if.org Git - clang/commitdiff
llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)
authorFangrui Song <maskray@google.com>
Wed, 26 Sep 2018 22:16:28 +0000 (22:16 +0000)
committerFangrui Song <maskray@google.com>
Wed, 26 Sep 2018 22:16:28 +0000 (22:16 +0000)
Summary: The convenience wrapper in STLExtras is available since rL342102.

Reviewers: rsmith, #clang, dblaikie

Reviewed By: rsmith, #clang

Subscribers: mgrang, arphaman, kadircet, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343147 91177308-0d34-0410-b5e6-96231b3b80d8

34 files changed:
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 b483187394a5e42702929484846a3c8aebe84184..e99549850acd6e3893bee4cd96a6f5074aad8d53 100644 (file)
@@ -323,7 +323,7 @@ class CXXNameMangler {
                        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 @@ class CXXNameMangler {
     }
 
     const AbiTagList &getSortedUniqueUsedAbiTags() {
-      llvm::sort(UsedAbiTags.begin(), UsedAbiTags.end());
+      llvm::sort(UsedAbiTags);
       UsedAbiTags.erase(std::unique(UsedAbiTags.begin(), UsedAbiTags.end()),
                         UsedAbiTags.end());
       return UsedAbiTags;
index dfc5774ab4988cf75ec71f64eea02380aa1d54f6..46844daf3b360bb6ffbe401e7714d18bd49016b1 100644 (file)
@@ -2105,8 +2105,7 @@ void ItaniumVTableBuilder::dumpLayout(raw_ostream &Out) {
       const CXXMethodDecl *MD = I.second;
 
       ThunkInfoVectorTy ThunksVector = Thunks[MD];
-      llvm::sort(ThunksVector.begin(), ThunksVector.end(),
-                 [](const ThunkInfo &LHS, const ThunkInfo &RHS) {
+      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,8 +3344,7 @@ static bool rebucketPaths(VPtrInfoVector &Paths) {
   PathsSorted.reserve(Paths.size());
   for (auto& P : Paths)
     PathsSorted.push_back(*P);
-  llvm::sort(PathsSorted.begin(), PathsSorted.end(),
-             [](const VPtrInfo &LHS, const VPtrInfo &RHS) {
+  llvm::sort(PathsSorted, [](const VPtrInfo &LHS, const VPtrInfo &RHS) {
     return LHS.MangledPath < RHS.MangledPath;
   });
   bool Changed = false;
index ca82515ffa5a62aa28253404714c835a1a3d96b2..f7bfcadf591eacedad33c9cfe46621c9a982d622 100644 (file)
@@ -597,7 +597,7 @@ void LiveVariablesImpl::dumpBlockLiveness(const SourceManager &M) {
        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,10 +617,9 @@ void LiveVariablesImpl::dumpBlockLiveness(const SourceManager &M) {
       declVec.push_back(*si);
     }
 
-    llvm::sort(declVec.begin(), declVec.end(),
-               [](const Decl *A, const Decl *B) {
-                 return A->getBeginLoc() < B->getBeginLoc();
-               });
+    llvm::sort(declVec, [](const Decl *A, const Decl *B) {
+      return A->getBeginLoc() < B->getBeginLoc();
+    });
 
     for (std::vector<const VarDecl*>::iterator di = declVec.begin(),
          de = declVec.end(); di != de; ++di) {
index 56fc33633404c82ff4a202d5e1b2fbf360297e78..6d96f16a79643c809ccbedbab53083228c847b4c 100644 (file)
@@ -2064,8 +2064,7 @@ void JSONWriter::write(ArrayRef<YAMLVFSEntry> Entries,
 }
 
 void YAMLVFSWriter::write(llvm::raw_ostream &OS) {
-  llvm::sort(Mappings.begin(), Mappings.end(),
-             [](const YAMLVFSEntry &LHS, const YAMLVFSEntry &RHS) {
+  llvm::sort(Mappings, [](const YAMLVFSEntry &LHS, const YAMLVFSEntry &RHS) {
     return LHS.VPath < RHS.VPath;
   });
 
index 170e4f0c0836f0b99539727321e5b4c4511df995..dae148cbd1e2c6c3f2f2155c3067b12b50cfaad7 100644 (file)
@@ -1729,7 +1729,7 @@ static void findBlockCapturedManagedEntities(
   }
 
   // Sort the captures by offset.
-  llvm::sort(ManagedCaptures.begin(), ManagedCaptures.end());
+  llvm::sort(ManagedCaptures);
 }
 
 namespace {
index b509187b4ce43f163cd0a9708d597ffff9a2b101..cb140bf9e069ca32c9cd721ca34adcb4c5dd9bcd 100644 (file)
@@ -3544,7 +3544,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
     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 df20b9bb46a4e707949d8d6d154036d35ef241cb..e29a035e31efe1c8a79ee041f26980601c3b5f29 100644 (file)
@@ -1022,8 +1022,8 @@ void CodeGenModule::EmitVTableTypeMetadata(llvm::GlobalVariable *VTable,
                                 AP.second.AddressPointIndex));
 
   // Sort the address points for determinism.
-  llvm::sort(AddressPoints.begin(), AddressPoints.end(),
-             [this](const AddressPoint &AP1, const AddressPoint &AP2) {
+  llvm::sort(AddressPoints, [this](const AddressPoint &AP1,
+                                   const AddressPoint &AP2) {
     if (&AP1 == &AP2)
       return false;
 
index cd30ad1a400e8c484bcd14bf19bc5615db971742..c2fb4797ccdd18e22e388259d48cc314504f5334 100644 (file)
@@ -1423,7 +1423,7 @@ bool CodeGenModule::GetCPUAndFeaturesAttributes(const Decl *D,
     AddedAttr = true;
   }
   if (!Features.empty()) {
-    llvm::sort(Features.begin(), Features.end());
+    llvm::sort(Features);
     Attrs.addAttribute("target-features", llvm::join(Features, ","));
     AddedAttr = true;
   }
index 32edfd853fb4bede3b415d16b16d2f83d479dbc1..ada42fd2ae6a062eb4c63bc9cc94bc7443ab80af 100644 (file)
@@ -8598,7 +8598,7 @@ static bool appendRecordType(SmallStringEnc &Enc, const RecordType *RT,
     // 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 @@ static bool appendEnumType(SmallStringEnc &Enc, const EnumType *ET,
       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 81369f995da0c80a15420f261b8ee723313d1887..4439e721f48f09a3e3b2012fa8ab772eadaaea2a 100644 (file)
@@ -1516,12 +1516,11 @@ void Driver::HandleAutocompletions(StringRef PassedFlags) const {
   // 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(),
-             [](StringRef A, StringRef B) {
-               if (int X = A.compare_lower(B))
-                 return X < 0;
-               return A.compare(B) > 0;
-            });
+  llvm::sort(SuggestedCompletions, [](StringRef A, StringRef B) {
+    if (int X = A.compare_lower(B))
+      return X < 0;
+    return A.compare(B) > 0;
+  });
 
   llvm::outs() << llvm::join(SuggestedCompletions, "\n") << '\n';
 }
index a20232897539680807088240e7d4825b46c0f495..3d058c2f4ccf5b215103a349966e7b80b35314da 100644 (file)
@@ -165,7 +165,7 @@ XRayArgs::XRayArgs(const ToolChain &TC, const ArgList &Args) {
       }
 
     // 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 c7f720a443d35415d22dadbb7dfd1f32269bf548..7f2edf102c79718c4a92ff407289b29dbc2bb974 100644 (file)
@@ -38,7 +38,7 @@ FormatTokenLexer::FormatTokenLexer(const SourceManager &SourceMgr, FileID ID,
 
   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 a88c22f4e96a7c27960375f2dee59bf17544a352..032b1333322d1e06c0447d6713e7167c9bd6d8f4 100644 (file)
@@ -90,7 +90,7 @@ const tooling::Replacements &WhitespaceManager::generateReplacements() {
   if (Changes.empty())
     return Replaces;
 
-  llvm::sort(Changes.begin(), Changes.end(), Change::IsBeforeInFile(SourceMgr));
+  llvm::sort(Changes, Change::IsBeforeInFile(SourceMgr));
   calculateLineBreakInformation();
   alignConsecutiveDeclarations();
   alignConsecutiveAssignments();
index 757ceec7ec9d01c178c65c770960f8b0aceca916..3bd86dc5beaad452e145dd004120d02466a53893 100644 (file)
@@ -337,8 +337,8 @@ static void computeCommonMacroArgExpansionFileIDs(
   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 96684b321e33f34ff30e8251e3bc28e06dcf2f9f..ab46554485f4177212bd816862f352ee7c027d24 100644 (file)
@@ -1391,7 +1391,7 @@ static void diagnoseRepeatedUseOfWeak(Sema &S,
 
   // 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 50c4643df40a301582ea2afa465a44301dde1cc1..17b93e0add848228bfddd1ef615e7c8799e70247 100644 (file)
@@ -5206,7 +5206,7 @@ static void handleAbiTagAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
     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 103aa7edd974be040b7e9a9ac46675008e9aa28f..6a1aae62413472b79b41d05d43bba9e12295f7db 100644 (file)
@@ -186,9 +186,7 @@ namespace {
       list.push_back(UnqualUsingEntry(UD->getNominatedNamespace(), Common));
     }
 
-    void done() {
-      llvm::sort(list.begin(), list.end(), UnqualUsingEntry::Comparator());
-    }
+    void done() { llvm::sort(list, UnqualUsingEntry::Comparator()); }
 
     typedef ListTy::const_iterator const_iterator;
 
index 35636e73cf30138b04b28dc9b1d430b1936a649d..f4ec04a1b291652d8975a9738cbb8864569890c3 100644 (file)
@@ -10810,8 +10810,7 @@ void TemplateSpecCandidateSet::NoteCandidates(Sema &S, SourceLocation Loc) {
     // in general, want to list every possible builtin candidate.
   }
 
-  llvm::sort(Cands.begin(), Cands.end(),
-             CompareTemplateSpecCandidatesForDisplay(S));
+  llvm::sort(Cands, CompareTemplateSpecCandidatesForDisplay(S));
 
   // FIXME: Perhaps rename OverloadsShown and getShowOverloads()
   // for generalization purposes (?).
index 819f9ef8a4872e7593980388b0d583f340c23c96..27dbf70498d39b5b506a20eafa6b1fe482c27a9a 100644 (file)
@@ -4986,7 +4986,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
         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 2e0d424b137fb59691af6ac5d447a0be9acbe521..f8d98eeeb6562d7131a1b3161ea1de1ea1097fba 100644 (file)
@@ -396,8 +396,8 @@ static bool checkTargetOptions(const TargetOptions &TargetOpts,
                                              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,8 +9190,7 @@ void ASTReader::ReadComments() {
   NextCursor:
     // De-serialized SourceLocations get negative FileIDs for other modules,
     // potentially invalidating the original order. Sort it again.
-    llvm::sort(Comments.begin(), Comments.end(),
-               BeforeThanCompare<RawComment>(SourceMgr));
+    llvm::sort(Comments, BeforeThanCompare<RawComment>(SourceMgr));
     Context.Comments.addDeserializedComments(Comments);
   }
 }
index fc9e7e82aef0be9d7a55cb14c9cd9dd77bb9cf1c..6d541aa98855a117cf315ff58b516c360f7b9f50 100644 (file)
@@ -275,7 +275,7 @@ namespace clang {
 
       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 db4ab455bbf3b8d3e16677cde24c683878a2af69..570a1e1643ed1e31c6858112dd35993d15fe5cb2 100644 (file)
@@ -2495,8 +2495,7 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP, bool IsModule) {
       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::less_ptr<IdentifierInfo>());
+  llvm::sort(MacroIdentifiers, llvm::less_ptr<IdentifierInfo>());
 
   // Emit the macro directives as a list and associate the offset with the
   // identifier they belong to.
@@ -3230,8 +3229,7 @@ void ASTWriter::WriteFileDeclIDsMap() {
 
   SmallVector<std::pair<FileID, DeclIDInFileInfo *>, 64> SortedFileDeclIDs(
       FileDeclIDs.begin(), FileDeclIDs.end());
-  llvm::sort(SortedFileDeclIDs.begin(), SortedFileDeclIDs.end(),
-             llvm::less_first());
+  llvm::sort(SortedFileDeclIDs, llvm::less_first());
 
   // Join the vectors of DeclIDs from all files.
   SmallVector<DeclID, 256> FileGroupedDeclIDs;
@@ -3737,7 +3735,7 @@ void ASTWriter::WriteIdentifierTable(Preprocessor &PP,
       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 +4033,7 @@ ASTWriter::GenerateNameLookupTable(const DeclContext *ConstDC,
   }
 
   // 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 +4170,7 @@ uint64_t ASTWriter::WriteDeclContextVisibleBlock(ASTContext &Context,
             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 +4873,7 @@ ASTFileSignature ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot,
         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 +5110,7 @@ ASTFileSignature ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot,
       };
 
       // 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 f69f3492edb14f8c61d92f22d1ab6ad5a6029be2..b1255243bea8893781b3ede1340c25f12926e547 100644 (file)
@@ -237,7 +237,7 @@ public:
     };
     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 048c8aa2834ed297112531adb71acbfa6554600f..bc4600c827ff7f912616be4497068ef594e18b58 100644 (file)
@@ -2386,8 +2386,7 @@ TrimmedGraph::TrimmedGraph(const ExplodedGraph *OriginalGraph,
   }
 
   // Sort the error paths from longest to shortest.
-  llvm::sort(ReportNodes.begin(), ReportNodes.end(),
-             PriorityCompare<true>(PriorityMap));
+  llvm::sort(ReportNodes, PriorityCompare<true>(PriorityMap));
 }
 
 bool TrimmedGraph::popNextReportGraph(ReportGraph &GraphWrapper) {
index 645845ec2181f71d50b0ea251d09d1f741a252ca..89adea2cffe7fb9d728493c71de4c79fc2a43eef 100644 (file)
@@ -103,7 +103,7 @@ void CheckerRegistry::addChecker(InitializationFunction fn, StringRef name,
 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 @@ void CheckerRegistry::printHelp(raw_ostream &out,
   // 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::printHelp(raw_ostream &out,
 
 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 a5d2d1d247299016db23d4864e36057f28528ee6..9ff9a02a58ae7b2956593e8b3776a71529093a98 100644 (file)
@@ -741,7 +741,7 @@ public:
       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 67e2dcfd73c116905ea8cd4b5f65c275ce81e191..f97bdbf6beca65683b6543b9193dbb1f5dbe1de6 100644 (file)
@@ -483,12 +483,11 @@ Replacements Replacements::merge(const Replacements &ReplacesToMerge) const {
 // 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(),
-             [](const Range &LHS, const Range &RHS) {
-               if (LHS.getOffset() != RHS.getOffset())
-                 return LHS.getOffset() < RHS.getOffset();
-               return LHS.getLength() < RHS.getLength();
-            });
+  llvm::sort(Ranges, [](const Range &LHS, const Range &RHS) {
+    if (LHS.getOffset() != RHS.getOffset())
+      return LHS.getOffset() < RHS.getOffset();
+    return LHS.getLength() < RHS.getLength();
+  });
   std::vector<Range> Result;
   for (const auto &R : Ranges) {
     if (Result.empty() ||
index 9727da2a18bc2bcc7d125dbc57b69db5aaba8bb9..4d0d84f660a2cb10e8c1726a64c0e4fee238b9f3 100644 (file)
@@ -321,7 +321,7 @@ public:
   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 @@ public:
         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 d9086af8e989327ee1ba5a8e38d5edf768a7cf68..1690a4456cc11a94b28b3666e8a4375e198b20a4 100644 (file)
@@ -48,7 +48,7 @@ void DiagTools::printCommands(llvm::raw_ostream &out) {
     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 6bd9d7387384a073ec0b71505164844e276315fa..7e2380ea7b86942f2e2ff639bda4474e7d1aff38 100644 (file)
@@ -1044,7 +1044,7 @@ bool CursorVisitor::VisitObjCContainerDecl(ObjCContainerDecl *D) {
   }
 
   // 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,11 +7803,11 @@ static void getCursorPlatformAvailabilityForDecl(
   if (AvailabilityAttrs.empty())
     return;
 
-  llvm::sort(AvailabilityAttrs.begin(), AvailabilityAttrs.end(),
+  llvm::sort(AvailabilityAttrs,
              [](AvailabilityAttr *LHS, AvailabilityAttr *RHS) {
                return LHS->getPlatform()->getName() <
                       RHS->getPlatform()->getName();
-            });
+             });
   ASTContext &Ctx = D->getASTContext();
   auto It = std::unique(
       AvailabilityAttrs.begin(), AvailabilityAttrs.end(),
index 7f89d751c7f798342c8a2194796e1e87d52e9344..83317e58f7245b0eadcf01de14f398cf01cb17e6 100644 (file)
@@ -553,8 +553,8 @@ static void checkContents(DirIter I, ArrayRef<StringRef> ExpectedOut) {
   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 6bfb3f9f61f542be94fdee4164d100b87afdfb9c..782b71307377f1c118e4fb2abdff8c66516e95b1 100644 (file)
@@ -208,9 +208,9 @@ static void groupDiagnostics(const std::vector<Record*> &Diags,
                                               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,10 +1595,10 @@ void EmitClangDiagsIndexName(RecordKeeper &Records, raw_ostream &OS) {
     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;
-            });
+             });
 
   for (unsigned i = 0, e = Index.size(); i != e; ++i) {
     const RecordIndexElement &R = Index[i];
@@ -1694,7 +1694,7 @@ void EmitClangDiagDocs(RecordKeeper &Records, raw_ostream &OS) {
 
   std::vector<Record*> DiagGroups =
       Records.getAllDerivedDefinitions("DiagGroup");
-  llvm::sort(DiagGroups.begin(), DiagGroups.end(), diagGroupBeforeByName);
+  llvm::sort(DiagGroups, diagGroupBeforeByName);
 
   DiagGroupParentMap DGParentMap(Records);
 
@@ -1713,10 +1713,8 @@ void EmitClangDiagDocs(RecordKeeper &Records, raw_ostream &OS) {
                               DiagsInPedanticSet.end());
     RecordVec GroupsInPedantic(GroupsInPedanticSet.begin(),
                                GroupsInPedanticSet.end());
-    llvm::sort(DiagsInPedantic.begin(), DiagsInPedantic.end(),
-               beforeThanCompare);
-    llvm::sort(GroupsInPedantic.begin(), GroupsInPedantic.end(),
-               beforeThanCompare);
+    llvm::sort(DiagsInPedantic, beforeThanCompare);
+    llvm::sort(GroupsInPedantic, beforeThanCompare);
     PedDiags.DiagsInGroup.insert(PedDiags.DiagsInGroup.end(),
                                  DiagsInPedantic.begin(),
                                  DiagsInPedantic.end());
index 7fe487e546983461123540e75f09eed1d58dc4e6..cf642ec92bd80d37b6771fcef5ee145a2fb3371f 100644 (file)
@@ -111,7 +111,7 @@ Documentation extractDocumentation(RecordKeeper &Records) {
 
   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)};
   };
 
@@ -120,7 +120,7 @@ Documentation extractDocumentation(RecordKeeper &Records) {
     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;
@@ -129,7 +129,7 @@ Documentation extractDocumentation(RecordKeeper &Records) {
     }
 
     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 df14391b34315a8a55a75ee6f7f3b3751ba5f5df..df002eef120a062ab548aaf8f3c2d0f5422c6a17 100644 (file)
@@ -2020,7 +2020,7 @@ void NeonEmitter::createIntrinsic(Record *R,
     }
   }
 
-  llvm::sort(NewTypeSpecs.begin(), NewTypeSpecs.end());
+  llvm::sort(NewTypeSpecs);
   NewTypeSpecs.erase(std::unique(NewTypeSpecs.begin(), NewTypeSpecs.end()),
                     NewTypeSpecs.end());
   auto &Entry = IntrinsicMap[Name];