From c3be155f8d7af9a9fc8a9543b4f92069ae328aa2 Mon Sep 17 00:00:00 2001 From: Alex Kremer Date: Mon, 14 Oct 2024 16:43:49 +0100 Subject: [PATCH] chore: Upgrade to llvm 19 tooling (#1681) For #1664 --- .githooks/check-format | 4 ++-- .github/workflows/clang-tidy.yml | 2 +- CONTRIBUTING.md | 4 ++-- cmake/ClangTidy.cmake | 2 +- docker/ci/dockerfile | 2 +- docs/metrics-and-static-analysis.md | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.githooks/check-format b/.githooks/check-format index 2c57dc5c..3ffd8581 100755 --- a/.githooks/check-format +++ b/.githooks/check-format @@ -26,12 +26,12 @@ sources="src tests" formatter="clang-format -i" version=$($formatter --version | grep -o '[0-9\.]*') -if [[ "18.0.0" > "$version" ]]; then +if [[ "19.0.0" > "$version" ]]; then cat <output.txt + run-clang-tidy-19 -p build -j ${{ steps.number_of_threads.outputs.threads_number }} -fix -quiet 1>output.txt - name: Check format if: ${{ steps.run_clang_tidy.outcome != 'success' }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 72a461f0..7be9bc78 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,7 +21,7 @@ git config --local core.hooksPath .githooks ``` ## Git hooks dependencies -The pre-commit hook requires `clang-format >= 18.0.0` and `cmake-format` to be installed on your machine. +The pre-commit hook requires `clang-format >= 19.0.0` and `cmake-format` to be installed on your machine. `clang-format` can be installed using `brew` on macOS and default package manager on Linux. `cmake-format` can be installed using `pip`. The hook will also attempt to automatically use `doxygen` to verify that everything public in the codebase is covered by doc comments. If `doxygen` is not installed, the hook will raise a warning suggesting to install `doxygen` for future commits. @@ -105,7 +105,7 @@ The button for that is near the bottom of the PR's page on GitHub. This is a non-exhaustive list of recommended style guidelines. These are not always strictly enforced and serve as a way to keep the codebase coherent. ## Formatting -Code must conform to `clang-format` version 18, unless the result would be unreasonably difficult to read or maintain. +Code must conform to `clang-format` version 19, unless the result would be unreasonably difficult to read or maintain. In most cases the pre-commit hook will take care of formatting and will fix any issues automatically. To manually format your code, use `clang-format -i ` for C++ files and `cmake-format -i ` for CMake files. diff --git a/cmake/ClangTidy.cmake b/cmake/ClangTidy.cmake index 44f1da56..c71d1b0d 100644 --- a/cmake/ClangTidy.cmake +++ b/cmake/ClangTidy.cmake @@ -8,7 +8,7 @@ if (lint) endif () message(STATUS "Using clang-tidy from CLIO_CLANG_TIDY_BIN") else () - find_program(_CLANG_TIDY_BIN NAMES "clang-tidy-18" "clang-tidy" REQUIRED) + find_program(_CLANG_TIDY_BIN NAMES "clang-tidy-19" "clang-tidy" REQUIRED) endif () if (NOT _CLANG_TIDY_BIN) diff --git a/docker/ci/dockerfile b/docker/ci/dockerfile index 60c9fc22..197e96c6 100644 --- a/docker/ci/dockerfile +++ b/docker/ci/dockerfile @@ -7,7 +7,7 @@ USER root WORKDIR /root ENV CCACHE_VERSION=4.10.2 \ - LLVM_TOOLS_VERSION=18 \ + LLVM_TOOLS_VERSION=19 \ GH_VERSION=2.40.0 \ DOXYGEN_VERSION=1.12.0 diff --git a/docs/metrics-and-static-analysis.md b/docs/metrics-and-static-analysis.md index b7111813..79268565 100644 --- a/docs/metrics-and-static-analysis.md +++ b/docs/metrics-and-static-analysis.md @@ -14,7 +14,7 @@ You can find an example docker-compose file, with Prometheus and Grafana configs ## Using `clang-tidy` for static analysis -The minimum [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) version required is 17.0. +The minimum [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) version required is 19.0. Clang-tidy can be run by Cmake when building the project. To achieve this, you just need to provide the option `-o lint=True` for the `conan install` command: @@ -26,5 +26,5 @@ By default Cmake will try to find `clang-tidy` automatically in your system. To force Cmake to use your desired binary, set the `CLIO_CLANG_TIDY_BIN` environment variable to the path of the `clang-tidy` binary. For example: ```sh -export CLIO_CLANG_TIDY_BIN=/opt/homebrew/opt/llvm@17/bin/clang-tidy +export CLIO_CLANG_TIDY_BIN=/opt/homebrew/opt/llvm@19/bin/clang-tidy ```