ztamas marked 5 inline comments as done.
ztamas added inline comments.

================
Comment at: 
clang-tools-extra/clang-tidy/bugprone/UnhandledSelfAssignmentCheck.cpp:34-36
+  const auto HasNoSelfCheck = cxxMethodDecl(unless(hasDescendant(
+      binaryOperator(anyOf(hasOperatorName("=="), hasOperatorName("!=")),
+                     has(ignoringParenCasts(cxxThisExpr()))))));
----------------
ztamas wrote:
> aaron.ballman wrote:
> > Will this also match code like:
> > ```
> > Frobble &Frobble::operator=(const Frobble &F) {
> >   if (&F == this->whatever())
> >     return *this;
> > }
> > ```
> > or, more insidiously: 
> > ```
> > Frobble &Frobble::operator=(const Frobble &F) {
> >   if (&F == whatever()) // whatever is a member function of Frobble
> >     return *this;
> > }
> > ```
> > 
> I'll check that case. The original hasLHS(...), hasRHS(...) might work with 
> this use case too.
I added NotSelfCheck test case for this, which works correctly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60507/new/

https://reviews.llvm.org/D60507



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to