[clang-tools-extra] Adding an initial version of the "Initialized Class Members" checker. (PR #65189)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 1 21:13:05 PDT 2023


PiotrZSL wrote:

" Checks that class members are initialized in constructors (implicitly or explicitly). Reports constructors or classes where class members are not initialized."
This is exacly what cppcoreguidelines-pro-type-member-init is doing.

And provide same warnings:
```
10:7: warning: constructor does not initialize these fields: X [cppcoreguidelines-pro-type-member-init]
50:8: warning: constructor does not initialize these fields: Y [cppcoreguidelines-pro-type-member-init]
```
The only warning that cppcoreguidelines-pro-type-member-init is doing does not provide is for implicitly deleted constructor, wiht is fine.
I didn't found any rule about this in Google codding standard.

Currently I dont see any reason for this check existence, and any benefit that it could bring over cppcoreguidelines-pro-type-member-init.
If somehow cppcoreguidelines-pro-type-member-init does not cover some important part, then basicly cppcoreguidelines-pro-type-member-init should be extended, or in extreame case just renamed into "bugprone-uninitialized-member", extended, and aliased into cppcoreguidelines or any other standards. Doing same thing from scrach and generate same kind of warnings is basicly reundant.



https://github.com/llvm/llvm-project/pull/65189


More information about the cfe-commits mailing list