================ @@ -331,6 +331,106 @@ 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 or by using a compilation database. 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 +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 ---------------- vbvictor wrote:
All these examples are assuming that `compile_commands.json` is located in the same dir as `run-clang-tidy.py` is invoked, but I'd write `-p=build/` in each command to state this explicitly 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