[PATCH] D81769: [clang-tidy] Repair various issues with modernize-avoid-bind

Jeff Trull via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 22 18:17:34 PDT 2020


jaafar marked an inline comment 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"
----------------
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...



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

https://reviews.llvm.org/D81769





More information about the cfe-commits mailing list