File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -43,16 +43,23 @@ std::string mlir::tblgen::getParameterAccessorName(StringRef name) {
43
43
static void collectAllDefs (StringRef selectedDialect,
44
44
std::vector<llvm::Record *> records,
45
45
SmallVectorImpl<AttrOrTypeDef> &resultDefs) {
46
+ // Nothing to do if no defs were found.
47
+ if (records.empty ())
48
+ return ;
49
+
46
50
auto defs = llvm::map_range (
47
51
records, [&](const llvm::Record *rec) { return AttrOrTypeDef (rec); });
48
52
if (selectedDialect.empty ()) {
53
+ // If a dialect was not specified, ensure that all found defs belong to the
54
+ // same dialect.
49
55
if (!llvm::is_splat (
50
56
llvm::map_range (defs, [](auto def) { return def.getDialect (); }))) {
51
57
llvm::PrintFatalError (" defs belonging to more than one dialect. Must "
52
58
" select one via '--(attr|type)defs-dialect'" );
53
59
}
54
60
resultDefs.assign (defs.begin (), defs.end ());
55
61
} else {
62
+ // Otherwise, generate the defs that belong to the selected dialect.
56
63
auto dialectDefs = llvm::make_filter_range (defs, [&](auto def) {
57
64
return def.getDialect ().getName ().equals (selectedDialect);
58
65
});
You can’t perform that action at this time.
0 commit comments