[llvm] [TableGen] Rework error reporting for duplicate Feature/Processor. (PR #102257)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 6 21:01:09 PDT 2024
================
@@ -2290,3 +2283,24 @@ void PredTransitions::dump() const {
}
}
#endif // NDEBUG
+
+/// Verifies that there are no duplicate records with the same "Name" field.
+/// If there are, reports a fatal error message (and exits). Assumes that
+/// Records are sorted on the "Name" field.
+void llvm::checkDuplicateRecords(ArrayRef<Record *> Records,
+ StringRef ObjectName) {
+ auto I = std::adjacent_find(Records.begin(), Records.end(),
----------------
s-barannikov wrote:
It may make sense to assert that Records are sorted.
`assert(llvm::is_sorted(Records, lambda)`
Alternatively, llvm::sort could be moved here and the function could be renamed to `sortAndReportDuplicates` or something.
https://github.com/llvm/llvm-project/pull/102257
More information about the llvm-commits
mailing list