[PATCH] Verify assign operator signatures.
Samuel Benzaquen
sbenza at google.com
Thu Feb 5 14:44:15 PST 2015
Added more checks.
Also fixed assigning by-value and assigning from a different type. Those are ok.
================
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:
> 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.
================
Comment at: clang-tidy/google/AssignOperatorSignatureCheck.h:25
@@ +24,3 @@
+public:
+ using ClangTidyCheck::ClangTidyCheck;
+ void registerMatchers(ast_matchers::MatchFinder *Finder) override;
----------------
alexfh wrote:
> Unfortunately, this needs to be done the old way. LLVM supports MSVS 2013 which doesn't support this form of constructor delegation.
Done.
http://reviews.llvm.org/D6667
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list