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

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 23 00:05:51 PST 2023


kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

branch cut is upon us, so it'd be great if you can land this soon (or let us know if you don't have commit access)



================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp:158
       if (isa<clang::Expr>(Stmt))
-        return !isa<LambdaExpr>(Stmt);
+        return !(isa<LambdaExpr>(Stmt) &&
+                 InsertionPoint->Selected != SelectionTree::Complete);
----------------
nit: can we re-write this as: `!isa<LambdaExpr>(Stmt) || InsertionPoint->Selected == SelectionTree::Complete` ?


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:81
 
+- The extract variable tweak gained support for extracting complete lambda expressions to a variable.
+
----------------
nridge wrote:
> Maybe add a "Code Actions" section for this?
+1


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141757



More information about the cfe-commits mailing list