[clang-tidy] Improving bugprone-sizeof-expr check.
authorBalázs Kéri <1.int32@gmail.com>
Thu, 19 Nov 2020 08:03:22 +0000 (09:03 +0100)
committerBalázs Kéri <1.int32@gmail.com>
Thu, 19 Nov 2020 09:26:33 +0000 (10:26 +0100)
commit47518d6a0aed7ec3607aeacfa511dedda2cd67cb
tree4cd1c128f620a78922fcdbf6c7b481348ff29cb0
parent58ce4a8b1190f2ccc584140ca7fd1a6391846f3d
[clang-tidy] Improving bugprone-sizeof-expr check.

Do not warn for "pointer to aggregate" in a `sizeof(A) / sizeof(A[0])`
expression if `A` is an array of pointers. This is the usual way of
calculating the array length even if the array is of pointers.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D91543
clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
clang-tools-extra/test/clang-tidy/checkers/bugprone-sizeof-expression.cpp