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

Felix Berger via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 29 05:51:59 PST 2016


flx marked an inline comment as done.
flx added inline comments.


================
Comment at: clang-tidy/utils/DeclRefExprUtils.cpp:127
+      match(findAll(declRefExpr(equalsNode(&DeclRef),
+                                unless(hasAncestor(stmt(anyOf(
+                                    forStmt(), cxxForRangeStmt(), whileStmt(),
----------------
alexfh wrote:
> 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.
Why would this not work? Could you give an example? The way the function is written it handles my the use case for identifying when moving the parameter is not safe, so I could also just move it into the UnnecessaryValueParamCheck.


https://reviews.llvm.org/D27187





More information about the cfe-commits mailing list