[PATCH] D61422: [clang-tidy] Extend bugprone-sizeof-expression check to detect sizeof misuse in pointer arithmetic

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 2 09:31:17 PDT 2019


aaron.ballman added a comment.

Out of curiosity, have you run this over any large code bases to see what the false positive and true positive rate is?



================
Comment at: clang-tidy/bugprone/SizeofExpressionCheck.cpp:217
+  // Detect sizeof in pointer aritmetic like: N * sizeof(S) == P1 - P2 or
+  // (P1 - P2) / sizeof(S) where P1 and P2 are pointers to type S
+  const auto PtrDiffExpr = binaryOperator(
----------------
Missing full stop at the end of the comment.


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

https://reviews.llvm.org/D61422





More information about the cfe-commits mailing list