[PATCH] D113477: [clang-tblgen] Fix non-determinism in generating AttributeReference.rst
Igor Kudrin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 9 03:24:15 PST 2021
ikudrin created this revision.
ikudrin added reviewers: aaron.ballman, arphaman, rsmith.
ikudrin added a project: clang.
Herald added a subscriber: mgrang.
ikudrin requested review of this revision.
As for now, the categories are printed in an arbitrary order which depends on the addresses of dynamically allocated objects. The patch sorts them in an alphabetical order thus making the output stable.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D113477
Files:
clang/utils/TableGen/ClangAttrEmitter.cpp
Index: clang/utils/TableGen/ClangAttrEmitter.cpp
===================================================================
--- clang/utils/TableGen/ClangAttrEmitter.cpp
+++ clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -4433,7 +4433,13 @@
// Gather the Documentation lists from each of the attributes, based on the
// category provided.
std::vector<Record *> Attrs = Records.getAllDerivedDefinitions("Attr");
- std::map<const Record *, std::vector<DocumentationData>> SplitDocs;
+ struct CategoryLess {
+ bool operator()(const Record *L, const Record *R) const {
+ return L->getValueAsString("Name") < R->getValueAsString("Name");
+ }
+ };
+ std::map<const Record *, std::vector<DocumentationData>, CategoryLess>
+ SplitDocs;
for (const auto *A : Attrs) {
const Record &Attr = *A;
std::vector<Record *> Docs = Attr.getValueAsListOfDefs("Documentation");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113477.385755.patch
Type: text/x-patch
Size: 889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211109/0f4eaedd/attachment.bin>
More information about the cfe-commits
mailing list