================ @@ -336,6 +336,107 @@ An overview of all the command-line options: some-check.SomeOption: 'some value' ... +Clang-Tidy Automation +===================== + +:program:`clang-tidy` can analyze multiple source files by specifying them on +the command line. For larger projects, automation scripts provide additional +functionality like parallel execution and integration with version control +systems. + +Running Clang-Tidy in Parallel +------------------------------- + +:program:`clang-tidy` can process multiple files sequentially, but for projects +with many source files, the :program:`run-clang-tidy.py` script provides +parallel execution to significantly reduce analysis time. This script is +included with clang-tidy and runs :program:`clang-tidy` over all files in a +compilation database or a specified path concurrently. + +The script requires a compilation database (``compile_commands.json``) which +can be generated by build systems like CMake (using +``-DCMAKE_EXPORT_COMPILE_COMMANDS=ON``) or by tools like `Bear`_. + +The script supports most of the same options as :program:`clang-tidy` itself, +including ``-checks=``, ``-fix``, ``-header-filter=``, and configuration +options. Run ``run-clang-tidy.py --help`` for a complete list of available +options. + +Example invocations: + +.. code-block:: console + + # Run clang-tidy on all files in the compilation database in parallel + $ run-clang-tidy.py -p=build/ + + # Run with specific checks and apply fixes + $ run-clang-tidy.py -p=build/ -fix -checks=-*,readability-* + + # Run on specific files/directories with header filtering + $ run-clang-tidy.py -p=build/ -header-filter=src/ src/ + + # Run with parallel execution (uses all CPU cores by default) + $ run-clang-tidy.py -p=build/ -j 4 + +Running Clang-Tidy on Diff +--------------------------- + +The :program:`clang-tidy-diff.py` script allows you to run +:program:`clang-tidy` on the lines that have been modified in your working +directory or in a specific diff. Importantly, clang-tidy-diff only reports ---------------- vbvictor wrote:
```suggestion directory or in a specific diff. Importantly, :program:`clang-tidy-diff.py` only reports ``` https://github.com/llvm/llvm-project/pull/153166 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits