⬆️ Update clang-tidy to version 23 - #2328
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Cpp-Linter Report
|
|
Side note here: It may be worth checking https://releases.llvm.org/23.1.0/tools/clang/tools/extra/docs/ReleaseNotes.html for checks that we should be explicitly enabling (e.g. a couple of the new LLVM checks) |
ed70b39 to
dc89acb
Compare
Temporarily run the complete C++ tree against the unreleased workflows change to surface new diagnostics. Assisted-by: GPT-5.6 Sol via Codex
Assisted-by: GPT-5.6 Sol via Codex
Enable the new format string, redundant casting, and vector utility checks where they apply without opting into the complete LLVM check family. Assisted-by: GPT-5.6 Sol via Codex
Include both fixable redundant template arguments and generic-lambda warnings in the Clang 23 canary so the final policy can be based on actual findings. Assisted-by: GPT-5.6 Sol via Codex
Clang 23 registers misc-explicit-constructor through the existing misc wildcard, making the retained google alias redundant. Assisted-by: GPT-5.6 Sol via Codex
Update clang-tidy suppressions from the retained Google alias to the Clang 23 misc check name. Assisted-by: GPT-5.6 Sol via Codex
Enable all modernize checks except trailing return types and add the trailing-comma readability check in both mirrored MLIR profiles. Assisted-by: GPT-5.6 Sol via Codex
dc89acb to
cfdb1a3
Compare
|
Important Approval pendingCodeRabbit has no unresolved comments, but it has not reviewed the latest commit. Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Apply the Clang 23 readability fix to lambdas whose empty parameter lists are optional in C++20. Assisted-by: GPT-5.6 Sol via Codex
Replace nested to_vector map and filter ranges with the dedicated LLVM helpers suggested by clang-tidy 23. Assisted-by: GPT-5.6 Sol via Codex
Infer single Case types from explicit lambda parameters and replace generic lambda parameters with their MLIR handle types. Assisted-by: GPT-5.6 Sol via Codex
Avoid constructing temporary single-character strings in the OpenQASM stress tests. Assisted-by: GPT-5.6 Sol via Codex
Apply Clang 23 trailing-comma fix-its and keep single-line lists unchanged to avoid removing syntactically required separator commas. Assisted-by: GPT-5.6 Sol via Codex
Rename structured-binding locals that Clang 23 identifies as member-style names. Assisted-by: GPT-5.6 Sol via Codex
Document that every consuming visitor branch already forwards its input and silence Clang 23 for the generic lambda. Assisted-by: GPT-5.6 Sol via Codex
Let Clang 23 infer the already-known MLIR wrapper types instead of recasting them. Assisted-by: GPT-5.6 Sol via Codex
Avoid repeating MLIR operation wrapper return types where the function already determines the target Value type. Assisted-by: GPT-5.6 Sol via Codex
Return views or static string literals from helpers whose results do not require ownership. Assisted-by: GPT-5.6 Sol via Codex
Use class template argument deduction for the fixed QDMI result sets in device tests. Assisted-by: GPT-5.6 Sol via Codex
Use C++20 designators for local aggregates so field assignments remain clear if their declarations evolve. Assisted-by: GPT-5.6 Sol via Codex
Spell out the external KV aggregate fields required by the Clang 23 designated-initializer check. Assisted-by: GPT-5.6 Sol via Codex
Rely on standard postfix and unary operator precedence in iterator expressions. Assisted-by: GPT-5.6 Sol via Codex
Name compound predicates where needed and preserve short-circuiting while reducing control-flow nesting. Assisted-by: GPT-5.6 Sol via Codex
Iterate directly when neither the mapping heuristic nor the program builder consumes an element index. Assisted-by: GPT-5.6 Sol via Codex
Back NumPy matrix views with capsule-owned dd::CVec instances instead of C-style dynamic arrays. Assisted-by: GPT-5.6 Sol via Codex
🤖 AI text below 🤖
Description
This draft exercises MQT Core with clang-tidy 23 before the shared workflow is released.
cpp-lintsession to require clang-tidy 23478992868226029b1e19d423d2dda2767e67670cllvm-formatv-string,llvm-redundant-casting,llvm-type-switch-case-types, andllvm-use-vector-utilsllvm-type-switch-case-typesis intentionally included in the canary even though MQT Core has well over 200 candidateTypeSwitch::Casesites. Typed-lambda findings should be automatically fixable, while generic-lambda findings are warning-only. This lets the decision whether to retain that style check be based on the actual report.Before this PR is marked ready, the temporary workflow pin will be replaced with the released workflow revision, changed-file filtering will be restored, and any Clang 23 findings will be addressed or documented.
Depends on munich-quantum-toolkit/workflows#448.
LLVM 23 release-note audit
google-explicit-constructorconfig alias and update existing suppressions to the canonicalmisc-explicit-constructornameperformance-faster-string-findrename requires no edit becauseperformance-*selectsperformance-prefer-single-char-overloadshicppmodule that are newly selected by existing wildcardsCanary results
The first full-tree run successfully used clang-tidy 23.1.1 from
/usr/lib/llvm-23/binand reported 673 clang-tidy findings and no clang-format findings. The main groups were:misc-const-correctnessreadability-trailing-commareadability-redundant-lambda-parameter-listbugprone-signed-bitwisereadability-redundant-parenthesesThe remaining 15 findings were spread across eight checks. A follow-up canary with all four new LLVM checks enabled is in progress.
Validation
uvx nox -s lintmlir/.clang-tidyandbindings/mlir/.clang-tidyconfigurations verified identicalThe clang-tidy 23 full-tree run is intentionally delegated to this draft PR's C++ linter job.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).