[PATCH] D116875: [clang-tidy] Add performance-inefficient-array-traversal check

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 8 21:43:56 PST 2022


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/performance/InefficientArrayTraversalCheck.cpp:59
+                 // TODO: Add support for x [+-]= 1 and x = x [+-] 1
+                 hasIncrement(unaryOperator(hasUnaryOperand(ToDecl),
+                                            hasAnyOperatorName("++", "--"))),
----------------
I think will be reasonable to check for `+=` and `-=`.


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:117
+
+  Detects nested for loops used to traverse a 2D array where the row index is
+  iterated on the inner loop.
----------------
Please highlight `for` with double back-ticks. Same in documentation.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/performance-inefficient-array-traversal.rst:15
+
+
+This array access pattern results in nonsequential data access which is cache 
----------------
Excessive newline.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/performance-inefficient-array-traversal.rst:26
+       Array[Y][X]++;
+
----------------
Excessive newline.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116875



More information about the cfe-commits mailing list