[clang-tools-extra] [clang-tidy] bugprone-implicit-widening ignores const exprs that fit (PR #98352)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 10 11:12:05 PDT 2024


================
@@ -0,0 +1,81 @@
+// RUN: %check_clang_tidy -check-suffixes=ALL,NI %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c++
+// RUN: %check_clang_tidy -check-suffixes=ALL %s bugprone-implicit-widening-of-multiplication-result %t -- \
+// RUN:     -config='{CheckOptions: { \
+// RUN:         bugprone-implicit-widening-of-multiplication-result.IgnoreConstantIntExpr: true \
+// RUN:     }}' -- -target x86_64-unknown-unknown -x c++
+
+long t0() {
+  return 1 * 4;
+  // CHECK-NOTES-NI: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'long' of a multiplication performed in type 'int'
----------------
PiotrZSL wrote:

Generic: use CHECK-MESSAGES instead of CHECK-NOTES if you can

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


More information about the cfe-commits mailing list