What changed, and why it matters
This commit is a routine tooling change for Bitcoin Core. It adds the clang-format package to a CI environment, runs clang-format after an automated include-sorting tool, and changes a formatting configuration option so that #include statements are regrouped and sorted. There is no change to the actual Bitcoin software logic, network behavior, or wallet handling, so it does not affect users' funds or node security.
No security action needed. This is a code-style/CI maintenance commit. Reviewers may verify that the new clang-format invocation does not accidentally reformat unrelated code, but the change is cosmetic.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies three files: (1) ci/test/00_setup_env_native_iwyu.sh adds clang-format-${TIDY_LLVM_V} to the CI package list; (2) ci/test/03_test_script.sh pipes the diff produced by include-what-you-use’s fix_includes.py through contrib/devtools/clang-format-diff.py for in-place formatting; (3) src/.clang-format changes IncludeBlocks from Preserve to Regroup so clang-format will reorder and regroup #include blocks. No source code semantics are changed.
Changed components
ci/test/00_setup_env_native_iwyu.shci/test/03_test_script.shsrc/.clang-formatInspect captured patch +3 / −2
diff --git a/ci/test/00_setup_env_native_iwyu.sh b/ci/test/00_setup_env_native_iwyu.sh
index dbb45ed7..3868510d 100755
--- a/ci/test/00_setup_env_native_iwyu.sh
+++ b/ci/test/00_setup_env_native_iwyu.sh
@@ -10,7 +10,7 @@ export CI_IMAGE_NAME_TAG="mirror.gcr.io/debian:trixie" # To build codegen, CMak
export CONTAINER_NAME=ci_native_iwyu
export TIDY_LLVM_V="21"
export APT_LLVM_V="${TIDY_LLVM_V}"
-export PACKAGES="clang-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev jq libevent-dev libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto"
+export PACKAGES="clang-${TIDY_LLVM_V} clang-format-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev jq libevent-dev libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto"
export NO_DEPENDS=1
export RUN_UNIT_TESTS=false
export RUN_FUNCTIONAL_TESTS=false
diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh
index 32739a13..9bfa2bb1 100755
--- a/ci/test/03_test_script.sh
+++ b/ci/test/03_test_script.sh
@@ -226,6 +226,7 @@ if [[ "${RUN_IWYU}" == true ]]; then
-Xiwyu --max_line_length=160 \
2>&1 | tee /tmp/iwyu_ci.out
python3 "/include-what-you-use/fix_includes.py" --nosafe_headers < /tmp/iwyu_ci.out
+ git diff -U0 | ./contrib/devtools/clang-format-diff.py -binary="clang-format-${TIDY_LLVM_V}" -p1 -i -v
}
run_iwyu "compile_commands_iwyu_errors.json"
diff --git a/src/.clang-format b/src/.clang-format
index c5fcd0b4..4db09138 100644
--- a/src/.clang-format
+++ b/src/.clang-format
@@ -97,7 +97,7 @@ ForEachMacros:
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
-IncludeBlocks: Preserve
+IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<bitcoin-build-config\.h>'
Priority: -1
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.