Repository navigation
[engine] Enable cppcoreguidelines-pro-type-member-init clang-tidy check - #194576
Merged
auto-submit[bot] merged 4 commits intoOct 17, 2026
Merged
Conversation
|
This pull request is not mergeable in its current state, likely because of a merge conflict. Pre-submit CI jobs were not triggered. Pushing a new commit to this branch that resolves the issue will result in pre-submit jobs being scheduled. |
Enables the check that flags uninitialized member variables and locals of trivially-constructible record types, and fixes all existing violations found on the host and Android lint variants. Union-based geometry types (Vector3/4, HalfVector*, Quaternion, Shear) and SaveLayerOptions are suppressed with NOLINTBEGIN/END since the check doesn't understand that the union alternatives share storage.
gaaclarke
force-pushed
the
enable-pro-type-member-init
branch
from
October 16, 2026 17:22
5bcf37c to
9bfe677
Compare
gaaclarke
marked this pull request as ready for review
October 16, 2026 18:39
b-luk
approved these changes
Oct 16, 2026
Contributor
|
autosubmit label was removed for flutter/flutter/194576, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Member
Author
|
Do not revert if there are integration problems, that is possible with new linter rules |
This was referenced Oct 17, 2026
suryaKommana2662
pushed a commit
to suryaKommana2662/flutter
that referenced
this pull request
Oct 29, 2026
…ck (flutter#194576) This PR enables a linter check that flags uninitialized variables. We ran into a problem when flutter#194540 landed which was the result of uninitialized variables. This should catch those kinds of issues earlier. Most of this PR is generated by clang-tidy's fix operation, gemini operated where that failed. Description from gemini: > flutter#194540 fixed uninitialized counters in `DlComplexityPathReceiver` that caused a flaky `DisplayListComplexity.DrawShadow` failure. None of the clang-tidy checks we had enabled flag uninitialized members: `modernize-use-default-member-init` only rewrites existing constructor initializers, and the static analyzer gives up once the object is passed by reference to an out-of-line call. > > This enables `cppcoreguidelines-pro-type-member-init` (with `UseAssignment: true`) and fixes the existing violations: > > * Scalar/pointer/enum members get default member initializers (`= 0`, `= nullptr`, or an explicit enumerator). > * Uninitialized locals of trivially-constructible record types (`FragInfo`, `PointerData`, `struct stat`, ...) are value-initialized with `{}`. > * Union-based types where the check reports false positives (`Vector3`/`Vector4`, `HalfVector*`, `Quaternion`, `Shear`, `SaveLayerOptions`) are wrapped in `NOLINTBEGIN/END` with an explanation. > > Default member initializers don't change object size or layout. The only runtime cost is a few stores at construction, and most of those are dead stores the optimizer removes. > > Verified locally: `--lint-all` with this check is clean on `host_debug_unopt_arm64` (macOS) and `android_debug_unopt_arm64`, and both build. Linux host and iOS simulator lint variants will be checked by CI. > ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/AI-contribution-guidelines.md [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/website]: https://github.com/flutter/website [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enables a linter check that flags uninitialized variables. We ran into a problem when #194540 landed which was the result of uninitialized variables. This should catch those kinds of issues earlier. Most of this PR is generated by clang-tidy's fix operation, gemini operated where that failed.
Description from gemini:
Pre-launch Checklist
///).