[PATCH] D81769: Repair various issues with modernize-avoid-bind
Jeff Trull via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 12 15:24:13 PDT 2020
jaafar marked 3 inline comments as done.
jaafar added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp:38
enum BindArgumentKind { BK_Temporary, BK_Placeholder, BK_CallExpr, BK_Other };
-enum CaptureMode { CM_None, CM_ByRef, CM_ByValue, CM_InitExpression };
+enum CaptureMode { CM_None, CM_ByRef, CM_ByValue };
+enum CaptureExpr { CE_None, CE_Var, CE_InitExpression };
----------------
"Captured by reference" and "uses init expression" are not mutually exclusive - that gave rise to item 6 above.
================
Comment at: clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp:150
+static bool tryCaptureAsLocalVariable(const MatchFinder::MatchResult &Result,
+ BindArgument &B, const Expr *E);
----------------
These forward declarations seemed to make the diffs a lot easier to read. It's also possible to move the two functions into this position, of course.
================
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"
----------------
Is there a better way to express this? "a single child of type ThisExpr" was what I was going for...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81769/new/
https://reviews.llvm.org/D81769
More information about the cfe-commits
mailing list