From cca66b9ec4e494c1d919bff0f71a820d8afab1fa Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:24:48 +0200 Subject: Adding upstream version 1.2.2. Signed-off-by: Daniel Baumann --- buildtools/clangtidy-helper.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 buildtools/clangtidy-helper.sh (limited to 'buildtools/clangtidy-helper.sh') diff --git a/buildtools/clangtidy-helper.sh b/buildtools/clangtidy-helper.sh new file mode 100644 index 0000000..3782465 --- /dev/null +++ b/buildtools/clangtidy-helper.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +## +## usage: clangtidy-helper [list of cpp files] +## +## Without arguments, run for all source files. +## + +set -e + +mkdir -p build +cd build + +export CC="ccache clang" +export CXX="ccache clang++" + +cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + +#remove 3rdparty files from analysis, and only do those in inkscape_base target +jq -c '.[] | select( .file | contains("3rdparty") | not) | select(.command | contains("CMakeFiles/inkscape_base")) ' compile_commands.json | jq -s > compile_commands2.json +#treat 3rdparty code as system headers +sed -e 's/-I\([^ ]*\)\/src\/3rdparty/-isystem \1\/src\/3rdparty/g' compile_commands2.json > compile_commands.json && rm compile_commands2.json + +run-clang-tidy -fix "$@" > /dev/null || true + +# revert all fixes in protected directories +git checkout --recurse-submodules ../src/3rdparty + +git diff | tee clang_tidy_diff + +if [[ -s clang_tidy_diff ]]; then + exit 1 +fi -- cgit v1.2.3