Repository navigation
Fix clang-tidy 23 findings and prepare .clang-tidy for it - #121371
Conversation
clang-tidy 23 added new checks and renamed some existing ones, failing the tidy build with ~188 unique findings across 22 check names. Disable the new noisy checks in `.clang-tidy` (per the policy at the top of the file), including the new canonical names of already-disabled checks (`bugprone-signed-bitwise` for `hicpp-signed-bitwise`, `portability-no-assembler` for `hicpp-no-assembler`) and the new aliases of `google-explicit-constructor`, whose `NOLINT`s in the code reference the google name. Fix the small mechanical findings: - `modernize-redundant-void-arg`: `std::function<void(void)>` and similar in 7 places. - `readability-redundant-casting`: remove 11 redundant casts. - `bugprone-unsafe-to-allow-exceptions`: `NOLINT` the deliberately throwing `~SimpleFaultInjection`. Split out of the clang-23 toolchain PR; the compiler-diagnostic part of the original commit (`cmake/warnings.cmake`) stays there. CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117346&sha=ed8367eb17b594dbb12b741e1354473f53f82c11&name_0=PR&name_1=Build%20%28arm_tidy%29 PR: #117346 Co-Authored-By: Claude Fable 5 <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
Disable `bugprone-unhandled-code-paths` (new in clang-tidy 23): all 7 findings were on switches already carrying `NOLINT(bugprone-switch-missing-default-case)`, so the check duplicates the enabled `bugprone-switch-missing-default-case` for this codebase. Remove 11 redundant `static_cast<size_t>(i + 1)` casts flagged by `readability-redundant-casting` in `gtest_coordination_changelog.cpp`; `i` is already `size_t` in all of them. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117346&sha=e687a44500e92d797a393e030550f128b219ffa9&name_0=PR&name_1=Build%20%28arm_tidy%29 #117346 Co-Authored-By: Claude Fable 5 <[email protected]>
clang-tidy 23 flags `.get()->` on smart pointers (`readability-redundant-smartptr-get`) in more contexts. Split out of the clang-23 toolchain PR; the libc++ 23 build fix in `gtest_compressionCodec.cpp` from the original commit stays there. CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=116787&sha=da3ff9339cf7c2a77486aca83edd682a26824bb2&name_0=PR&name_1=Build%20%28arm_tidy%29 PR: #116787 Co-Authored-By: Claude Fable 5 <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Workflow [PR], commit [caaa489] Summary: ✅
AI ReviewSummaryThis PR updates Missing context / blind spots
Final Verdict
LLVM Coverage ReportMeasured on commit caaa489.
Changed lines: Changed C/C++ lines covered: 596/680 (87.65%) · Uncovered code |
|
Ops, I noticed too late that @Algunenano assigned. |
…-static-initialization-cycle` - Drop the "new in clang-tidy 23" remarks and give the reason for disabling instead. - Say "alias of `google-explicit-constructor`" for the `cppcoreguidelines-` and `misc-` names. - `bugprone-unhandled-code-paths` is not an alias of `bugprone-switch-missing-default-case` but a separate check that also flags `if`/`else if` chains without `else`; say so. - Instead of disabling `misc-static-initialization-cycle`, add a `NOLINT` at the single place it fires (`QuotaKeyTypeInfo::get`). - `readability-trivial-switch` flags single-case `switch` over enums, which we use deliberately for `-Wswitch` coverage; `bugprone-signed-bitwise` has about 2000 findings. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…-in-selection-statement` Rewrite all assignments inside `if`/`while` conditions and inside operands of `&&`/`||`. The type-dispatch chains of the form `(res = execute<T1>(...)) || (res = execute<T2>(...)) || ...` in `Functions/` now use `TypeListUtils::forEach` over a `TypeList`; the other sites declare the variable in the condition, use an init-statement, or assign before the check. Evaluation order and short-circuiting are preserved, so there are no behavior changes. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Replace the hand-written rotate idiom `(x >> n) | (x << (w - n))` with `std::rotr` in `intHash32` and in the Snappy CRC masking, and drop the redundant `std::string` temporaries where the callee takes a `std::string_view`. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…-switch` succeed `hicpp-multiway-paths-covered` The `hicpp` module was removed in clang-tidy 23 and `hicpp-multiway-paths-covered`, which has been disabled here for years, was split into these two checks. Co-Authored-By: Claude Fable 5.1 <[email protected]>
# Conflicts: # src/Functions/FunctionsComparison.h # src/Parsers/ExpressionListParsers.cpp
This code is only compiled with `USE_BUZZHOUSE`, so it was missed by the local clang-tidy run. Fixes `bugprone-assignment-in-if-condition` reported by `arm_tidy`, and `bugprone-assignment-in-selection-statement` which only clang-tidy 23 reports. https://s3.amazonaws.com/clickhouse-test-reports/PRs/121371/fc9221b6d367a40760bfc07f273e93be4067ecdd/pr/build_arm_tidy/build_clickhouse/build_clickhouse.log PR: #121371 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes110 object files changed (+1.22 MiB total), 0 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units1502 translation units recompiled, 11055 s compile time in total, 1501 of them have a recent master baseline. Median compile-time ratio to the baselines is ×1.07 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
The `readability-redundant-casting` cleanup dropped `static_cast<size_t>` around `total_size - offset`. On Linux the subtraction is `unsigned long`, the same as `size_t`, so the cast looked redundant. On Darwin `off_t` is `long long`, so the result is `unsigned long long`, and `std::min` fails to deduce a common type with `size_t`. Use `std::min<size_t>` instead, which works on both platforms without a cast that clang-tidy flags. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121371&sha=c4fd591112d13f143f359f0d3dacddcc9511e3a8&name_0=PR&name_1=Build%20(arm_darwin) #121371 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
📊 Cloud Performance Report
This PR is a clang-tidy cleanup: it moves assignments out of if/while conditions, removes redundant casts and .get() calls, and swaps manual rotates for std::rotr. None of these change how queries execute; the intHash32 rotate rewrite produces the same instructions. The five ClickBench GROUP BY flags (Q16, Q18, Q32, Q33, Q34: +6.7% to +16.2%) all stay not_sure. Q16 and Q33 fall inside master's current range, and two source runs shared a host, which fits a matching CPU slowdown across the board. The TPC-H Q1/Q7 speedups (-18.5%, -16.0%) are about 12 ms on fast queries with unstable baselines, so no performance change can be attributed to this PR. clickbenchFlagged queries (5 of 43)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_officialFlagged queries (2 of 22)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. Debug info
|
# Conflicts: # src/Client/BuzzHouse/Generator/StatementGenerator.cpp # src/Coordination/KeeperStorage.cpp
The check was renamed to `bugprone-assignment-in-selection-statement` in clang-tidy 23, but CI still runs an older clang-tidy that uses the old name (it reported `src/Common/UTF8Helpers.cpp:144`). Disable both spellings and the `cert-exp45-c` alias. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
`Build (amd_fuzzers)` on master fails again at the link step of `clickhouse_fuzzer`, starting with 4127c65 (ClickHouse#121371): ld.lld-22: error: .../libclang_rt_asan.a(sanitizer_stackdepot.cpp.o):(function __sanitizer::(anonymous namespace)::CompressThread::NewWorkNotify(): .text+0x19e): relocation R_X86_64_PC32 out of range: 2148873898 is not in [-2147483648, 2147483647]; references section '.bss' This is the same overflow as in e56a18c: the image sits right at the 2 GiB reach of the small code model, and any commit can tip it over. Shaving a few MiB again would only postpone the next failure, so remove the largest thing in that range that the fuzzers do not need. `-fsanitize=fuzzer-no-link` implies `-fsanitize-coverage=pc-table`, which emits 16 bytes per instrumented edge into `__sancov_pcs`. It is a writable section, so `lld` places it between `.text` and `.bss`. Measured on `KeyCondition.cpp`, `InterpreterSelectQuery.cpp` and `FunctionsConversion.cpp` compiled with the CI flags, it is 20-25% of the instrumented `.text`, i.e. several hundred MiB for the whole image. With `-fno-sanitize-coverage=pc-table` the `.text` and `__sancov_cntrs` are unchanged and `__sancov_pcs` is gone. libFuzzer gets coverage feedback from the inline 8-bit counters; the PC table only serves reporting (`cov:` in the progress lines, `NEW_FUNC`, `-print_pcs`, `-print_coverage`, `-print_funcs`) and `-focus_function`, none of which CI uses. `ft:` stays in the progress lines, and the report in `libfuzzer_test_check.py` already treats `cov` as optional. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=501d978d7b9daa2036adbf79f930fae5db42219c&name_0=MasterCI&name_1=Build%20%28amd_fuzzers%29 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rement Resolve the conflict in `src/Common/Increment.h` with master's clang-tidy 23 fixes (ClickHouse#121371): keep the `min_initial_value` / provider arguments of `getBunch` and drop the redundant `static_cast<UInt64>` around the result, as master did. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #117346
Split out of the clang-23 toolchain PR so it can land on its own. clang-tidy 23 adds new checks and renames some existing ones, which fails the tidy build with about 188 unique findings across 22 check names. This PR:
.clang-tidyper the policy at the top of the file, including the new canonical names of already-disabled checks (bugprone-signed-bitwiseforhicpp-signed-bitwise,portability-no-assemblerforhicpp-no-assembler), the new aliases ofgoogle-explicit-constructorwhoseNOLINTs in the code reference the google name, andbugprone-unhandled-code-paths, which duplicates the enabledbugprone-switch-missing-default-case;modernize-redundant-void-arg(std::function<void(void)>and similar in 7 places),readability-redundant-casting(22 redundant casts),readability-redundant-smartptr-get(.get()->on smart pointers), and aNOLINTforbugprone-unsafe-to-allow-exceptionson the deliberately throwing~SimpleFaultInjection.The disabled check names that do not exist in clang-tidy 22 are ignored by it (
clang-tidy --verify-configlists them as unknown, a normal run does not), so the config keeps working with the current toolchain. The compiler-diagnostic change (cmake/warnings.cmake) and the libc++ 23 build fix ingtest_compressionCodec.cppfrom the original commits stay in the clang-23 PR.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Prepare
.clang-tidyand fix mechanical findings for clang-tidy 23.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/121371]
Version info
26.10.1.1404-master(included in26.10and later)