[PATCH] D114995: clang-tidy: improve the 'modernize-use-default-member-init'

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 3 07:30:09 PST 2022


aaron.ballman added a comment.

Mostly just minor nits at this point. Please be sure to update the documentation and add a release note about the changes.



================
Comment at: clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:1
+
 //===--- UseDefaultMemberInitCheck.cpp - clang-tidy------------------------===//
----------------
Spurious newline?


================
Comment at: clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:251
+  // it is hard to reconcile their sets of member initializers.
+  auto ClassDecl = dyn_cast<CXXRecordDecl>(Field->getParent());
+  if (std::count_if(ClassDecl->ctors().begin(), ClassDecl->ctors().end(),
----------------



================
Comment at: clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:252-253
+  auto ClassDecl = dyn_cast<CXXRecordDecl>(Field->getParent());
+  if (std::count_if(ClassDecl->ctors().begin(), ClassDecl->ctors().end(),
+                    [](const auto Ctor) { return !Ctor->isCopyOrMoveConstructor(); }) > 1)
+    return;
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114995



More information about the cfe-commits mailing list