Skip to content

Commit 2dea76a

Browse files
committed
Make run-clang-tidy.sh pick a default LLVM installation
1 parent 6a119f6 commit 2dea76a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

run-clang-tidy.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ get_thread_count () {
1313

1414
if [ "$(uname)" == "Darwin" ]; then
1515
patch_file () { sed -i '' -E "$@"; }
16+
_DEFAULT_LLVM_LOCATION="/opt/homebrew/opt/llvm@21"
1617
else
1718
patch_file () { sed -i -E "$@"; }
19+
_DEFAULT_LLVM_LOCATION="/usr/lib/llvm-21"
1820
fi
1921

2022
J=$(get_thread_count)
@@ -55,15 +57,18 @@ fi
5557
# export CLANG_TIDY_LLVM_INSTALL_DIR=/opt/homebrew/opt/llvm@21
5658

5759
if [ -z "$CLANG_TIDY_LLVM_INSTALL_DIR" ]; then
58-
echo "CLANG_TIDY_LLVM_INSTALL_DIR must point to an LLVM installation dir for this script."
59-
exit
60+
if [ -d "${_DEFAULT_LLVM_LOCATION}" ]; then
61+
CLANG_TIDY_LLVM_INSTALL_DIR="${_DEFAULT_LLVM_LOCATION}"
62+
else
63+
echo "CLANG_TIDY_LLVM_INSTALL_DIR must point to an LLVM installation dir for this script."
64+
exit
65+
fi
6066
fi
6167

6268
echo "CLANG_TIDY_LLVM_INSTALL_DIR = ${CLANG_TIDY_LLVM_INSTALL_DIR}"
6369

6470
VERSION=$("${CLANG_TIDY_LLVM_INSTALL_DIR}/bin/clang-tidy" --version)
65-
if [[ ${VERSION} =~ .*version\ 21.* ]]
66-
then
71+
if [[ ${VERSION} =~ .*version\ 21.* ]]; then
6772
echo "clang-tidy version 21 found."
6873
else
6974
echo "CLANG_TIDY_LLVM_INSTALL_DIR must point to an LLVM 21 install!"

0 commit comments

Comments
 (0)