Oh, joy, clang-format 22 has compounded an existing bug where AllowShortBlocksOnASingleLine: Empty didn't work by applying the AllowShortBlocksOnASingleLine setting to functions, meaning that there is no way for us to move to clang 22 without some formatting churn.

#llvm #ClangFormat

[clang-format] `AllowShortBlocksOnASingleLine: Empty` does not allow short blocks on single lines · Issue #62117 · llvm/llvm-project

clang-format version: 16.0.0 on Windows 10 AllowShortBlocksOnASingleLine: Empty behaves like AllowShortBlocksOnASingleLine: Never for empty blocks. Minimal Example: Config: --- BasedOnStyle: Chromi...

GitHub

@david_chisnall The formatting churn for clang-format is so horrible. In my C++ project where formatting is enforced with clang-format, I have the Makefile create a Python venv into which I pip install clang-format=18.1.8 (using pip as a cross-platform distributor of version-locked clang-format builds).

Contrast to Rust, where I just run `cargo fmt` on my laptop, my desktop and in CI and it's fine.

Formatting churn across versions in a code formatter should be considered a bug.