[PATCH] D44362: [clang] Change std::sort to llvm::sort in response to r327219
rnk accepted this revision. rnk added a comment. This revision is now accepted and ready to land. lgtm Repository: rC Clang https://reviews.llvm.org/D44362 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44362: [clang] Change std::sort to llvm::sort in response to r327219
mgrang added a comment. Ping for reviews please. Repository: rC Clang https://reviews.llvm.org/D44362 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44362: [clang] Change std::sort to llvm::sort in response to r327219
mgrang updated this revision to Diff 137966. mgrang added a comment. Fixed indentation. Repository: rC Clang https://reviews.llvm.org/D44362 Files: include/clang/Basic/Attr.td include/clang/Serialization/ContinuousRangeMap.h lib/AST/ASTContext.cpp lib/AST/ItaniumMangle.cpp lib/AST/VTableBuilder.cpp lib/ASTMatchers/Dynamic/Parser.cpp lib/Analysis/LiveVariables.cpp lib/Basic/VirtualFileSystem.cpp lib/CodeGen/CGVTables.cpp lib/CodeGen/CodeGenModule.cpp lib/CodeGen/TargetInfo.cpp lib/Driver/Driver.cpp lib/Format/FormatTokenLexer.cpp lib/Format/WhitespaceManager.cpp lib/Frontend/CompilerInvocation.cpp lib/Frontend/DiagnosticRenderer.cpp lib/Sema/AnalysisBasedWarnings.cpp lib/Sema/SemaDecl.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 tools/diagtool/DiagTool.cpp tools/libclang/CIndex.cpp unittests/Basic/VirtualFileSystemTest.cpp utils/TableGen/ClangAttrEmitter.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 @@ -2007,7 +2007,7 @@ } } - std::sort(NewTypeSpecs.begin(), NewTypeSpecs.end()); + llvm::sort(NewTypeSpecs.begin(), NewTypeSpecs.end()); NewTypeSpecs.erase(std::unique(NewTypeSpecs.begin(), NewTypeSpecs.end()), NewTypeSpecs.end()); auto = 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 = Aliases[R]; -std::sort(A.begin(), A.end(), CompareByName); +llvm::sort(A.begin(), A.end(), CompareByName); return {R, std::move(A)}; }; std::functionDocumentationForGroup = [&](Record *R) -> Documentation { Documentation D; auto = GroupsInGroup[R]; -std::sort(Groups.begin(), Groups.end(), CompareByLocation); +llvm::sort(Groups.begin(), Groups.end(), CompareByLocation); for (Record *G : Groups) { D.Groups.emplace_back(); D.Groups.back().Group = G; Documentation = D.Groups.back(); Base = DocumentationForGroup(G); } auto = OptionsInGroup[R]; -std::sort(Options.begin(), Options.end(), CompareByName); +llvm::sort(Options.begin(), Options.end(), CompareByName); for (Record *O : Options) D.Options.push_back(DocumentationForOption(O)); Index: utils/TableGen/ClangDiagnosticsEmitter.cpp === --- utils/TableGen/ClangDiagnosticsEmitter.cpp +++ utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -207,9 +207,9 @@ E = SortedGroups.end(); I != E; ++I) { MutableArrayRef GroupDiags = (*I)->DiagsInGroup; -std::sort(GroupDiags.begin(), GroupDiags.end(), beforeThanCompare); +llvm::sort(GroupDiags.begin(), GroupDiags.end(), beforeThanCompare); } - std::sort(SortedGroups.begin(), SortedGroups.end(), beforeThanCompareGroups); + llvm::sort(SortedGroups.begin(), SortedGroups.end(), beforeThanCompareGroups); // Warn about the same group being used anonymously in multiple places. for (SmallVectorImpl::const_iterator I = SortedGroups.begin(), @@ -863,9 +863,10 @@ Index.push_back(RecordIndexElement(R)); } - std::sort(Index.begin(), Index.end(), -[](const RecordIndexElement , - const RecordIndexElement ) { return Lhs.Name < Rhs.Name; }); + llvm::sort(Index.begin(), Index.end(), + [](const RecordIndexElement , const RecordIndexElement ) { + return Lhs.Name < Rhs.Name; +}); for (unsigned i = 0, e = Index.size(); i != e; ++i) { const RecordIndexElement = Index[i]; @@ -1212,7 +1213,7 @@ Records.getAllDerivedDefinitions("Diagnostic"); std::vector DiagGroups = Records.getAllDerivedDefinitions("DiagGroup"); - std::sort(DiagGroups.begin(), DiagGroups.end(), diagGroupBeforeByName); + llvm::sort(DiagGroups.begin(), DiagGroups.end(), diagGroupBeforeByName); DiagGroupParentMap DGParentMap(Records); @@ -1231,10 +1232,10 @@ DiagsInPedanticSet.end()); RecordVec GroupsInPedantic(GroupsInPedanticSet.begin(), GroupsInPedanticSet.end()); -
[PATCH] D44362: [clang] Change std::sort to llvm::sort in response to r327219
rsmith added inline comments. Comment at: include/clang-c/Index.h:2133 * void abssort(float *x, unsigned N) { - * std::sort(x, x + N, + * llvm::sort(x, x + N, * [](float a, float b) { This shouldn't be changed. Comment at: lib/AST/VTableBuilder.cpp:2109 + llvm::sort(ThunksVector.begin(), ThunksVector.end(), [](const ThunkInfo , const ThunkInfo ) { assert(LHS.Method == nullptr && RHS.Method == nullptr); Reindent this (and other calls) please. Repository: rC Clang https://reviews.llvm.org/D44362 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44362: [clang] Change std::sort to llvm::sort in response to r327219
mgrang created this revision. mgrang added reviewers: rsmith, rnk, chandlerc. mgrang added a project: clang. Herald added a subscriber: klimek. r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. Repository: rC Clang https://reviews.llvm.org/D44362 Files: include/clang-c/Index.h include/clang/Basic/Attr.td include/clang/Serialization/ContinuousRangeMap.h lib/AST/ASTContext.cpp lib/AST/ItaniumMangle.cpp lib/AST/VTableBuilder.cpp lib/ASTMatchers/Dynamic/Parser.cpp lib/Analysis/LiveVariables.cpp lib/Basic/VirtualFileSystem.cpp lib/CodeGen/CGVTables.cpp lib/CodeGen/CodeGenModule.cpp lib/CodeGen/TargetInfo.cpp lib/Driver/Driver.cpp lib/Format/FormatTokenLexer.cpp lib/Format/WhitespaceManager.cpp lib/Frontend/CompilerInvocation.cpp lib/Frontend/DiagnosticRenderer.cpp lib/Sema/AnalysisBasedWarnings.cpp lib/Sema/SemaDecl.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 tools/diagtool/DiagTool.cpp tools/libclang/CIndex.cpp unittests/Basic/VirtualFileSystemTest.cpp utils/TableGen/ClangAttrEmitter.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 @@ -2007,7 +2007,7 @@ } } - std::sort(NewTypeSpecs.begin(), NewTypeSpecs.end()); + llvm::sort(NewTypeSpecs.begin(), NewTypeSpecs.end()); NewTypeSpecs.erase(std::unique(NewTypeSpecs.begin(), NewTypeSpecs.end()), NewTypeSpecs.end()); auto = 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 = Aliases[R]; -std::sort(A.begin(), A.end(), CompareByName); +llvm::sort(A.begin(), A.end(), CompareByName); return {R, std::move(A)}; }; std::functionDocumentationForGroup = [&](Record *R) -> Documentation { Documentation D; auto = GroupsInGroup[R]; -std::sort(Groups.begin(), Groups.end(), CompareByLocation); +llvm::sort(Groups.begin(), Groups.end(), CompareByLocation); for (Record *G : Groups) { D.Groups.emplace_back(); D.Groups.back().Group = G; Documentation = D.Groups.back(); Base = DocumentationForGroup(G); } auto = OptionsInGroup[R]; -std::sort(Options.begin(), Options.end(), CompareByName); +llvm::sort(Options.begin(), Options.end(), CompareByName); for (Record *O : Options) D.Options.push_back(DocumentationForOption(O)); Index: utils/TableGen/ClangDiagnosticsEmitter.cpp === --- utils/TableGen/ClangDiagnosticsEmitter.cpp +++ utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -207,9 +207,9 @@ E = SortedGroups.end(); I != E; ++I) { MutableArrayRef GroupDiags = (*I)->DiagsInGroup; -std::sort(GroupDiags.begin(), GroupDiags.end(), beforeThanCompare); +llvm::sort(GroupDiags.begin(), GroupDiags.end(), beforeThanCompare); } - std::sort(SortedGroups.begin(), SortedGroups.end(), beforeThanCompareGroups); + llvm::sort(SortedGroups.begin(), SortedGroups.end(), beforeThanCompareGroups); // Warn about the same group being used anonymously in multiple places. for (SmallVectorImpl::const_iterator I = SortedGroups.begin(), @@ -863,7 +863,7 @@ Index.push_back(RecordIndexElement(R)); } - std::sort(Index.begin(), Index.end(), + llvm::sort(Index.begin(), Index.end(), [](const RecordIndexElement , const RecordIndexElement ) { return Lhs.Name < Rhs.Name; }); @@ -1212,7 +1212,7 @@ Records.getAllDerivedDefinitions("Diagnostic"); std::vector DiagGroups = Records.getAllDerivedDefinitions("DiagGroup"); - std::sort(DiagGroups.begin(), DiagGroups.end(), diagGroupBeforeByName); + llvm::sort(DiagGroups.begin(), DiagGroups.end(), diagGroupBeforeByName); DiagGroupParentMap DGParentMap(Records); @@ -1231,9 +1231,9 @@