[clang-tools-extra] [clang-tidy] Add WarnOnSizeOfPointer mode to bugprone-sizeof-expression (PR #94356)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 07:24:46 PDT 2024


================
@@ -190,6 +190,15 @@ Options
 
 .. option:: WarnOnSizeOfPointerToAggregate
 
-   When `true`, the check will warn on an expression like
-   ``sizeof(expr)`` where the expression is a pointer
-   to aggregate. Default is `true`.
+   When `true`, the check will warn when the argument of ``sizeof`` is either a
+   pointer-to-aggregate type, an expression returning a pointer-to-aggregate
+   value or an expression that returns a pointer from an array-to-pointer
+   conversion (that may be implicit or explicit, for example ``array + 2`` or
+   ``(int *)array``). Default is `true`.
----------------
NagyDonat wrote:

I also added a proper description for `WarnOnSizeOfPointerToAggregate`, because the old one was very vague and didn't explain the (somewhat complex) effects that are handled here.

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


More information about the cfe-commits mailing list