Improve error reporting on pass registration collision (NFC)

Differential Revision: https://reviews.llvm.org/D104430
This commit is contained in:
Mehdi Amini 2021-06-17 01:28:17 +00:00
parent 01cb9c5fc5
commit 6a071e535f
1 changed files with 5 additions and 4 deletions

View File

@ -116,10 +116,11 @@ void mlir::registerPass(StringRef arg, StringRef description,
// arg before it.
TypeID entryTypeID = function()->getTypeID();
auto it = passRegistryTypeIDs->try_emplace(arg, entryTypeID).first;
if (it->second != entryTypeID) {
llvm_unreachable("pass allocator creates a different pass than previously "
"registered");
}
if (it->second != entryTypeID)
llvm::report_fatal_error(
"pass allocator creates a different pass than previously "
"registered for pass " +
arg);
}
void mlir::registerPass(const PassAllocatorFunction &function) {