[PATCH] D71199: [clang-tidy][WIP] New check readability-prefer-initialization-list

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 12 04:18:01 PST 2019


baloghadamsoftware added a comment.

In D71199#1777887 <https://reviews.llvm.org/D71199#1777887>, @aaron.ballman wrote:

> 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`?


This check is to enforce C++ core guideline C.49 while the modernize check enforces guideline C.48. The two must be synchronized, and I think that this new check should do that: for initializations that should  be done using in-class initializers according to the other checker this checker must suggest the same. For the rest we should suggest member initializers in the constructor.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71199/new/

https://reviews.llvm.org/D71199





More information about the cfe-commits mailing list