[clang-tools-extra] [clang-tidy] Add new `bugprone-suspicious-pointer-arithmetics-using-sizeof` (`cert-arr39-c`) check (PR #106061)

Nicolas van Kempen via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 27 14:35:20 PDT 2024


https://github.com/nicovank commented:

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 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?

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


More information about the cfe-commits mailing list