[Mlir-commits] [llvm] [mlir] [MLIR] convert OpAsmDialectInterface using ODS (PR #171488)

Jacques Pienaar llvmlistbot at llvm.org
Wed Dec 17 21:21:49 PST 2025


================
@@ -59,7 +59,48 @@ def WithDefaultMethodInterface : DialectInterface<"WithDefaultMethodInterface">
   ];
 }
 
-// DECL:  virtual bool isExampleDialect() const {
-// DECL-NEXT:  return true;
-// DECL-NEXT: }
+// DECL:   virtual bool isExampleDialect() const {
+// DECL-NEXT:   return true;
+// DECL-NEXT:   }
+
+def PureVirtualInterface : DialectInterface<"PureVirtualInterface"> {
+  let description = [{
+    This is an example dialect interface with pure virtual methods.
+  }];
+
+  let cppNamespace = "::mlir::example";
+
+  let aliasDeclarations = [
+      AliasDeclaration<"FirstAlias", "unsigned">];
+
+  let methods = [
+      PureVirtualInterfaceMethod<
+      /*desc=*/        "Check if it's an example dialect",
+      /*returnType=*/  "bool",
+      /*methodName=*/  "isExampleDialect",
+      /*args=*/        (ins)
+      >,
+      InterfaceMethod<
+      /*desc=*/        "second method to check if multiple methods supported",
+      /*returnType=*/  "FirstAlias",
+      /*methodName=*/  "supportSecondMethod",
+      /*args=*/        (ins "::mlir::Type":$type)
+      >,
+      InterfaceMethodDeclaration<
+      /*desc=*/        "a method declaration",
+      /*returnType=*/  "::mlir::Type",
+      /*methodName=*/  "exampleMethodDeclaration",
+      /*args=*/        (ins "::mlir::Type":$type)
+      >
+  ];
----------------
jpienaar wrote:

Update formatting to be consistent with existing.

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


More information about the Mlir-commits mailing list