[Mlir-commits] [mlir] [mlir][OpFormatGen][NFC] Initialize C-style arrays upon creation (PR #85631)
Andrei Golubev
llvmlistbot at llvm.org
Wed Mar 20 01:55:45 PDT 2024
================
@@ -842,7 +842,7 @@ static void genElementParserStorage(FormatElement *element, const Operator &op,
}
} else {
body << " ::mlir::OpAsmParser::UnresolvedOperand " << name
- << "RawOperands[1];\n"
+ << "RawOperands[1] = {};\n"
<< " ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> "
<< name << "Operands(" << name << "RawOperands);";
----------------
andrey-golubev wrote:
my guess on this, given the error, is: the original author wanted to have the 1-vs-many case being handled in a single place (that I modify here). then, all the other places working with `*RawOperands` / `*RawTypes` won't need any special treatment of "single element" and can just use `.size()` of some generation-time variable to produce correct C++. and this is why it's an array of 1 element instead of an object?
https://github.com/llvm/llvm-project/pull/85631
More information about the Mlir-commits
mailing list