[llvm-branch-commits] [clang] [llvm] [mlir] TableGen: Store classes and defs in a StringMap (PR #231573)
Rahul Joshi via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Oct 13 16:54:48 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) {
----------------
jurahul wrote:
nit: should this use LessRecord()?
https://github.com/llvm/llvm-project/pull/231573
More information about the llvm-branch-commits
mailing list