# C and C++ tools, packaged

cpp-linter builds clang-format, clang-tidy and the LLVM tools around them as static binaries for
every LLVM version from 12 to 23, on Linux, macOS and Windows, x86-64 and ARM64. The same files
then go to PyPI, npm, Homebrew, asdf and Docker, so you install the tool at the version you pin,
with the package manager your project already uses. There is no LLVM to install and nothing to
compile.

<div class="cl-stats" markdown>

<div><strong>12–23</strong><span>LLVM versions</span></div>
<div><strong>6</strong><span>platforms, x86-64 and ARM64</span></div>
<div><strong>540k+</strong><span>binary downloads</span></div>
<div><strong>Attested</strong><span>build provenance on every file</span></div>

</div>

## Python wheels

`pip install`, `uv tool install` or `pipx install` puts the command on your `PATH`. The package
version is the tool's version, so `pip install "llvm-cov==22.*"` installs llvm-cov from LLVM 22.

<div class="grid cards cl-wheel-cards" markdown>

-   **clang-include-cleaner** <span class="cl-range">LLVM 22–23</span>

    ---

    Finds unused and missing `#include` directives in C and C++ files.

    ```bash
    pip install clang-include-cleaner
    ```

    [PyPI](https://pypi.org/project/clang-include-cleaner/) ·
    [GitHub](https://github.com/cpp-linter/clang-include-cleaner-wheel)

-   **clang-apply-replacements** <span class="cl-range">LLVM 16–23</span>

    ---

    Applies the fixes clang-tidy exports to your source files.

    ```bash
    pip install clang-apply-replacements
    ```

    [PyPI](https://pypi.org/project/clang-apply-replacements/) ·
    [GitHub](https://github.com/cpp-linter/clang-apply-replacements-wheel)

-   **llvm-cov** <span class="cl-range">LLVM 12–23</span>

    ---

    `llvm-cov` and `llvm-profdata`, for clang's source-based code coverage.

    ```bash
    pip install llvm-cov
    ```

    [PyPI](https://pypi.org/project/llvm-cov/) ·
    [GitHub](https://github.com/cpp-linter/llvm-cov-wheel)

-   **ccache-bin** <span class="cl-range">ccache 4</span>

    ---

    `ccache`, the C and C++ compiler cache, from ccache's own release binaries.

    ```bash
    pip install ccache-bin
    ```

    [PyPI](https://pypi.org/project/ccache-bin/) ·
    [GitHub](https://github.com/cpp-linter/ccache-wheel)

</div>

Every wheel:

- holds the tool's binary unchanged, plus clang's builtin headers when the tool parses code;
- contains no Python code, so it works with any Python 3, and is tested with pip, uv,
  `uv tool install` and `pip install --user` on every platform before it is released;
- has Linux wheels for glibc 2.17 and later and for musl, so it also installs on Alpine;
- is published from GitHub Actions with PyPI Trusted Publishing, with an attestation that names
  the commit it was built from.

Pin the tools next to the rest of your development dependencies, and every laptop and CI job runs
the same version:

```toml title="pyproject.toml"
[dependency-groups]
dev = ["clang-include-cleaner==22.*", "llvm-cov==22.*", "ccache-bin"]
```

Or run one without installing it, for example in CI: `uvx clang-include-cleaner --help`, or
`pipx run llvm-cov --version` on GitHub-hosted runners, which ship with pipx.

clang-format and clang-tidy already have widely used wheels on PyPI from another project,
[clang-format](https://pypi.org/project/clang-format/) and
[clang-tidy](https://pypi.org/project/clang-tidy/); cpp-linter-hooks installs those. For LLVM
versions they do not have, or to install several tools at once, use
[clang-tools](https://cpp-linter.github.io/clang-tools-pip/), which installs the static binaries
by version:

```bash
pip install clang-tools
clang-tools install clang-format clang-tidy --version 21
```

## Other package managers

| Package | LLVM | Runs on | Install |
| --- | --- | --- | --- |
| [npm packages](https://github.com/cpp-linter/clang-tools-npm) | 12 to 23 | Linux, macOS, Windows on x86-64 and ARM64 | `npm install --save-dev @cpp-linter/clang-format@21 @cpp-linter/clang-tidy@21` |
| [Homebrew tap](https://github.com/cpp-linter/homebrew-tap) | 19 to 23 | macOS | `brew install cpp-linter/tap/clang-format@21` |
| [asdf plugin](https://github.com/cpp-linter/asdf-clang-tools) | 12 to 23 | wherever asdf runs | `asdf plugin add clang-format https://github.com/cpp-linter/asdf-clang-tools.git` |
| [Docker images](https://github.com/cpp-linter/clang-tools-docker) | 7 to 23 | Docker on x86-64 and ARM64 | `docker pull ghcr.io/cpp-linter/clang-tools:21` |
| [Static binaries](https://cpp-linter.github.io/clang-tools-static-binaries/) | 12 to 23 | Linux, macOS, Windows on x86-64 and ARM64 | one file from the download page |

## One build behind every package

<div class="cl-flow" markdown>

<div class="cl-flow__step"><span class="cl-flow__label">Upstream</span><strong>LLVM release</strong><span>12 to 23, each at its newest patch release</span></div>
<div class="cl-flow__step cl-flow__step--main"><span class="cl-flow__label">Built once</span><strong>Static binaries</strong><span>6 platforms, checksums and build attestations</span></div>
<div class="cl-flow__step"><span class="cl-flow__label">Published to</span><strong>PyPI · npm · Homebrew · asdf · Docker</strong><span>the same files, unchanged</span></div>

</div>

A new LLVM release starts a build of the
[static binaries](https://cpp-linter.github.io/clang-tools-static-binaries/) on all six
platforms. When it is published, a bot opens the update pull request for each wheel, and the new
wheels are released once they pass their tests on every platform. So an LLVM version runs the same
`clang-tidy` whether it comes from clang-tools, npm, Homebrew, asdf or Docker. The build and
release workflows the wheels share are in [cpp-linter/wheels](https://github.com/cpp-linter/wheels).

## Check what you install

Each static binary and each wheel has a build provenance attestation. To check one with the
GitHub CLI:

```bash
gh attestation verify clang-format-22_linux-amd64 --repo cpp-linter/clang-tools-static-binaries
pip download --no-deps "llvm-cov==22.*"
gh attestation verify llvm_cov-*.whl --repo cpp-linter/llvm-cov-wheel
```

The static binaries also come with `SHA512SUMS`. Their
[download page](https://cpp-linter.github.io/clang-tools-static-binaries/) shows how to check a
download, and the [security policy](https://github.com/cpp-linter/clang-tools-static-binaries/blob/master/SECURITY.md#checking-where-a-binary-was-built)
explains what an attestation proves.
