Skip to content

About

asdf plugin for clang tools (clang-format, clang-tidy, clang-query and clang-apply-replacements)

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

asdf-clang-tools

ci part of cpp-linter

An asdf plugin that installs clang-format, clang-tidy and other LLVM tools from the cpp-linter static binaries, without building LLVM.

Website · Get started · Discussions

Quick start

With asdf 0.16 or later:

# Add the plugin
asdf plugin add clang-format https://github.com/cpp-linter/asdf-clang-tools.git

# Show all installable versions
asdf list all clang-format

# Install the latest version
asdf install clang-format latest

# Set a version (writes .tool-versions in the current directory; -u writes ~/.tool-versions)
asdf set clang-format latest

# Now clang-format is available
clang-format --version

Check asdf readme for more instructions on how to install & manage versions.

Usage

Each tool is a separate plugin. Add it by URL, with the tool name as the plugin name:

Tool Command to add Plugin
clang-format asdf plugin add clang-format https://github.com/cpp-linter/asdf-clang-tools.git
clang-query asdf plugin add clang-query https://github.com/cpp-linter/asdf-clang-tools.git
clang-tidy asdf plugin add clang-tidy https://github.com/cpp-linter/asdf-clang-tools.git
clang-apply-replacements asdf plugin add clang-apply-replacements https://github.com/cpp-linter/asdf-clang-tools.git
clang-include-cleaner asdf plugin add clang-include-cleaner https://github.com/cpp-linter/asdf-clang-tools.git

Supported versions

Clang versions 12 through 23 are supported. clang-include-cleaner is only available from version 18 onward.

Versions are major versions (21, not 21.1.0). asdf list all <tool> shows the versions in the index.json of clang-tools-static-binaries, and each version installs the newest build that the index lists for it.

Platforms

  • Pre-compiled binaries are provided for:
    • Linux: amd64 (x86_64), arm64 (aarch64)
    • macOS: amd64 (Intel), arm64 (Apple Silicon)
  • The macOS binaries are ad-hoc signed, not notarized. The plugin downloads them with curl, which does not set the quarantine attribute, so they run without a Gatekeeper prompt. If something else has set the attribute, the plugin asks before removing it; set ASDF_CLANG_TOOLS_MACOS_DEQUARANTINE=1 to remove it without asking.

Dependencies

  • curl, jq
  • sha512sum or shasum: checks each download against the SHA-512 that the index (or the release's SHA512SUMS file) gives for it. The install fails without one of them.

Environment variables

  • ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH: set to "1" to install the amd64 binary regardless of the host architecture. This can be useful if you have set up QEMU User Emulation (or similar) to run foreign binaries under emulation. Normally, the native arm64/aarch64 Linux binaries are used automatically when detected.
  • ASDF_CLANG_TOOLS_INDEX_URL: where to read the list of versions and files from. Defaults to the index.json of clang-tools-static-binaries; set it to use a mirror. The plugin downloads the URL and checks the SHA-512 that the index gives for each file.
  • GITHUB_TOKEN: only used if the index cannot be read, when the plugin falls back to listing the assets of the newest release through the GitHub API. If set, it avoids the lower rate limit for unauthenticated requests (for example in CI).

Contributing

See the contributing guide and open an issue for bugs and feature requests.

License

This project is licensed under the MIT License.

About

asdf plugin for clang tools (clang-format, clang-tidy, clang-query and clang-apply-replacements)

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages