@@ -116,7 +116,8 @@ mlirApiObjectToCapsule(nanobind::handle apiObject) {
116116// / Casts object <-> MlirAffineMap.
117117template <>
118118struct type_caster <MlirAffineMap> {
119- NB_TYPE_CASTER (MlirAffineMap, const_name(" MlirAffineMap" ))
119+ NB_TYPE_CASTER (MlirAffineMap,
120+ const_name (MAKE_MLIR_PYTHON_QUALNAME(" ir.AffineMap" )))
120121 bool from_python(handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
121122 if (auto capsule = mlirApiObjectToCapsule (src)) {
122123 value = mlirPythonCapsuleToAffineMap (capsule->ptr ());
@@ -138,7 +139,8 @@ struct type_caster<MlirAffineMap> {
138139// / Casts object <-> MlirAttribute.
139140template <>
140141struct type_caster <MlirAttribute> {
141- NB_TYPE_CASTER (MlirAttribute, const_name(" MlirAttribute" ))
142+ NB_TYPE_CASTER (MlirAttribute,
143+ const_name (MAKE_MLIR_PYTHON_QUALNAME(" ir.Attribute" )))
142144 bool from_python(handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
143145 if (auto capsule = mlirApiObjectToCapsule (src)) {
144146 value = mlirPythonCapsuleToAttribute (capsule->ptr ());
@@ -161,7 +163,7 @@ struct type_caster<MlirAttribute> {
161163// / Casts object -> MlirBlock.
162164template <>
163165struct type_caster <MlirBlock> {
164- NB_TYPE_CASTER (MlirBlock, const_name(" MlirBlock " ))
166+ NB_TYPE_CASTER (MlirBlock, const_name(MAKE_MLIR_PYTHON_QUALNAME( " ir.Block " ) ))
165167 bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
166168 if (auto capsule = mlirApiObjectToCapsule (src)) {
167169 value = mlirPythonCapsuleToBlock (capsule->ptr ());
@@ -174,7 +176,8 @@ struct type_caster<MlirBlock> {
174176// / Casts object -> MlirContext.
175177template <>
176178struct type_caster <MlirContext> {
177- NB_TYPE_CASTER (MlirContext, const_name(" MlirContext" ))
179+ NB_TYPE_CASTER (MlirContext,
180+ const_name (MAKE_MLIR_PYTHON_QUALNAME(" ir.Context" )))
178181 bool from_python(handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
179182 if (src.is_none ()) {
180183 // Gets the current thread-bound context.
@@ -192,7 +195,8 @@ struct type_caster<MlirContext> {
192195// / Casts object <-> MlirDialectRegistry.
193196template <>
194197struct type_caster <MlirDialectRegistry> {
195- NB_TYPE_CASTER (MlirDialectRegistry, const_name(" MlirDialectRegistry" ))
198+ NB_TYPE_CASTER (MlirDialectRegistry,
199+ const_name (MAKE_MLIR_PYTHON_QUALNAME(" ir.DialectRegistry" )))
196200 bool from_python(handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
197201 if (auto capsule = mlirApiObjectToCapsule (src)) {
198202 value = mlirPythonCapsuleToDialectRegistry (capsule->ptr ());
@@ -214,7 +218,8 @@ struct type_caster<MlirDialectRegistry> {
214218// / Casts object <-> MlirLocation.
215219template <>
216220struct type_caster <MlirLocation> {
217- NB_TYPE_CASTER (MlirLocation, const_name(" MlirLocation" ))
221+ NB_TYPE_CASTER (MlirLocation,
222+ const_name (MAKE_MLIR_PYTHON_QUALNAME(" ir.Location" )))
218223 bool from_python(handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
219224 if (src.is_none ()) {
220225 // Gets the current thread-bound context.
@@ -240,7 +245,7 @@ struct type_caster<MlirLocation> {
240245// / Casts object <-> MlirModule.
241246template <>
242247struct type_caster <MlirModule> {
243- NB_TYPE_CASTER (MlirModule, const_name(" MlirModule " ))
248+ NB_TYPE_CASTER (MlirModule, const_name(MAKE_MLIR_PYTHON_QUALNAME( " ir.Module " ) ))
244249 bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
245250 if (auto capsule = mlirApiObjectToCapsule (src)) {
246251 value = mlirPythonCapsuleToModule (capsule->ptr ());
@@ -262,8 +267,9 @@ struct type_caster<MlirModule> {
262267// / Casts object <-> MlirFrozenRewritePatternSet.
263268template <>
264269struct type_caster <MlirFrozenRewritePatternSet> {
265- NB_TYPE_CASTER (MlirFrozenRewritePatternSet,
266- const_name (" MlirFrozenRewritePatternSet" ))
270+ NB_TYPE_CASTER (
271+ MlirFrozenRewritePatternSet,
272+ const_name (MAKE_MLIR_PYTHON_QUALNAME(" rewrite.FrozenRewritePatternSet" )))
267273 bool from_python(handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
268274 if (auto capsule = mlirApiObjectToCapsule (src)) {
269275 value = mlirPythonCapsuleToFrozenRewritePatternSet (capsule->ptr ());
@@ -285,7 +291,8 @@ struct type_caster<MlirFrozenRewritePatternSet> {
285291// / Casts object <-> MlirOperation.
286292template <>
287293struct type_caster <MlirOperation> {
288- NB_TYPE_CASTER (MlirOperation, const_name(" MlirOperation" ))
294+ NB_TYPE_CASTER (MlirOperation,
295+ const_name (MAKE_MLIR_PYTHON_QUALNAME(" ir.Operation" )))
289296 bool from_python(handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
290297 if (auto capsule = mlirApiObjectToCapsule (src)) {
291298 value = mlirPythonCapsuleToOperation (capsule->ptr ());
@@ -309,7 +316,7 @@ struct type_caster<MlirOperation> {
309316// / Casts object <-> MlirValue.
310317template <>
311318struct type_caster <MlirValue> {
312- NB_TYPE_CASTER (MlirValue, const_name(" MlirValue " ))
319+ NB_TYPE_CASTER (MlirValue, const_name(MAKE_MLIR_PYTHON_QUALNAME( " ir.Value " ) ))
313320 bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
314321 if (auto capsule = mlirApiObjectToCapsule (src)) {
315322 value = mlirPythonCapsuleToValue (capsule->ptr ());
@@ -334,7 +341,8 @@ struct type_caster<MlirValue> {
334341// / Casts object -> MlirPassManager.
335342template <>
336343struct type_caster <MlirPassManager> {
337- NB_TYPE_CASTER (MlirPassManager, const_name(" MlirPassManager" ))
344+ NB_TYPE_CASTER (MlirPassManager, const_name(MAKE_MLIR_PYTHON_QUALNAME(
345+ " passmanager.PassManager" )))
338346 bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
339347 if (auto capsule = mlirApiObjectToCapsule (src)) {
340348 value = mlirPythonCapsuleToPassManager (capsule->ptr ());
@@ -347,7 +355,7 @@ struct type_caster<MlirPassManager> {
347355// / Casts object <-> MlirTypeID.
348356template <>
349357struct type_caster <MlirTypeID> {
350- NB_TYPE_CASTER (MlirTypeID, const_name(" MlirTypeID " ))
358+ NB_TYPE_CASTER (MlirTypeID, const_name(MAKE_MLIR_PYTHON_QUALNAME( " ir.TypeID " ) ))
351359 bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
352360 if (auto capsule = mlirApiObjectToCapsule (src)) {
353361 value = mlirPythonCapsuleToTypeID (capsule->ptr ());
@@ -371,7 +379,7 @@ struct type_caster<MlirTypeID> {
371379// / Casts object <-> MlirType.
372380template <>
373381struct type_caster <MlirType> {
374- NB_TYPE_CASTER (MlirType, const_name(" MlirType " ))
382+ NB_TYPE_CASTER (MlirType, const_name(MAKE_MLIR_PYTHON_QUALNAME( " ir.Type " ) ))
375383 bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
376384 if (auto capsule = mlirApiObjectToCapsule (src)) {
377385 value = mlirPythonCapsuleToType (capsule->ptr ());
@@ -394,7 +402,7 @@ struct type_caster<MlirType> {
394402// / Casts MlirStringRef -> object.
395403template <>
396404struct type_caster <MlirStringRef> {
397- NB_TYPE_CASTER (MlirStringRef, const_name(" MlirStringRef " ))
405+ NB_TYPE_CASTER (MlirStringRef, const_name(" str " ))
398406 static handle from_cpp (MlirStringRef s, rv_policy,
399407 cleanup_list *cleanup) noexcept {
400408 return nanobind::str (s.data , s.length ).release ();
0 commit comments