[Mlir-commits] [mlir] 310736e - [mlir] fix region property generation in python bindings

Alex Zinenko llvmlistbot at llvm.org
Wed Oct 20 10:01:06 PDT 2021


Author: Alex Zinenko
Date: 2021-10-20T19:00:59+02:00
New Revision: 310736e098f874bb324d1b96d62682e9fb005015

URL: https://github.com/llvm/llvm-project/commit/310736e098f874bb324d1b96d62682e9fb005015
DIFF: https://github.com/llvm/llvm-project/commit/310736e098f874bb324d1b96d62682e9fb005015.diff

LOG: [mlir] fix region property generation in python bindings

Added: 
    

Modified: 
    mlir/test/mlir-tblgen/op-python-bindings.td
    mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/test/mlir-tblgen/op-python-bindings.td b/mlir/test/mlir-tblgen/op-python-bindings.td
index 9355fc4aeb3ab..b5c824e662995 100644
--- a/mlir/test/mlir-tblgen/op-python-bindings.td
+++ b/mlir/test/mlir-tblgen/op-python-bindings.td
@@ -405,11 +405,11 @@ def VariadicAndNormalRegionOp : TestOp<"variadic_and_normal_region"> {
   let regions = (region AnyRegion:$region, AnyRegion, VariadicRegion<AnyRegion>:$variadic);
 
   // CHECK:  @builtins.property
-  // CHECK:  def region():
+  // CHECK:  def region(self):
   // CHECK:    return self.regions[0]
 
   // CHECK:  @builtins.property
-  // CHECK:  def variadic():
+  // CHECK:  def variadic(self):
   // CHECK:    return self.regions[2:]
 }
 
@@ -429,7 +429,7 @@ def VariadicRegionOp : TestOp<"variadic_region"> {
   let regions = (region VariadicRegion<AnyRegion>:$Variadic);
 
   // CHECK:  @builtins.property
-  // CHECK:  def Variadic():
+  // CHECK:  def Variadic(self):
   // CHECK:    return self.regions[0:]
 }
 

diff  --git a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
index 039827ecf0839..f55f0508a58be 100644
--- a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
@@ -254,7 +254,7 @@ constexpr const char *attributeDeleterTemplate = R"Py(
 
 constexpr const char *regionAccessorTemplate = R"PY(
   @builtins.property
-  def {0}():
+  def {0}(self):
     return self.regions[{1}]
 )PY";
 


        


More information about the Mlir-commits mailing list