[PATCH] D69145: Give readability-redundant-member-init an option IgnoreBaseInCopyConstructors to avoid breaking code with gcc -Werror=extra

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 28 09:02:42 PDT 2019


aaron.ballman added a comment.

In D69145#1720254 <https://reviews.llvm.org/D69145#1720254>, @poelmanc wrote:

> What do @malcolm.parsons, @alexfh, @hokein, @aaron.ballman, @lebedev.ri think of @mgehre's suggestion to enable `IgnoreBaseInCopyConstructors` as the default setting, so gcc users won't experience build errors and think "clang-tidy broke my code!"
>
> I could go either way and appreciate any input.


I think GCC is being overly pedantic, but I don't see much harm in enabling the option by default.



================
Comment at: clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.cpp:60
+  if (IgnoreBaseInCopyConstructors && ConstructorDecl->isCopyConstructor() &&
+      Init->isBaseInitializer()) {
+    return;
----------------
You should elide the braces here per our coding standard.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D69145





More information about the cfe-commits mailing list