Files
TheRock/compiler/amd-llvm/mlir/utils/clang-tidy/README.md
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

51 lines
1.6 KiB
Markdown

### Apply clang-tidy fixes on the repo
This script runs clang-tidy on every C++ source file in MLIR and commit
the results of the checks individually. Be aware that it'll take over
10h to process the entire codebase.
The advised way to use this is to build clang-tidy (in release mode) and
have another build directory for MLIR. Here is a sample invocation from
the root of the repo:
```bash
{ time \
CLANG_TIDY=build-clang/bin/clang-tidy \
TIMING_TIDY=time \
./mlir/utils/clang-tidy/apply-clang-tidy.sh build mlir ~/clang-tidy-fails/
} 2>&1 | tee ~/clang-tidy.log
```
- `build-clang/` contains the result of a build of clang-tidy, configured
and built somehow with:
```bash
$ cmake ../llvm \
-DLLVM_ENABLE_PROJECTS="clang;mlir;clang-tools-extra" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_TARGETS_TO_BUILD=Native \
-G Ninja
$ ninja clang-tidy
```
- `build/` must be a directory with MLIR onfigured. It is highly advised to
use `ccache` as well, as this directory will be used to rerun
`ninja check-mlir` after every single clang-tidy fix.
```bash
$ cmake ../llvm \
-DLLVM_ENABLE_PROJECTS="mlir" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_TARGETS_TO_BUILD="Native;NVPTX;AMDGPU" \
-DLLVM_CCACHE_BUILD=ON \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_ENABLE_LLD=ON \
-DLLVM_BUILD_EXAMPLES=OFF \
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
-G Ninja
```
- `mlir/` is the directory where to find the files, it can be replaced by a
subfolder or the path to a single file.
- `mkdir -p ~/clang-tidy-fails/` will be a directory containing the patches
that clang-tidy produces but also fail the build.