[Mlir-commits] [mlir] [MLIR][LLVMIR] Add module flags support (PR #130679)

Tobias Gysi llvmlistbot at llvm.org
Fri Mar 14 00:55:58 PDT 2025


================
@@ -3711,6 +3711,21 @@ LogicalResult LinkerOptionsOp::verify() {
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// ModuleFlagsOp
+//===----------------------------------------------------------------------===//
+
+LogicalResult ModuleFlagsOp::verify() {
+  if (Operation *parentOp = (*this)->getParentOp();
+      parentOp && !satisfiesLLVMModule(parentOp))
+    return emitOpError("must appear at the module level");
+  for (Attribute flag : getFlags()) {
+    if (!isa<ModuleFlagAttr>(flag))
+      return emitOpError("expected a module flag attribute");
+  }
----------------
gysit wrote:

```suggestion
  for (Attribute flag : getFlags())
    if (!isa<ModuleFlagAttr>(flag))
      return emitOpError("expected a module flag attribute");
```
nit: braces should dropped here.

https://github.com/llvm/llvm-project/pull/130679


More information about the Mlir-commits mailing list