[PATCH] D141757: [clangd] allow extracting to variable for complete lambda expressions

Julian Schmidt via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 29 05:15:18 PDT 2023


5chmidti updated this revision to Diff 518159.
5chmidti added a comment.

I took a little break, but here are the changes/fixes:

- moved the logic for variables referenced in captures into the visitor
  - short circuiting the `TraverseLambdaExpression` and using `TraverseLambdaCapture` to handle variable captures and the initialization fo init-captures
  - fixes both problems mentioned by nridge
- fix for immediately invoked lambda expressions
  - the selection of an IIL would mark the call operator as a referenced decl (fixed in `VisitDeclRefExpr`)
- fix condition in `CanExtractOutside` to allow an unselected parent that is a lambda expression
  - allows for the extraction of an initializer for init-capture variables
- block default arguments from prarameters of a lambda from being extracted to a function-local scope (fixed in `CanExtractOutside`)
- added more tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141757

Files:
  clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
  clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp
  clang-tools-extra/docs/ReleaseNotes.rst

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141757.518159.patch
Type: text/x-patch
Size: 13464 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230429/8fecdc34/attachment-0001.bin>


More information about the cfe-commits mailing list