[PATCH] D141058: [clang-tidy] fix wrong fixup for bugprone-implicit-widening-of-multiplication-result

Fabian Keßler via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 11 19:46:21 PST 2023


Febbe added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone/implicit-widening-of-multiplication-result-array-subscript-expression.cpp:18
   // CHECK-NOTES-C:                    (ptrdiff_t)( )
   // CHECK-NOTES-CXX:                  static_cast<ptrdiff_t>( )
   // CHECK-NOTES-ALL: :[[@LINE-5]]:16: note: perform multiplication in a wider type
----------------
v1nh1shungry wrote:
> Actually I have tried adding
> 
> ```
> // CHECK-FIXES-C: return &base[(ptrdiff_t)(a * b)];
> // CHECK-FIXES-CXX: return &base[static_cast<ptrdiff_t>(a * b)];
> ```
> 
> under this line, but the test failed, and when I took a look at `build/tools/clang/tools/extra/test/clang-tidy/checkers/bugprone/Output/implicit-widening-of-multiplication-result-array-subscript-expression.cpp.tmp.cpp`, I found that these codes didn't get modified. And I took a look at other files which have `CHECK-FIXES` lines, I found the codes in the corresponding temporary files got fixed.
Maybe, because the Fixup is marked as Note


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141058/new/

https://reviews.llvm.org/D141058



More information about the cfe-commits mailing list