⬆️ Update clang-tidy to version 23 - #2328
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
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
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 |
5cd62d8 to
4b1c478
Compare
4b1c478 to
6e0f464
Compare
burgholzer
left a comment
There was a problem hiding this comment.
I genuinely like these changes quite a bit.
A good mixture of nicer formatting and more efficient LLVM API usage.
I just found three things (beyond the remaining linter errors) that I feel should be addressed here as well.
I'd actually argue that tonight (or tomorrow morning) would be a good time to get this PR merged as there is not too much other activity currently close to merge ready.
So I am already approving here just in case we manage to get this over the finish line quickly.
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
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
Make shift widths and masks explicitly unsigned and handle the full signed exponent range without overflow. Assisted-by: GPT-5.6 Sol via Codex
Use structured bindings for initialization and retain intentional tuple reassignments with narrow suppressions. Assisted-by: GPT-5.6 Sol via Codex
Make both the deduced pointer and its pointee const as requested by readability-qualified-auto. Assisted-by: GPT-5.6 Sol via Codex
Apply Clang 23 const-correctness suggestions to 205 immutable local values in the non-MLIR tests. Assisted-by: GPT-5.6 Sol via Codex
Apply Clang 23 const-correctness suggestions to 14 immutable local values outside MLIR. Assisted-by: GPT-5.6 Sol via Codex
Apply Clang 23 const-correctness suggestions to 11 local aliases that never mutate their referents. Assisted-by: GPT-5.6 Sol via Codex
Use const pointees for read-only traversals and handles, retain mutable output buffers, and preserve the C ABI types of unused output parameters. Assisted-by: GPT-5.6 Sol via Codex
Assisted-by: GPT-5.6 Sol via Codex
Note that the workflow is still pinned to the commit of this PR: munich-quantum-toolkit/workflows#448 Should we create a release in the workflows repo or just merge the PR there and pin main? |
Replace the structured-binding suppressions with real declarations and adapt the QCO additions from the updated main branch. Assisted-by: GPT-5.6 Sol via Codex
Carry the Clang 23 cleanup across the compiler and Qiskit changes added on main. Assisted-by: GPT-5.6 Sol via Codex
Adapt the OpenQASM frontend and translation changes from main to the Clang 23 diagnostics. Assisted-by: GPT-5.6 Sol via Codex
Place the matrix row comments on their initializer rows and use moduleOp consistently in the Pauli twirling tests. Assisted-by: GPT-5.6 Sol via Codex
6e0f464 to
9bc85c3
Compare
Assisted-by: GPT-5.6 Sol via Codex
Assisted-by: GPT-5.6 Sol via Codex
114eedd to
bd899b5
Compare
I'll quickly merge the workflows PR and draft a new patch release 👍🏻 thanks for pushing this to the finish line! |
Use the stable release for all reusable workflows and restore changed-file filtering after the full-tree Clang 23 canary. Assisted-by: GPT-5.6 via Codex
Keep the standard range overloads when locating gate specifications and the preferred entangler. Suppress the libstdc++-specific qualified-auto suggestion because the standard does not require std::array iterators to be pointers. Assisted-by: GPT-5.6 via Codex
🤖 AI text below 🤖
Description
This PR updates MQT Core to clang-tidy 23 and adapts the C++ sources to the diagnostics exposed by the upgrade.
Codex assisted with the release-note audit, mechanical source updates, validation, and PR maintenance.
cpp-lintsessionae4c1005796fedc123c3c70cdba94ce643c9fcaellvm-formatv-string,llvm-redundant-casting,llvm-type-switch-case-types, andllvm-use-vector-utilsmainLLVM 23 release-note audit
google-explicit-constructorconfig alias and update existing suppressions to the canonicalmisc-explicit-constructornameperformance-faster-string-findrename requires no configuration edit becauseperformance-*selectsperformance-prefer-single-char-overloadshicppmodule that are newly selected by existing wildcardsllvm-type-switch-case-typesCanary results
The first full-tree run used clang-tidy 23.1.1 from
/usr/lib/llvm-23/binand reported 673 clang-tidy findings and no clang-format findings. After the initial cleanup, the remaining 344 findings were resolved in grouped commits:misc-const-correctnessmodernize-use-structured-bindingbugprone-signed-bitwisereadability-trailing-commareadability-redundant-lambda-parameter-listreadability-qualified-autoAll 42 temporary
modernize-use-structured-bindingsuppressions were subsequently replaced with real structured-binding declarations for the initial returned state. Later state updates remainstd::tieassignments because C++20 has no destructuring-assignment syntax. Rebasing onto the updatedmainexposed additional Clang 23 diagnostics in the new compiler, Qiskit, and OpenQASM code; these were addressed in separate follow-up commits.Validation
uvx nox -s lintuvx nox -s cpp-lint -- --allwith clang-tidy 23.1.1: zero clang-format and clang-tidy findingspopcount,rotl, androtrconditionsmlir/.clang-tidyandbindings/mlir/.clang-tidyconfigurations verified identicaldc1465dccis pendingChecklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).