[PATCH] D27187: [clang-tidy] Do not move parameter if only DeclRefExpr occurs inside of a loop

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 29 02:06:31 PST 2016


alexfh added inline comments.


================
Comment at: clang-tidy/utils/DeclRefExprUtils.cpp:127
+      match(findAll(declRefExpr(equalsNode(&DeclRef),
+                                unless(hasAncestor(stmt(anyOf(
+                                    forStmt(), cxxForRangeStmt(), whileStmt(),
----------------
How will this work with lambdas / local classes declared inside a loop? Not sure if this case is going to happen in real code, but we'd better be clear about the limitations of the implementation.


================
Comment at: clang-tidy/utils/DeclRefExprUtils.cpp:129
+                                    forStmt(), cxxForRangeStmt(), whileStmt(),
+                                    doStmt()))))).bind("declRef")),
+            Stmt, Context);
----------------
Do you actually need to bind the node to "declRef"?


Repository:
  rL LLVM

https://reviews.llvm.org/D27187





More information about the cfe-commits mailing list