[Mlir-commits] [mlir] [MLIR][Python] Add docstring for generated python op classes (PR #158198)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Sep 11 22:55:08 PDT 2025
================
@@ -1034,9 +1036,31 @@ static void emitValueBuilder(const Operator &op,
}
}
+/// Retrieve the description of the given op and generate a docstring for it.
+static std::string makeDocStringForOp(const Operator &op) {
+ if (!op.hasDescription())
+ return "";
+
+ auto desc = op.getDescription().rtrim(" \t").str();
+ // Replace all """ with \"\"\" to avoid early termination of the literal.
+ desc = llvm::join(llvm::split(desc, R"(""")"), R"(\"\"\")");
----------------
PragmaTwice wrote:
Just wanna utilize something inside llvm but now I find that this is not semantically equal to a `replace`. Fixed : )
https://github.com/llvm/llvm-project/pull/158198
More information about the Mlir-commits
mailing list