[PATCH] Warn on explicit copy constructors.
Daniel Jasper
djasper at google.com
Tue Apr 29 07:53:33 PDT 2014
================
Comment at: clang-tidy/google/GoogleTidyModule.cpp:34
@@ +33,3 @@
+// token including trailing whitespace.
+SourceRange FindToken(const SourceManager &Sources, LangOptions LangOpts,
+ SourceLocation StartLoc, SourceLocation EndLoc,
----------------
IMO, passing in a lambda is a slight overkill here, at least until this is actually used for a second purpose. But ok.
================
Comment at: clang-tidy/google/GoogleTidyModule.cpp:62
@@ -38,1 +61,3 @@
return;
+ if (Ctor->isExplicit() || Ctor->isCopyOrMoveConstructor()) {
+ if (Ctor->isExplicit() && Ctor->isCopyOrMoveConstructor()) {
----------------
So, this is:
if (a || b) {
if (a && b) {
..
}
return;
}
I think this is easier to follow as:
if (a && b) {
..
}
if (a || b)
return;
And the latter if can actually be merged with the if concerning the parameter count.
http://reviews.llvm.org/D3541
More information about the cfe-commits
mailing list