Debian Codegraph @

clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.rst

raw
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 (Bounds 2)
12 <https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Pro-bounds-arrayindex>`_
13 profile from the C++ Core Guidelines.
14
15 Optionally, this check can generate fixes using ``gsl::at`` for indexing.
16
17 Options
18 -------
19
20 .. option:: GslHeader
21
22 The check can generate fixes after this option has been set to the name of
23 the include file that contains ``gsl::at()``, e.g. `"gsl/gsl.h"`.
24
25 .. option:: IncludeStyle
26
27 A string specifying which include-style is used, `llvm` or `google`. Default
28 is `llvm`.