-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: migrate clang-tidy to LLVM 18 (#5497)
* build: install newer dependencies * build: only build as plugin not executable since i don't think anyone's using executable and plugin is sufficient * build: vendor check_clang_tidy.py * build: fix headers, errors, warnings * chore: script to get affected files * ci: gather affected files * test: run clang-tidy with plugins * ci: show most time-consuming job see: CleverRaven/Cataclysm-DDA#64648 co-authored-by: Binrui Dong <brett.browning.dong@gmail.com> * test: exclude problemetic checks bugprone-unchecked-optional-access: llvm/llvm-project#111003 bugprone-chained-comparison: conflicts with catch2 clang-diagnostic-unused-macros: llvm/llvm-project#59572 clang-analyzer-optin: segfaults * refactor: remove unneeded CATA_CLANG_TIDY logic building clang-tidy is handled separatedly on build-clang-tidy-plugin.sh * fix: run a lint as an example * docs: update how to build clang-tidy plugin --------- Co-authored-by: nocontribute <> Co-authored-by: Binrui Dong <brett.browning.dong@gmail.com>
- Loading branch information
Showing
68 changed files
with
658 additions
and
492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -exo pipefail | ||
|
||
BUILD_TYPE=${BUILD_TYPE:-"RelWithDeb"} | ||
|
||
NUM_JOBS=${NUM_JOBS:-$(nproc)} | ||
BUILD_PATH=${BUILD_PATH:-"build"} | ||
|
||
echo "Using bash version $BASH_VERSION with $NUM_JOBS jobs" | ||
echo "Creating build files at $BUILD_PATH" | ||
|
||
# We might need binaries installed via pip, so ensure that our personal bin dir is on the PATH | ||
export PATH=$HOME/.local/bin:$PATH | ||
|
||
cmake \ | ||
-B "$BUILD_PATH" \ | ||
-G Ninja \ | ||
-DBACKTRACE=ON \ | ||
-DCMAKE_C_COMPILER=/usr/bin/clang \ | ||
-DCMAKE_CXX_COMPILER=/usr/bin/clang++ \ | ||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | ||
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \ | ||
-DTILES="$TILES" \ | ||
-DSOUND="$SOUND" \ | ||
-DLIBBACKTRACE="${LIBBACKTRACE:-0}" \ | ||
-DLINKER=mold \ | ||
-DCATA_CLANG_TIDY_PLUGIN=ON | ||
|
||
ninja -C "$BUILD_PATH" -j"$NUM_JOBS" CataAnalyzerPlugin | ||
ln -s "$BUILD_PATH/compile_commands.json" compile_commands.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -exo pipefail | ||
|
||
BUILD_TYPE=${BUILD_TYPE:-"RelWithDeb"} | ||
NUM_JOBS=${NUM_JOBS:-$(nproc)} | ||
BUILD_PATH=${BUILD_PATH:-"build"} | ||
COMPILER=${COMPILER:-"/usr/bin/clang++"} | ||
|
||
echo "Using bash version $BASH_VERSION with $NUM_JOBS jobs" | ||
echo "Using build files at $BUILD_PATH" | ||
|
||
AFFECTED_FILES=${AFFECTED_FILES:-"affected_files.txt"} | ||
|
||
if ! grep -q '[^[:space:]]' "$AFFECTED_FILES" | ||
then | ||
echo "No files to analyze." | ||
exit 0 | ||
else | ||
echo "Analyzing $(wc -l < "$AFFECTED_FILES") files" | ||
# shellcheck disable=SC2002 | ||
# cat "$AFFECTED_FILES" | parallel -j"$NUM_JOBS" --no-notice -a ./build-scripts/clang-tidy-wrapper.sh {} | ||
< "$AFFECTED_FILES" xargs -n1 -P"$NUM_JOBS" ./build-scripts/clang-tidy-wrapper.sh -quiet | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.