[Mlir-commits] [mlir] [mlir][OpFormatGen][NFC] Initialize C-style arrays upon creation (PR #85631)

Andrei Golubev llvmlistbot at llvm.org
Wed Mar 20 01:49:04 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:

I don't think so: the `[0]` is not incidental there. It could also be `[1]`? [this line](https://github.com/llvm/llvm-project/pull/85631/files#diff-c15a25fdac9b602ad4f97cbd475fdb4b78e7a4b3ab741886c9dec51a78f05359R838) would break if we change the parse() generator I guess. or do you mean to have an extra branch there to handle the difference?

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


More information about the Mlir-commits mailing list