@@ -227,11 +227,25 @@ printf "%s\n" \
227227 "Acquire::AllowInsecureRepositories \" true\" ;" \
228228 "Acquire::AllowWeakRepositories \" true\" ;" \
229229 | tee /etc/apt/apt.conf.d/99llvm-allow-weak
230+
231+ # Add LLVM repository for versions above 20 because it is not available in the default repo
232+ if [[ "${CLANG_VERSION}" -gt 20 ]]; then
233+ apt-get update
234+ apt-get install -y --no-install-recommends lsb-release software-properties-common gnupg
235+ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
236+ DISTRO_CODENAME=$(lsb_release -cs)
237+ echo "deb http://apt.llvm.org/${DISTRO_CODENAME}/ llvm-toolchain-${DISTRO_CODENAME}-${CLANG_VERSION} main" \
238+ | tee /etc/apt/sources.list.d/llvm.list
239+ apt-get clean
240+ rm -rf /var/lib/apt/lists/*
241+ fi
242+
230243apt-get update
231244apt-get install -y --no-install-recommends --allow-unauthenticated \
232245 clang-${CLANG_VERSION} \
233246 libclang-rt-${CLANG_VERSION}-dev \
234247 llvm-${CLANG_VERSION} \
248+ clang-tidy-${CLANG_VERSION} \
235249 gcc \
236250 g++
237251apt-get clean
@@ -245,6 +259,10 @@ update-alternatives \
245259 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VERSION}
246260update-alternatives \
247261 --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${CLANG_VERSION} 100
262+ update-alternatives \
263+ --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-${CLANG_VERSION} 100
264+ update-alternatives \
265+ --install /usr/bin/run-clang-tidy run-clang-tidy /usr/bin/run-clang-tidy-${CLANG_VERSION} 100
248266update-alternatives --auto cc
249267update-alternatives --auto c++
250268update-alternatives --auto clang
0 commit comments