[llvm-branch-commits] [clang] [llvm] [mlir] TableGen: Store classes and defs in a StringMap (PR #231573)
Pablo Reble via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Oct 14 13:46:23 PDT 2026
================
@@ -3188,10 +3188,35 @@ RecordKeeper::getAllDerivedDefinitions(StringRef ClassName) const {
return Iter->second;
}
+// Return the records in Map sorted by name. Records are never removed, so
+// Sorted is out of date if its size differs.
+static ArrayRef<const Record *>
+getSortedRecords(const StringMap<std::unique_ptr<Record>> &Map,
+ std::vector<const Record *> &Sorted) {
+ if (Sorted.size() != Map.size()) {
+ Sorted.clear();
+ Sorted.reserve(Map.size());
+ for (const auto &Entry : Map)
+ Sorted.push_back(Entry.second.get());
+ llvm::sort(Sorted, [](const Record *LHS, const Record *RHS) {
----------------
reble wrote:
`LessRecord` would change the order here. Plain `<` keeps this NFC, ... maybe worth a comment saying so.
https://github.com/llvm/llvm-project/pull/231573
More information about the llvm-branch-commits
mailing list