@@ -41,38 +41,6 @@ parameters file:
4141
4242 $ clang-tidy @parameters_file
4343
44- Running Clang-Tidy on Multiple Files
45- =====================================
46-
47- For projects with multiple source files, you can use the :program: `run-clang-tidy.py `
48- script to run :program: `clang-tidy ` over all files in a compilation database in
49- parallel. This script is included with clang-tidy and provides a convenient way
50- to analyze entire projects efficiently.
51-
52- The script requires a compilation database (``compile_commands.json ``) which can
53- be generated by build systems like CMake (using ``-DCMAKE_EXPORT_COMPILE_COMMANDS=ON ``)
54- or by tools like Bear.
55-
56- Example invocations:
57-
58- .. code-block :: console
59-
60- # Run clang-tidy on all files in the compilation database
61- $ run-clang-tidy.py
62-
63- # Run with specific checks and apply fixes
64- $ run-clang-tidy.py -fix -checks=-*,readability-*
65-
66- # Run on specific files/directories with header filtering
67- $ run-clang-tidy.py src/ -header-filter=src/
68-
69- # Run with parallel execution (uses all CPU cores by default)
70- $ run-clang-tidy.py -j 4
71-
72- The script supports most of the same options as :program: `clang-tidy ` itself,
73- including ``-checks= ``, ``-fix ``, ``-header-filter= ``, and configuration options.
74- Run ``run-clang-tidy.py --help `` for a complete list of available options.
75-
7644:program: `clang-tidy ` has its own checks and can also run Clang Static Analyzer
7745checks. Each check has a name and the checks to run can be chosen using the
7846``-checks= `` option, which specifies a comma-separated list of positive and
@@ -363,6 +331,47 @@ An overview of all the command-line options:
363331 some-check.SomeOption: 'some value'
364332 ...
365333
334+ Clang-Tidy Automation
335+ =====================
336+
337+ :program: `clang-tidy ` can analyze multiple source files by specifying them on the
338+ command line or by using a compilation database. For larger projects, automation
339+ scripts provide additional functionality like parallel execution and integration
340+ with version control systems.
341+
342+ Running Clang-Tidy in Parallel
343+ -------------------------------
344+
345+ :program: `clang-tidy ` can process multiple files sequentially, but for projects
346+ with many source files, the :program: `run-clang-tidy.py ` script provides parallel
347+ execution to significantly reduce analysis time. This script is included with
348+ clang-tidy and runs :program: `clang-tidy ` over all files in a compilation database
349+ concurrently.
350+
351+ The script requires a compilation database (``compile_commands.json ``) which can
352+ be generated by build systems like CMake (using ``-DCMAKE_EXPORT_COMPILE_COMMANDS=ON ``)
353+ or by tools like `Bear `_.
354+
355+ The script supports most of the same options as :program: `clang-tidy ` itself,
356+ including ``-checks= ``, ``-fix ``, ``-header-filter= ``, and configuration options.
357+ Run ``run-clang-tidy.py --help `` for a complete list of available options.
358+
359+ Example invocations:
360+
361+ .. code-block :: console
362+
363+ # Run clang-tidy on all files in the compilation database in parallel
364+ $ run-clang-tidy.py
365+
366+ # Run with specific checks and apply fixes
367+ $ run-clang-tidy.py -fix -checks=-*,readability-*
368+
369+ # Run on specific files/directories with header filtering
370+ $ run-clang-tidy.py -header-filter=src/ src/
371+
372+ # Run with parallel execution (uses all CPU cores by default)
373+ $ run-clang-tidy.py -j 4
374+
366375 .. _clang-tidy-nolint :
367376
368377Suppressing Undesired Diagnostics
@@ -485,5 +494,6 @@ example, ``NOLINTBEGIN(check-name)`` can be paired with
485494:program: `clang-tidy ` will generate a ``clang-tidy-nolint `` error diagnostic if
486495any ``NOLINTBEGIN ``/``NOLINTEND `` comment violates these requirements.
487496
497+ .. _Bear : https://github.com/rizsotto/Bear
488498.. _LibTooling : https://clang.llvm.org/docs/LibTooling.html
489499.. _How To Setup Tooling For LLVM : https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
0 commit comments