nridge added inline comments.

================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp:84
+  // Local variables declared inside of the selected lambda cannot go out of
+  // scope. The DeclRefExprs that are important are the lambda captures and
+  // capture var intitializers.
----------------
What about variables referenced implicitly via a capture-default?

For example, consider:

```
int main() {
  if (int a = 1)
    if ([[ [&](){ return a + 1; } ]]() == 4)
      a = a + 1;
}
```

Here, the attempted extraction point is before the outer `if`, which is before 
the declaration of `a`, and the fact that the lambda references `a` should 
prevent that.


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