[clang-tools-extra] [Clang-Tidy] Improve `bugprone-implicit-widening-of-multiplication-result`. (PR #214501)
Zeyi Xu via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 27 00:00:36 PDT 2026
================
@@ -1,15 +1,29 @@
-// RUN: %check_clang_tidy -std=c99 %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c
-// RUN: %check_clang_tidy %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c++
+// RUN: %check_clang_tidy -check-suffixes=ALL,C -std=c99 %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c
+// RUN: %check_clang_tidy -check-suffixes=ALL,CXX %s bugprone-implicit-widening-of-multiplication-result %t -- -- -target x86_64-unknown-unknown -x c++
long t0(short a, int b) {
return a * b;
- // CHECK-NOTES: :[[@LINE-1]]:10: warning: performing an implicit widening conversion to type 'long' of a multiplication performed in type 'int'
----------------
zeyi2 wrote:
Could you also add a new test case like:
```c
long f(unsigned short a, unsigned short b) {
return a * b;
}
```
This would check the `Ty->isSignedIntegerType()` branch.
https://github.com/llvm/llvm-project/pull/214501
More information about the cfe-commits
mailing list