[Mlir-commits] [mlir] [MLIR][Python] add type hints for accessors (PR #158455)

Maksim Levental llvmlistbot at llvm.org
Wed Sep 17 11:18:43 PDT 2025


================
@@ -449,6 +486,72 @@ static void emitResultAccessors(const Operator &op, raw_ostream &os) {
                        getNumResults(op), getResult);
 }
 
+static std::string getPythonAttrName(mlir::tblgen::Attribute attr) {
+  auto storageTypeStr = attr.getStorageType();
----------------
makslevental wrote:

meaning specify a mapping using tablgen hmm. okay I guess that's feasible - something like

```
class PythonBindingTypeHint<Type mlirType, string pythonType>...
def YourDownstreamPythonHint<YourDownstreamType, "your.downstream.type.hint">
```

I can do that in a follow-up - for right now let's just fix these for upstream attrs.

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


More information about the Mlir-commits mailing list