dawn-cmake/docs/clang-tidy.md
dan sinclair 93cf346d67 [clang-tidy] Add ability to checkout clang-tidy.
This CL adds the DEPS entry to checkout `clang-tidy` if requested
in the `.gclient` config file. A doc is added which gives some
guidance on how to run `clang-tidy`.

Change-Id: I92eeaff33137158ffd17315649fb333c366fc91d
Bug: dawn:1414
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89801
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-05-16 12:58:24 +00:00

951 B

Running clang-tidy

  • Add "checkout_clang_tidy": True to .gclient file in the custom_vars.
    {
      "custom_vars": {
        "checkout_clang_tidy": True,
      }
    }
    
  • gclient sync

There should now be third_party/llvm-build/Release+Asserts/bin/clang-tidy

  • cd out
  • git clone https://chromium.googlesource.com/chromium/tools/build

The Chromium build folder contains the tricium files used to run clang-tidy

Running clang-tidy over all the source can be done with:

cd ..
out/build/recipes/recipe_modules/tricium_clang_tidy/resources/tricium_clang_tidy_script.py \
--base_path $PWD \
--out_dir out/Debug \
--findings_file all_findings.json \
--clang_tidy_binary $PWD/third_party/llvm-build/Release+Asserts/bin/clang-tidy \
--all

--all can be replaced by specific files if desired to run on individual source files.

References