iwyu: Add patch to prefer angled brackets over quotes for includes
What changed, and why it matters
This commit is a build-tooling change only. It adds a patch for the Include What You Use (IWYU) static-analysis tool used in Bitcoin Core's continuous integration (CI). The patch forces IWYU to suggest C++ #include statements using angle brackets (<...>) instead of quoted local paths ("..."). There is no change to Bitcoin Core's actual consensus, networking, wallet, or node code, and no security-relevant behavior is modified.
No security action required. Treat as a normal code-quality/CI maintenance change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit introduces ci/test/01_iwyu.patch, which modifies IWYU’s AddQuotes() to always return angle-bracketed includes by short-circuiting the angled parameter to true. It wires this patch into CI by applying it after cloning include-what-you-use, updates .gitignore to allow CI patch files, and copies the patch into the CI container image. This affects only the project’s linting/style-checking pipeline.
Changed components
ci/test/01_base_install.shci/test/01_iwyu.patch.gitignoreci/test_imagefileInspect captured patch +17 / −1
diff --git a/.gitignore b/.gitignore
index 3b22e358..b92988f6 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 a0f4164b..f1accd71 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 00000000..f976349b
--- /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 a0e1714e..c0a25d88 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 )"
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.