[PATCH] D91543: [clang-tidy] Improving bugprone-sizeof-expr check.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 18 08:39:29 PST 2020


aaron.ballman accepted this revision.
aaron.ballman added a comment.

LGTM!



================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone-sizeof-expression.cpp:317
+  sum = sizeof(PtrArray) / sizeof(PtrArray1[0]);
+  // There is no warning for 'sizeof(T*)/sizeof(Q)' case.
+  sum += sizeof(PtrArray) / sizeof(A[0]);
----------------
balazske wrote:
> aaron.ballman wrote:
> > Thanks for the new test case, can you also add one for `array[1]` (with the incorrect index) and add a FIXME to the comment so it's clear that we know we don't handle these cases currently but might like to someday?
> The test for `array[1]` is not the same that is inserted on line 245?
> 
Weirdly, I didn't see the test cases added around line 245 until this review. Huh, very odd -- but yes, that test covers it nicely.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91543/new/

https://reviews.llvm.org/D91543



More information about the cfe-commits mailing list