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");
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");
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits