whisperity wrote: @nicovank > Add check and alias entries to > [clang-tools-extra/docs/clang-tidy/checks/list.rst](https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/docs/clang-tidy/checks/list.rst). > > Check name: this is not only sizeof. Maybe > `bugprone-suspicious-pointer-scaling-arithmetic`? Others may have other ideas.
The new check will be dropped and instead the functionality is going to be integrated into **ˋbugprone-sizeof-expressionˋ**, which already checks a lot more other cases and then some, related to pointer arithmetics as well. The check's name would have been fine as-is now (and making it part of _ˋbugprone-sizeof-expressionˋ_ will be fine as well), because the vast majority of cases will have ˋsizeofˋ as the issue, and both ˋalignof()ˋ and ˋoffsetof()ˋ essentially scaled **with** ˋsizeofˋ internally, **AND** lets the user commit to the same bogus pattern by doing another scaling with the ˋ+ˋ/ˋ-ˋ operator. @nicovank > The two examples in the check documentation would not be matched with the > current version of this check as they mutiply the `sizeof` expression with a > constant before addition. I feel like this is also a common pattern. Can this > check also catch those? Yes, I have already added some deliberately failing tests for these last night, and I am engineering the appropriate matchers for this. https://github.com/llvm/llvm-project/pull/106061 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits