Verify that ModuleOps only contain dialect specific attributes.
ModuleOp has no expected operations, so only dialect-specific attributes are valid. PiperOrigin-RevId: 269020062
This commit is contained in:
parent
4951f6fd7d
commit
a47914d89e
8
third_party/mlir/lib/IR/Module.cpp
vendored
8
third_party/mlir/lib/IR/Module.cpp
vendored
@ -80,6 +80,14 @@ LogicalResult ModuleOp::verify() {
|
|||||||
if (body->getNumArguments() != 0)
|
if (body->getNumArguments() != 0)
|
||||||
return emitOpError("expected body to have no arguments");
|
return emitOpError("expected body to have no arguments");
|
||||||
|
|
||||||
|
// Check that none of the attributes are non-dialect attributes.
|
||||||
|
for (auto attr : getOperation()->getAttrList().getAttrs()) {
|
||||||
|
if (!attr.first.strref().contains('.'))
|
||||||
|
return emitOpError(
|
||||||
|
"can only contain dialect-specific attributes, found: 1")
|
||||||
|
<< attr.first << "'";
|
||||||
|
}
|
||||||
|
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user