[Mlir-commits] [mlir] [mlir][OpFormatGen][NFC] Initialize C-style arrays upon creation (PR #85631)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Mar 18 04:30:22 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Andrei Golubev (andrey-golubev)
<details>
<summary>Changes</summary>
Static analysis would warn about uninitialized fixed-size arrays in tablegen-generated code.
---
Full diff: https://github.com/llvm/llvm-project/pull/85631.diff
1 Files Affected:
- (modified) mlir/tools/mlir-tblgen/OpFormatGen.cpp (+2-2)
``````````diff
diff --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
index 1ffac059f19815..4c96b72f305808 100644
--- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -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);";
}
@@ -879,7 +879,7 @@ static void genElementParserStorage(FormatElement *element, const Operator &op,
if (lengthKind != ArgumentLengthKind::Single)
body << " ::llvm::SmallVector<::mlir::Type, 1> " << name << "Types;\n";
else
- body << llvm::formatv(" ::mlir::Type {0}RawTypes[1];\n", name)
+ body << llvm::formatv(" ::mlir::Type {0}RawTypes[1] = {{};\n", name)
<< llvm::formatv(
" ::llvm::ArrayRef<::mlir::Type> {0}Types({0}RawTypes);\n",
name);
``````````
</details>
https://github.com/llvm/llvm-project/pull/85631
More information about the Mlir-commits
mailing list