[PATCH] Verify assign operator signatures.

Samuel Benzaquen sbenza at google.com
Fri Feb 6 09:16:55 PST 2015


wrt virtual, I don't know. Maybe there is a good reason to make it virtual? Doesn't seem like a common mistake anyway.
wrt category for the check, I agree. I'll move it once we have no more comments on the code.


================
Comment at: clang-tidy/google/AssignOperatorSignatureCheck.cpp:23
@@ +22,3 @@
+  Finder->addMatcher(
+      methodDecl(unless(isDeleted()), unless(isPrivate()), hasName("operator="),
+                 ofClass(recordDecl().bind("class")),
----------------
alexfh wrote:
> sbenza wrote:
> > alexfh wrote:
> > > I guess you missed "unless(isImplicit())" (and a test for it). And maybe also unless(isInTemplateInstantiation()) (especially, if you would want to provide a fixit for the "const T& operator=(const T&)" case).
> > I could add unless(isImplicit()), but the implicit one will have the right signature, so it shouldn't match anyway.
> Reasonable. Maybe a comment would not be useless.
I just added the call. It is correct and self documenting.

http://reviews.llvm.org/D6667

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list