jaafar marked 3 inline comments as done.
jaafar added inline comments.

================
Comment at: clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp:243
+  if ((std::distance(ME->child_begin(), ME->child_end()) == 1) &&
+      isa<CXXThisExpr>(*ME->children().begin())) {
+    // reference to data member without explicit "this"
----------------
njames93 wrote:
> jaafar wrote:
> > aaron.ballman wrote:
> > > jaafar wrote:
> > > > Is there a better way to express this? "a single child of type 
> > > > ThisExpr" was what I was going for...
> > > `if (isa<CXXThisExpr>(ME->getBase()))` -- `MemberExpr::children()` only 
> > > considers the base anyway, so there's only ever one child node to begin 
> > > with.
> > Could there be zero? I'm just worried about dereferencing 
> > `ME->children().begin()` before verifying there is at least one...
> > 
> The child nodes in `MemberExpr` just point to one node, its base, which 
> should never be null. Is it not simpler to just use this?
> ```
> if (isa<CXXThisExpr>(ME->getBase())) {
> ```
Ah, much better, thanks!


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

https://reviews.llvm.org/D81769



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

Reply via email to