[Mlir-commits] [mlir] [mlir][python] Avoid needless std::string copies in properties. NFC. (PR #186190)

Maksim Levental llvmlistbot at llvm.org
Thu Mar 12 11:46:13 PDT 2026


================
@@ -128,14 +128,13 @@ struct StructType : PyConcreteType<StructType> {
         "name"_a, "elements"_a, nb::kw_only(), "packed"_a = false,
         "context"_a = nb::none());
 
-    c.def_prop_ro(
-        "name", [](const StructType &type) -> std::optional<std::string> {
-          if (mlirLLVMStructTypeIsLiteral(type))
-            return std::nullopt;
-
-          MlirStringRef stringRef = mlirLLVMStructTypeGetIdentifier(type);
-          return std::string(stringRef.data, stringRef.length);
-        });
+    c.def_prop_ro("name",
+                  [](const StructType &type) -> std::optional<MlirStringRef> {
----------------
makslevental wrote:

ah you're - ok kicking this can down the road (for when we turn on stubs for the dialects) is fine :)

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


More information about the Mlir-commits mailing list