nridge added inline comments.

================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp:86
+  // capture var intitializers.
+  if (const auto *const LExpr = llvm::dyn_cast<LambdaExpr>(Expr)) {
+    FindDeclRefsVisitor Visitor;
----------------
On the other hand, the exclusion of local variables declared inside lambdas 
should also apply to lambdas which are **subexpressions** of the selected 
expression. Consider:

```
template <typename T>
auto call(T t) { return t(); }

int main() {
  return [[ call([](){ int a = 1; return a + 1; }) ]] + 5;
}
```

Here, the presence of the local variable `a` inside the lambda should not 
interfere with the ability to extract the `call(...)` expression.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141757

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

Reply via email to