[PATCH] D14145: modernize-use-default supports copy constructor and copy-assignment operator.

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 28 09:24:11 PDT 2015


klimek added inline comments.

================
Comment at: clang-tidy/modernize/UseDefaultCheck.cpp:83-91
@@ +82,11 @@
+                             const CXXMethodDecl *Method) {
+  if (Method->getNumParams() != 1)
+    return false;
+  QualType ArgType = Method->getParamDecl(0)->getType();
+
+  const auto *Record = Method->getParent();
+  QualType RecordType = Context->getTypeDeclType(Record);
+
+  return !ArgType.isNull() && ArgType->isLValueReferenceType() &&
+         ArgType.getNonReferenceType().getUnqualifiedType() == RecordType;
+}
----------------
This looks like something we'd want to matcherify, too.

================
Comment at: clang-tidy/modernize/UseDefaultCheck.cpp:152-153
@@ +151,4 @@
+
+  return Ctor->getNumCtorInitializers() ==
+         BasesToInit.size() + FieldsToInit.size();
+}
----------------
In which cases can this be false? (I assume if not all are copied?)


http://reviews.llvm.org/D14145





More information about the cfe-commits mailing list