| 1 |
.. title:: clang-tidy - cppcoreguidelines-pro-bounds-constant-array-index |
| 2 |
|
| 3 |
cppcoreguidelines-pro-bounds-constant-array-index |
| 4 |
================================================= |
| 5 |
|
| 6 |
This check flags all array subscript expressions on static arrays and |
| 7 |
``std::arrays`` that either do not have a constant integer expression index or |
| 8 |
are out of bounds (for ``std::array``). For out-of-bounds checking of static |
| 9 |
arrays, see the `-Warray-bounds` Clang diagnostic. |
| 10 |
|
| 11 |
This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see |
| 12 |
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-bounds-arrayindex. |
| 13 |
|
| 14 |
Optionally, this check can generate fixes using ``gsl::at`` for indexing. |
| 15 |
|
| 16 |
Options |
| 17 |
------- |
| 18 |
|
| 19 |
.. option:: GslHeader |
| 20 |
|
| 21 |
The check can generate fixes after this option has been set to the name of |
| 22 |
the include file that contains ``gsl::at()``, e.g. `"gsl/gsl.h"`. |
| 23 |
|
| 24 |
.. option:: IncludeStyle |
| 25 |
|
| 26 |
A string specifying which include-style is used, `llvm` or `google`. Default |
| 27 |
is `llvm`. |