[PATCH] D18961: Add a readability-deleted-default clang-tidy check.
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 12 03:46:25 PDT 2016
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.
Looks good. A couple of comments.
I'm happy to commit the patch for you once you answer the comments.
Thank you for the work!
================
Comment at: clang-tidy/readability/DeletedDefaultCheck.cpp:36
@@ +35,3 @@
+}
+
+void DeletedDefaultCheck::check(const MatchFinder::MatchResult &Result) {
----------------
I would at least join matchers, since, I believe, it might be more effective that way.
cxxMethodDecl(anyOf(cxxConstructorDecl().bind("constructor"),
isCopyAssignmentOperator(),
isMoveAssignmentOperator()),
isBadlyDefaulted)
.bind("assignment")
Optionally, you might want to inline the `isBadlyDefaulted` matcher (without the external `allOf` matcher).
As for restructuring the `check()` method, I don't insist.
================
Comment at: clang-tidy/readability/DeletedDefaultCheck.cpp:49
@@ +48,3 @@
+ "constructor";
+ return;
+ }
----------------
If you don't feel strongly, I'd mildly suggest to turn `if { ... return }` to a chain of `if/else` (also the top-level ones). The code will become denser, but it will be easier to see the whole logic in a glance.
http://reviews.llvm.org/D18961
More information about the cfe-commits
mailing list