diff options
author | Mandeep Singh Grang <mgrang@codeaurora.org> | 2018-03-27 16:50:00 +0000 |
---|---|---|
committer | Mandeep Singh Grang <mgrang@codeaurora.org> | 2018-03-27 16:50:00 +0000 |
commit | a4c6f25016d2f227e027418a09ad57ca97dafccc (patch) | |
tree | e3afc88fd2ad716db92dba8bab46fa38b01a20bb /utils | |
parent | e37a191e99773959118155304ec2ed0bc0d591c2 (diff) |
[clang] Change std::sort to llvm::sort in response to r327219
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328636 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/ClangAttrEmitter.cpp | 6 | ||||
-rw-r--r-- | utils/TableGen/ClangDiagnosticsEmitter.cpp | 23 | ||||
-rw-r--r-- | utils/TableGen/ClangOptionDocEmitter.cpp | 6 | ||||
-rw-r--r-- | utils/TableGen/NeonEmitter.cpp | 2 |
4 files changed, 19 insertions, 18 deletions
diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp index 4f4f94bf37..0f8bb18f39 100644 --- a/utils/TableGen/ClangAttrEmitter.cpp +++ b/utils/TableGen/ClangAttrEmitter.cpp @@ -3908,9 +3908,9 @@ void EmitClangAttrDocs(RecordKeeper &Records, raw_ostream &OS) { for (auto &I : SplitDocs) { WriteCategoryHeader(I.first, OS); - std::sort(I.second.begin(), I.second.end(), - [](const DocumentationData &D1, const DocumentationData &D2) { - return D1.Heading < D2.Heading; + llvm::sort(I.second.begin(), I.second.end(), + [](const DocumentationData &D1, const DocumentationData &D2) { + return D1.Heading < D2.Heading; }); // Walk over each of the attributes in the category and write out their diff --git a/utils/TableGen/ClangDiagnosticsEmitter.cpp b/utils/TableGen/ClangDiagnosticsEmitter.cpp index 4a2516ff94..a8a56df75e 100644 --- a/utils/TableGen/ClangDiagnosticsEmitter.cpp +++ b/utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -207,9 +207,9 @@ static void groupDiagnostics(const std::vector<Record*> &Diags, E = SortedGroups.end(); I != E; ++I) { MutableArrayRef<const Record *> 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<GroupInfo *>::const_iterator I = SortedGroups.begin(), @@ -863,9 +863,10 @@ void EmitClangDiagsIndexName(RecordKeeper &Records, raw_ostream &OS) { Index.push_back(RecordIndexElement(R)); } - std::sort(Index.begin(), Index.end(), - [](const RecordIndexElement &Lhs, - const RecordIndexElement &Rhs) { return Lhs.Name < Rhs.Name; }); + llvm::sort(Index.begin(), Index.end(), + [](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]; @@ -1212,7 +1213,7 @@ void EmitClangDiagDocs(RecordKeeper &Records, raw_ostream &OS) { Records.getAllDerivedDefinitions("Diagnostic"); std::vector<Record*> 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 @@ void EmitClangDiagDocs(RecordKeeper &Records, raw_ostream &OS) { DiagsInPedanticSet.end()); RecordVec GroupsInPedantic(GroupsInPedanticSet.begin(), GroupsInPedanticSet.end()); - std::sort(DiagsInPedantic.begin(), DiagsInPedantic.end(), - beforeThanCompare); - std::sort(GroupsInPedantic.begin(), GroupsInPedantic.end(), - beforeThanCompare); + llvm::sort(DiagsInPedantic.begin(), DiagsInPedantic.end(), + beforeThanCompare); + llvm::sort(GroupsInPedantic.begin(), GroupsInPedantic.end(), + beforeThanCompare); PedDiags.DiagsInGroup.insert(PedDiags.DiagsInGroup.end(), DiagsInPedantic.begin(), DiagsInPedantic.end()); @@ -1283,7 +1284,7 @@ void EmitClangDiagDocs(RecordKeeper &Records, raw_ostream &OS) { OS << "Also controls "; bool First = true; - std::sort(GroupInfo.SubGroups.begin(), GroupInfo.SubGroups.end()); + llvm::sort(GroupInfo.SubGroups.begin(), GroupInfo.SubGroups.end()); for (const auto &Name : GroupInfo.SubGroups) { if (!First) OS << ", "; OS << "`" << (IsRemarkGroup ? "-R" : "-W") << Name << "`_"; diff --git a/utils/TableGen/ClangOptionDocEmitter.cpp b/utils/TableGen/ClangOptionDocEmitter.cpp index 734ff0bfd8..7fe487e546 100644 --- a/utils/TableGen/ClangOptionDocEmitter.cpp +++ b/utils/TableGen/ClangOptionDocEmitter.cpp @@ -111,7 +111,7 @@ Documentation extractDocumentation(RecordKeeper &Records) { auto DocumentationForOption = [&](Record *R) -> DocumentedOption { auto &A = Aliases[R]; - std::sort(A.begin(), A.end(), CompareByName); + llvm::sort(A.begin(), A.end(), CompareByName); return {R, std::move(A)}; }; @@ -120,7 +120,7 @@ Documentation extractDocumentation(RecordKeeper &Records) { Documentation D; auto &Groups = 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; @@ -129,7 +129,7 @@ Documentation extractDocumentation(RecordKeeper &Records) { } auto &Options = 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)); diff --git a/utils/TableGen/NeonEmitter.cpp b/utils/TableGen/NeonEmitter.cpp index 1a95ca4c66..b9f022492e 100644 --- a/utils/TableGen/NeonEmitter.cpp +++ b/utils/TableGen/NeonEmitter.cpp @@ -2007,7 +2007,7 @@ void NeonEmitter::createIntrinsic(Record *R, } } - std::sort(NewTypeSpecs.begin(), NewTypeSpecs.end()); + llvm::sort(NewTypeSpecs.begin(), NewTypeSpecs.end()); NewTypeSpecs.erase(std::unique(NewTypeSpecs.begin(), NewTypeSpecs.end()), NewTypeSpecs.end()); auto &Entry = IntrinsicMap[Name]; |