[PATCH] D15030: [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-index

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 13:09:21 PST 2015


alexfh added a comment.

Sorry for the delay. Missed this patch somehow. A couple of comments in addition to what Aaron wrote.


================
Comment at: clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h:25
@@ +24,3 @@
+class ProBoundsConstantArrayIndexCheck : public ClangTidyCheck {
+  std::string GslHeader;
+  const IncludeSorter::IncludeStyle IncludeStyle;
----------------
This can be const.

================
Comment at: docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst:4
@@ +3,3 @@
+
+This check flags all array subscriptions on static arrays and std::arrays that either have a non-compile-time constant index or are out of bounds (for std::array).
+For out-of-bounds checking of static arrays, see the clang-diagnostic-array-bounds check.
----------------
aaron.ballman wrote:
> Instead of "array subscriptions" it should be "array subscript expressions". Can also change "non-compile-time constant" to "that either do not have a constant integer expression"
nit: I believe, .rst files should also have the 80 columns limit.


http://reviews.llvm.org/D15030





More information about the cfe-commits mailing list