[clang-tools-extra] [clang-tidy] Make `P +- BS / sizeof(*P)` opt-outable in `bugprone-sizeof-expression` (PR #111178)

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 11 13:09:15 PDT 2024


================
@@ -221,6 +221,17 @@ and the result is typically unintended, often out of bounds.
 ``Ptr + sizeof(T)`` will offset the pointer by ``sizeof(T)`` elements,
 effectively exponentiating the scaling factor to the power of 2.
 
+Similarly, multiplying or dividing a numeric value with the ``sizeof`` an
+element or the whole buffer is suspicious, because the dimensional connection
----------------
5chmidti wrote:

> the ``sizeof`` of an element

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


More information about the cfe-commits mailing list