r343147 - llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 26 15:16:29 PDT 2018
Author: maskray
Date: Wed Sep 26 15:16:28 2018
New Revision: 343147
URL: http://llvm.org/viewvc/llvm-project?rev=343147&view=rev
Log:
llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)
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
Modified:
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/AST/VTableBuilder.cpp
cfe/trunk/lib/Analysis/LiveVariables.cpp
cfe/trunk/lib/Basic/VirtualFileSystem.cpp
cfe/trunk/lib/CodeGen/CGBlocks.cpp
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
cfe/trunk/lib/CodeGen/CGVTables.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/XRayArgs.cpp
cfe/trunk/lib/Format/FormatTokenLexer.cpp
cfe/trunk/lib/Format/WhitespaceManager.cpp
cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp
cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Core/CheckerRegistry.cpp
cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp
cfe/trunk/lib/Tooling/Core/Replacement.cpp
cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp
cfe/trunk/tools/diagtool/DiagTool.cpp
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp
cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp
cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp
cfe/trunk/utils/TableGen/NeonEmitter.cpp
Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Wed Sep 26 15:16:28 2018
@@ -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;
Modified: cfe/trunk/lib/AST/VTableBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/AST/VTableBuilder.cpp (original)
+++ cfe/trunk/lib/AST/VTableBuilder.cpp Wed Sep 26 15:16:28 2018
@@ -2105,8 +2105,7 @@ void ItaniumVTableBuilder::dumpLayout(ra
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
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;
Modified: cfe/trunk/lib/Analysis/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/LiveVariables.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/lib/Analysis/LiveVariables.cpp Wed Sep 26 15:16:28 2018
@@ -597,7 +597,7 @@ void LiveVariablesImpl::dumpBlockLivenes
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::dumpBlockLivenes
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) {
Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original)
+++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Wed Sep 26 15:16:28 2018
@@ -2064,8 +2064,7 @@ void JSONWriter::write(ArrayRef<YAMLVFSE
}
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;
});
Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Sep 26 15:16:28 2018
@@ -1729,7 +1729,7 @@ static void findBlockCapturedManagedEnti
}
// Sort the captures by offset.
- llvm::sort(ManagedCaptures.begin(), ManagedCaptures.end());
+ llvm::sort(ManagedCaptures);
}
namespace {
Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Wed Sep 26 15:16:28 2018
@@ -3544,7 +3544,7 @@ llvm::Function *CGObjCGNU::ModuleInitFun
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();
Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Wed Sep 26 15:16:28 2018
@@ -1022,8 +1022,8 @@ void CodeGenModule::EmitVTableTypeMetada
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;
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Sep 26 15:16:28 2018
@@ -1423,7 +1423,7 @@ bool CodeGenModule::GetCPUAndFeaturesAtt
AddedAttr = true;
}
if (!Features.empty()) {
- llvm::sort(Features.begin(), Features.end());
+ llvm::sort(Features);
Attrs.addAttribute("target-features", llvm::join(Features, ","));
AddedAttr = true;
}
Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Sep 26 15:16:28 2018
@@ -8598,7 +8598,7 @@ static bool appendRecordType(SmallString
// 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(SmallStringEn
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)
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Sep 26 15:16:28 2018
@@ -1516,12 +1516,11 @@ void Driver::HandleAutocompletions(Strin
// 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';
}
Modified: cfe/trunk/lib/Driver/XRayArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/XRayArgs.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/XRayArgs.cpp (original)
+++ cfe/trunk/lib/Driver/XRayArgs.cpp Wed Sep 26 15:16:28 2018
@@ -165,7 +165,7 @@ XRayArgs::XRayArgs(const ToolChain &TC,
}
// 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());
}
}
Modified: cfe/trunk/lib/Format/FormatTokenLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/FormatTokenLexer.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Format/FormatTokenLexer.cpp (original)
+++ cfe/trunk/lib/Format/FormatTokenLexer.cpp Wed Sep 26 15:16:28 2018
@@ -38,7 +38,7 @@ FormatTokenLexer::FormatTokenLexer(const
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() {
Modified: cfe/trunk/lib/Format/WhitespaceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/WhitespaceManager.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Format/WhitespaceManager.cpp (original)
+++ cfe/trunk/lib/Format/WhitespaceManager.cpp Wed Sep 26 15:16:28 2018
@@ -90,7 +90,7 @@ const tooling::Replacements &WhitespaceM
if (Changes.empty())
return Replaces;
- llvm::sort(Changes.begin(), Changes.end(), Change::IsBeforeInFile(SourceMgr));
+ llvm::sort(Changes, Change::IsBeforeInFile(SourceMgr));
calculateLineBreakInformation();
alignConsecutiveDeclarations();
alignConsecutiveAssignments();
Modified: cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp (original)
+++ cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp Wed Sep 26 15:16:28 2018
@@ -337,8 +337,8 @@ static void computeCommonMacroArgExpansi
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));
Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Wed Sep 26 15:16:28 2018
@@ -1391,7 +1391,7 @@ static void diagnoseRepeatedUseOfWeak(Se
// 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());
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed Sep 26 15:16:28 2018
@@ -5206,7 +5206,7 @@ static void handleAbiTagAttr(Sema &S, De
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)
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Wed Sep 26 15:16:28 2018
@@ -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;
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Sep 26 15:16:28 2018
@@ -10810,8 +10810,7 @@ void TemplateSpecCandidateSet::NoteCandi
// 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 (?).
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Wed Sep 26 15:16:28 2018
@@ -4986,7 +4986,7 @@ static TypeSourceInfo *GetFullTypeForDec
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();
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Wed Sep 26 15:16:28 2018
@@ -396,8 +396,8 @@ static bool checkTargetOptions(const Tar
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);
}
}
Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Wed Sep 26 15:16:28 2018
@@ -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());
}
Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Wed Sep 26 15:16:28 2018
@@ -2495,8 +2495,7 @@ void ASTWriter::WritePreprocessor(const
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(Pre
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
}
// 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::WriteDeclContextVisi
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
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
};
// 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());
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp Wed Sep 26 15:16:28 2018
@@ -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
Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Wed Sep 26 15:16:28 2018
@@ -2386,8 +2386,7 @@ TrimmedGraph::TrimmedGraph(const Explode
}
// 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) {
Modified: cfe/trunk/lib/StaticAnalyzer/Core/CheckerRegistry.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CheckerRegistry.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CheckerRegistry.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CheckerRegistry.cpp Wed Sep 26 15:16:28 2018
@@ -103,7 +103,7 @@ void CheckerRegistry::addChecker(Initial
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_ostr
// 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_ostr
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;
Modified: cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp (original)
+++ cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp Wed Sep 26 15:16:28 2018
@@ -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 {
Modified: cfe/trunk/lib/Tooling/Core/Replacement.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/Replacement.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/Core/Replacement.cpp (original)
+++ cfe/trunk/lib/Tooling/Core/Replacement.cpp Wed Sep 26 15:16:28 2018
@@ -483,12 +483,11 @@ Replacements Replacements::merge(const R
// 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() ||
Modified: cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp (original)
+++ cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp Wed Sep 26 15:16:28 2018
@@ -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(); }
Modified: cfe/trunk/tools/diagtool/DiagTool.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/diagtool/DiagTool.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/tools/diagtool/DiagTool.cpp (original)
+++ cfe/trunk/tools/diagtool/DiagTool.cpp Wed Sep 26 15:16:28 2018
@@ -48,7 +48,7 @@ void DiagTools::printCommands(llvm::raw_
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) {
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Wed Sep 26 15:16:28 2018
@@ -1044,7 +1044,7 @@ bool CursorVisitor::VisitObjCContainerDe
}
// 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 getCursorPlatformAvailabilit
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(),
Modified: cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp (original)
+++ cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp Wed Sep 26 15:16:28 2018
@@ -553,8 +553,8 @@ static void checkContents(DirIter I, Arr
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());
Modified: cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp Wed Sep 26 15:16:28 2018
@@ -208,9 +208,9 @@ static void groupDiagnostics(const std::
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(RecordKeepe
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 &Rec
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 &Rec
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());
Modified: cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp Wed Sep 26 15:16:28 2018
@@ -111,7 +111,7 @@ Documentation extractDocumentation(Recor
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(Recor
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(Recor
}
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));
Modified: cfe/trunk/utils/TableGen/NeonEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/NeonEmitter.cpp?rev=343147&r1=343146&r2=343147&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/NeonEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/NeonEmitter.cpp Wed Sep 26 15:16:28 2018
@@ -2020,7 +2020,7 @@ void NeonEmitter::createIntrinsic(Record
}
}
- llvm::sort(NewTypeSpecs.begin(), NewTypeSpecs.end());
+ llvm::sort(NewTypeSpecs);
NewTypeSpecs.erase(std::unique(NewTypeSpecs.begin(), NewTypeSpecs.end()),
NewTypeSpecs.end());
auto &Entry = IntrinsicMap[Name];
More information about the cfe-commits
mailing list