[Mlir-commits] [mlir] [MLIR][Python] add type hints for accessors (PR #158455)
Jacques Pienaar
llvmlistbot at llvm.org
Wed Sep 17 02:48:49 PDT 2025
================
@@ -413,13 +440,23 @@ static void emitElementAccessors(
if (element.name.empty())
continue;
std::string trailing;
- if (!element.isVariableLength())
- trailing = "[0]";
- else if (element.isOptional())
- trailing = std::string(
- formatv(opVariadicSegmentOptionalTrailingTemplate, kind));
+ std::string type = std::strcmp(kind, "operand") == 0
+ ? "_ods_ir.OpOperandList"
+ : "_ods_ir.OpResultList";
+ if (!element.isVariableLength() || element.isOptional()) {
+ type = std::strcmp(kind, "operand") == 0 ? "_ods_ir.Value"
----------------
jpienaar wrote:
Is _ods_ir etc always sufficient? (was thinking how C++ side we end up doing `::mlir::` to ensure namespace, and not sure if we could run into naming conflicts here - that being said `_ods_ir` should have very low overlap chance coincidentally)
https://github.com/llvm/llvm-project/pull/158455
More information about the Mlir-commits
mailing list