@@ -25,17 +25,17 @@ Using clang-tidy
25
25
26
26
:program: `clang-tidy ` is a `LibTooling `_-based tool, and it's easier to work
27
27
with if you set up a compile command database for your project (for an example
28
- of how to do this see `How To Setup Tooling For LLVM `_). You can also specify
28
+ of how to do this, see `How To Setup Tooling For LLVM `_). You can also specify
29
29
compilation options on the command line after ``-- ``:
30
30
31
31
.. code-block :: console
32
32
33
33
$ clang-tidy test.cpp -- -Imy_project/include -DMY_DEFINES ...
34
34
35
- :program: `clang-tidy ` has its own checks and can also run Clang static analyzer
35
+ :program: `clang-tidy ` has its own checks and can also run Clang Static Analyzer
36
36
checks. Each check has a name and the checks to run can be chosen using the
37
37
``-checks= `` option, which specifies a comma-separated list of positive and
38
- negative (prefixed with ``- ``) globs. Positive globs add subsets of checks,
38
+ negative (prefixed with ``- ``) globs. Positive globs add subsets of checks, and
39
39
negative globs remove them. For example,
40
40
41
41
.. code-block :: console
@@ -61,7 +61,7 @@ Name prefix Description
61
61
``altera- `` Checks related to OpenCL programming for FPGAs.
62
62
``android- `` Checks related to Android.
63
63
``boost- `` Checks related to Boost library.
64
- ``bugprone- `` Checks that target bugprone code constructs.
64
+ ``bugprone- `` Checks that target bug-prone code constructs.
65
65
``cert- `` Checks related to CERT Secure Coding Guidelines.
66
66
``clang-analyzer- `` Clang Static Analyzer checks.
67
67
``concurrency- `` Checks related to concurrent programming (including
@@ -90,11 +90,11 @@ Name prefix Description
90
90
91
91
Clang diagnostics are treated in a similar way as check diagnostics. Clang
92
92
diagnostics are displayed by :program: `clang-tidy ` and can be filtered out using
93
- ``-checks= `` option. However, the ``-checks= `` option does not affect
93
+ the ``-checks= `` option. However, the ``-checks= `` option does not affect
94
94
compilation arguments, so it cannot turn on Clang warnings which are not
95
- already turned on in build configuration. The ``-warnings-as-errors= `` option
96
- upgrades any warnings emitted under the ``-checks= `` flag to errors (but it
97
- does not enable any checks itself).
95
+ already turned on in the build configuration. The ``-warnings-as-errors= ``
96
+ option upgrades any warnings emitted under the ``-checks= `` flag to errors (but
97
+ it does not enable any checks itself).
98
98
99
99
Clang diagnostics have check names starting with ``clang-diagnostic- ``.
100
100
Diagnostics which have a corresponding warning option, are named
@@ -301,8 +301,8 @@ mechanism to suppress diagnostics using ``NOLINT``, ``NOLINTNEXTLINE``, and
301
301
The ``NOLINT `` comment instructs :program: `clang-tidy ` to ignore warnings on the
302
302
*same line * (it doesn't apply to a function, a block of code or any other
303
303
language construct; it applies to the line of code it is on). If introducing the
304
- comment in the same line would change the formatting in an undesired way, the
305
- ``NOLINTNEXTLINE `` comment allows to suppress clang-tidy warnings on the *next
304
+ comment on the same line would change the formatting in an undesired way, the
305
+ ``NOLINTNEXTLINE `` comment allows suppressing clang-tidy warnings on the *next
306
306
line *. The ``NOLINTBEGIN `` and ``NOLINTEND `` comments allow suppressing
307
307
clang-tidy warnings on *multiple lines * (affecting all lines between the two
308
308
comments).
@@ -320,8 +320,8 @@ For example:
320
320
// Suppress all the diagnostics for the line
321
321
Foo(int param); // NOLINT
322
322
323
- // Consider explaining the motivation to suppress the warning.
324
- Foo(char param); // NOLINT: Allow implicit conversion from `char `, because <some valid reason>.
323
+ // Consider explaining the motivation to suppress the warning
324
+ Foo(char param); // NOLINT: Allow implicit conversion from `char `, because <some valid reason>
325
325
326
326
// Silence only the specified checks for the line
327
327
Foo(double param); // NOLINT(google-explicit-constructor, google-runtime-int)
0 commit comments