[Mlir-commits] [mlir] [MLIR][TableGen] Warn on APInt parameter without custom comparator (PR #135970)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Apr 16 07:32:45 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- mlir/include/mlir/TableGen/AttrOrTypeDef.h mlir/lib/Dialect/SMT/IR/SMTAttributes.cpp mlir/lib/TableGen/AttrOrTypeDef.cpp mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
index 4b0a72ec6..c34cbfe47 100644
--- a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
+++ b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
@@ -679,16 +679,15 @@ void DefGen::emitStorageClass() {
// Emit the storage class members as public, at the very end of the struct.
storageCls->finalize();
for (auto ¶m : params) {
- if (param.getCppType().contains("APInt") &&
- !param.hasCustomComparator()) {
- PrintWarning(
- def.getLoc(),
- "Using a raw APInt parameter without a custom comparator is "
- "discouraged because an assert in the equality operator is "
- "triggered when the two APInts have different bit widths. This can "
- "lead to unexpected crashes. Consider using an `APIntParameter` or "
- "providing a custom comparator.");
- }
+ if (param.getCppType().contains("APInt") && !param.hasCustomComparator()) {
+ PrintWarning(
+ def.getLoc(),
+ "Using a raw APInt parameter without a custom comparator is "
+ "discouraged because an assert in the equality operator is "
+ "triggered when the two APInts have different bit widths. This can "
+ "lead to unexpected crashes. Consider using an `APIntParameter` or "
+ "providing a custom comparator.");
+ }
storageCls->declare<Field>(param.getCppType(), param.getName());
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/135970
More information about the Mlir-commits
mailing list