diff --git a/.gitignore b/.gitignore index 3b22e358dca..b92988f6a3d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ # Only ignore unexpected patches *.patch +!ci/test/*.patch !contrib/guix/patches/*.patch !depends/patches/**/*.patch diff --git a/ci/test/01_base_install.sh b/ci/test/01_base_install.sh index a0f4164bbc5..f1accd713b5 100755 --- a/ci/test/01_base_install.sh +++ b/ci/test/01_base_install.sh @@ -81,6 +81,7 @@ fi if [[ "${RUN_TIDY}" == "true" ]]; then ${CI_RETRY_EXE} git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_"${TIDY_LLVM_V}" /include-what-you-use + (cd /include-what-you-use && patch -p1 < /ci_container_base/ci/test/01_iwyu.patch) cmake -B /iwyu-build/ -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-"${TIDY_LLVM_V}" -S /include-what-you-use make -C /iwyu-build/ install "$MAKEJOBS" fi diff --git a/ci/test/01_iwyu.patch b/ci/test/01_iwyu.patch new file mode 100644 index 00000000000..f976349bf57 --- /dev/null +++ b/ci/test/01_iwyu.patch @@ -0,0 +1,14 @@ +Prefer angled brackets over quotes for include directives. +See: https://en.cppreference.com/w/cpp/preprocessor/include.html. + +--- a/iwyu_path_util.cc ++++ b/iwyu_path_util.cc +@@ -211,7 +211,7 @@ bool IsQuotedInclude(const string& s) { + } + + string AddQuotes(string include_name, bool angled) { +- if (angled) { ++ if (true) { + return "<" + include_name + ">"; + } + return "\"" + include_name + "\""; diff --git a/ci/test_imagefile b/ci/test_imagefile index a0e1714ed5f..c0a25d88d88 100644 --- a/ci/test_imagefile +++ b/ci/test_imagefile @@ -15,7 +15,7 @@ ARG BASE_ROOT_DIR ENV BASE_ROOT_DIR=${BASE_ROOT_DIR} COPY ./ci/retry/retry /usr/bin/retry -COPY ./ci/test/00_setup_env.sh ./${FILE_ENV} ./ci/test/01_base_install.sh /ci_container_base/ci/test/ +COPY ./ci/test/00_setup_env.sh ./${FILE_ENV} ./ci/test/01_base_install.sh ./ci/test/01_iwyu.patch /ci_container_base/ci/test/ # Bash is required, so install it when missing RUN sh -c "bash -c 'true' || ( apk update && apk add --no-cache bash )"