[PATCH] D71199: [clang-tidy][WIP] New check readability-prefer-initialization-list
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 10 10:46:25 PST 2019
aaron.ballman added a comment.
In D71199#1775083 <https://reviews.llvm.org/D71199#1775083>, @whisperity wrote:
> Can you refresh my memory on whether a rule for "if init expr is constant, initialise in class body instead" exists for init list members? If so, this will be a funny "two pass needed to fix" kind of check.
This worries me as well -- we already have checks that prefer doing an in-class initialization to using a constructor member initialization list. How should this check interact with `modernize-use-default-member-init`?
================
Comment at: clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp:91
+ CheckFactories.registerCheck<PreferInitializationListCheck>(
+ "readability-prefer-initialization-list");
CheckFactories.registerCheck<RedundantAccessSpecifiersCheck>(
----------------
I have a concern with the name using `initialization-list` -- that sounds a lot like the check is going to prefer `{42}` to `= 42`. Perhaps the name should be `prefer-ctor-member-initialization` or something along those lines?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71199/new/
https://reviews.llvm.org/D71199
More information about the cfe-commits
mailing list