Lines Matching +full:docs +full:- +full:openmp +full:- +full:html

2 Clang-Tidy
12 List of Clang-Tidy Checks <checks/list>
13 Clang-tidy IDE/Editor Integrations <Integrations>
15 External Clang-Tidy Examples <ExternalClang-TidyExamples>
17 :program:`clang-tidy` is a clang-based C++ "linter" tool. Its purpose is to
20 static analysis. :program:`clang-tidy` is modular and provides a convenient
24 Using Clang-Tidy
27 :program:`clang-tidy` is a `LibTooling`_-based tool, and it's easier to work
30 compilation options on the command line after ``--``:
32 .. code-block:: console
34 $ clang-tidy test.cpp -- -Imy_project/include -DMY_DEFINES ...
37 you can store them in a parameter file, and use :program:`clang-tidy` with that
40 .. code-block:: console
42 $ clang-tidy @parameters_file
44 :program:`clang-tidy` has its own checks and can also run Clang Static Analyzer
46 ``-checks=`` option, which specifies a comma-separated list of positive and
47 negative (prefixed with ``-``) globs. Positive globs add subsets of checks, and
50 .. code-block:: console
52 $ clang-tidy test.cpp -checks=-*,clang-analyzer-*,-clang-analyzer-cplusplus*
54 will disable all default checks (``-*``) and enable all ``clang-analyzer-*``
55 checks except for ``clang-analyzer-cplusplus*`` ones.
57 The ``-list-checks`` option lists all the enabled checks. When used without
58 ``-checks=``, it shows checks enabled by default. Use ``-checks=*`` to see all
59 available checks or with any other value of ``-checks=`` to see which checks are
62 .. _checks-groups-table:
69 ``abseil-`` Checks related to Abseil library.
70 ``altera-`` Checks related to OpenCL programming for FPGAs.
71 ``android-`` Checks related to Android.
72 ``boost-`` Checks related to Boost library.
73 ``bugprone-`` Checks that target bug-prone code constructs.
74 ``cert-`` Checks related to CERT Secure Coding Guidelines.
75 ``clang-analyzer-`` Clang Static Analyzer checks.
76 ``concurrency-`` Checks related to concurrent programming (including
78 ``cppcoreguidelines-`` Checks related to C++ Core Guidelines.
79 ``darwin-`` Checks related to Darwin coding conventions.
80 ``fuchsia-`` Checks related to Fuchsia coding conventions.
81 ``google-`` Checks related to Google coding conventions.
82 ``hicpp-`` Checks related to High Integrity C++ Coding Standard.
83 ``linuxkernel-`` Checks related to the Linux Kernel coding conventions.
84 ``llvm-`` Checks related to the LLVM coding conventions.
85 ``llvmlibc-`` Checks related to the LLVM-libc coding standards.
86 ``misc-`` Checks that we didn't have a better category for.
87 ``modernize-`` Checks that advocate usage of modern (currently "modern"
89 ``mpi-`` Checks related to MPI (Message Passing Interface).
90 ``objc-`` Checks related to Objective-C coding conventions.
91 ``openmp-`` Checks related to OpenMP API.
92 ``performance-`` Checks that target performance-related issues.
93 ``portability-`` Checks that target portability-related issues that don't
95 ``readability-`` Checks that target readability-related issues that don't
97 ``zircon-`` Checks related to Zircon kernel coding conventions.
101 diagnostics are displayed by :program:`clang-tidy` and can be filtered out using
102 the ``-checks=`` option. However, the ``-checks=`` option does not affect
104 already turned on in the build configuration. The ``-warnings-as-errors=``
105 option upgrades any warnings emitted under the ``-checks=`` flag to errors (but
108 Clang diagnostics have check names starting with ``clang-diagnostic-``.
110 ``clang-diagnostic-<warning-option>``, e.g. Clang warning controlled by
111 ``-Wliteral-conversion`` will be reported with check name
112 ``clang-diagnostic-literal-conversion``.
114 The ``-fix`` flag instructs :program:`clang-tidy` to fix found errors if
117 An overview of all the command-line options:
119 .. code-block:: console
121 $ clang-tidy --help
122 USAGE: clang-tidy [options] <source0> [... <sourceN>]
128 --help - Display available options (--help-hidden for more)
129 --help-list - Display list of available options (--help-list-hidden for more)
130 --version - Display the version of this program
132 clang-tidy options:
134 --checks=<string> - Comma-separated list of globs with optional '-'
136 appearance in the list. Globs without '-'
138 set, globs with the '-' prefix remove checks
141 value of the 'Checks' option in .clang-tidy
143 --config=<string> - Specifies a configuration in YAML/JSON format:
144 -config="{Checks: '*',
146 When the value is empty, clang-tidy will
147 attempt to find a file named .clang-tidy for
149 --config-file=<string> - Specify the path of .clang-tidy or custom config file:
150 e.g. --config-file=/some/path/myTidyConfigFile
152 --config option after reading specified config file.
153 Use either --config-file or --config, not both.
154 --dump-config - Dumps configuration in the YAML format to
156 file name (and '--' if the file is outside of a
160 Use along with -checks=* to include
162 --enable-check-profile - Enable per-check timing profiles, and print a
164 --enable-module-headers-parsing - Enables preprocessor-level module header parsing
169 --exclude-header-filter=<string> - Regular expression matching the names of the
173 Must be used together with --header-filter.
174 Can be used together with -line-filter.
176 option in .clang-tidy file, if any.
177 --explain-config - For each enabled check explains, where it is
178 enabled, i.e. in clang-tidy binary, command
180 --export-fixes=<filename> - YAML file to store suggested fixes in. The
182 code with clang-apply-replacements.
183 --extra-arg=<string> - Additional argument to append to the compiler command line
184 --extra-arg-before=<string> - Additional argument to prepend to the compiler command line
185 --fix - Apply suggested fixes. Without -fix-errors
186 clang-tidy will bail out if any compilation
188 --fix-errors - Apply suggested fixes even if compilation
190 attached fix-its, clang-tidy will apply them as
192 --fix-notes - If a warning has no fix, but a single fix can
196 '--fix' flag.
197 --format-style=<string> - Style for formatting code around applied fixes:
198 - 'none' (default) turns off formatting
199 - 'file' (literally 'file', not a placeholder)
200 uses .clang-format file in the closest parent
202 - '{ <json> }' specifies options inline, e.g.
203 -format-style='{BasedOnStyle: llvm, IndentWidth: 8}'
204 - 'llvm', 'google', 'webkit', 'mozilla'
205 See clang-format documentation for the up-to-date
208 .clang-tidy file, if any.
209 --header-filter=<string> - Regular expression matching the names of the
213 Can be used together with -line-filter.
215 option in .clang-tidy file, if any.
216 --line-filter=<string> - List of files with line ranges to filter the
218 -header-filter. The format of the list is a
224 --list-checks - List all enabled checks and exit. Use with
225 -checks=* to list all available checks.
226 --load=<pluginfilename> - Load the specified plugin
227 -p <string> - Build path
228 --quiet - Run clang-tidy in quiet mode. This suppresses
232 --store-check-profile=<prefix> - By default reports are printed in tabulated
234 these per-TU profiles are instead stored as JSON.
235 --system-headers - Display the errors from system headers.
237 in .clang-tidy file, if any.
238 --use-color - Use colors in diagnostics. If not set, colors
242 .clang-tidy file, if any.
243 --verify-config - Check the config files to ensure each check and
245 --vfsoverlay=<filename> - Overlay the virtual filesystem described by file
247 --warnings-as-errors=<string> - Upgrades warnings to errors. Same format as
248 '-checks'.
250 the 'WarningsAsErrors' option in .clang-tidy
252 --allow-no-checks - Allow empty enabled checks. This suppresses
256 -p <build-path> is used to read a compile command database.
259 compile_commands.json exists (use -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
263 https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html for an
277 by use '@parameter-file' in the command line.
280 clang-tidy attempts to read configuration for each source file from a
281 .clang-tidy file located in the closest parent directory of the source
282 file. The .clang-tidy file is specified in YAML format. If any configuration
283 options have a corresponding command-line option, command-line option takes
286 The following configuration options may be used in a .clang-tidy file:
288 CheckOptions - List of key-value pairs defining check-specific
291 some-check.SomeOption: 'some value'
292 Checks - Same as '--checks'. Additionally, the list of
295 ExcludeHeaderFilterRegex - Same as '--exclude-header-filter'.
296 ExtraArgs - Same as '--extra-arg'.
297 ExtraArgsBefore - Same as '--extra-arg-before'.
298 FormatStyle - Same as '--format-style'.
299 HeaderFileExtensions - File extensions to consider to determine if a
301 HeaderFilterRegex - Same as '--header-filter'.
302 ImplementationFileExtensions - File extensions to consider to determine if a
305 InheritParentConfig - If this option is true in a config file, the
310 SystemHeaders - Same as '--system-headers'.
311 UseColor - Same as '--use-color'.
312 User - Specifies the name or e-mail of the user
313 running clang-tidy. This option is used, for
316 WarningsAsErrors - Same as '--warnings-as-errors'.
318 The effective configuration can be inspected using --dump-config:
320 $ clang-tidy --dump-config
321 ---
322 Checks: '-*,some-check'
331 some-check.SomeOption: 'some value'
334 .. _clang-tidy-nolint:
339 :program:`clang-tidy` diagnostics are intended to call out code that does not
342 Some clang-tidy checks provide a check-specific way to silence the diagnostics,
343 e.g. `bugprone-use-after-move <checks/bugprone/use-after-move.html>`_ can be
344 silenced by re-initializing the variable after it has been moved out,
345 `bugprone-string-integer-assignment
346 <checks/bugprone/string-integer-assignment.html>`_ can be suppressed by
348 `readability-implicit-bool-conversion
349 <checks/readability/implicit-bool-conversion.html>`_ can also be suppressed by
353 its use is not desired for some reason, :program:`clang-tidy` has a generic
357 The ``NOLINT`` comment instructs :program:`clang-tidy` to ignore warnings on the
361 ``NOLINTNEXTLINE`` comment allows suppressing clang-tidy warnings on the *next
363 clang-tidy warnings on *multiple lines* (affecting all lines between the two
369 are ignored here, as they would effectively re-activate the warning.
373 .. code-block:: c++
383 Foo(double param); // NOLINT(google-explicit-constructor, google-runtime-int)
388 // Silence all checks ending with `-avoid-c-arrays`
389 int array[10]; // NOLINT(*-avoid-c-arrays)
392 // NOLINTNEXTLINE(google-explicit-constructor, google-runtime-int)
399 // Silence all checks ending with `-avoid-c-arrays` for the next line
400 // NOLINTNEXTLINE(*-avoid-c-arrays)
404 // NOLINTBEGIN(google-explicit-constructor, google-runtime-int)
407 // NOLINTEND(google-explicit-constructor, google-runtime-int)
414 // Silence all checks ending with `-avoid-c-arrays` for all lines between the BEGIN and END
415 // NOLINTBEGIN(*-avoid-c-arrays)
417 // NOLINTEND(*-avoid-c-arrays)
423 .. parsed-literal::
425 lint-comment:
426 lint-command
427 lint-command lint-args
429 lint-args:
430 **(** check-name-list **)**
432 check-name-list:
433 *check-name*
434 check-name-list **,** *check-name*
436 lint-command:
450 comments. Moreover, a pair of comments must have matching arguments -- for
451 example, ``NOLINTBEGIN(check-name)`` can be paired with
452 ``NOLINTEND(check-name)`` but not with ``NOLINTEND`` `(zero arguments)`.
453 :program:`clang-tidy` will generate a ``clang-tidy-nolint`` error diagnostic if
456 .. _LibTooling: https://clang.llvm.org/docs/LibTooling.html
457 .. _How To Setup Tooling For LLVM: https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html