[clang-tools-extra] [clangd] Do not offer extraction to variable for decl init expression (PR #69477)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 4 01:19:20 PST 2024


================
@@ -490,6 +491,13 @@ bool eligibleForExtraction(const SelectionTree::Node *N) {
         BO->getRHS() == OuterImplicit.ASTNode.get<Expr>())
       return false;
   }
+  if (const auto *Decl = Parent->ASTNode.get<VarDecl>()) {
+    if (!Decl->isInitCapture() &&
----------------
kadircet wrote:

it's not obvious to me why we check for anything but initializer being the outerimplict node itself. can you add comments and test cases?

https://github.com/llvm/llvm-project/pull/69477


More information about the cfe-commits mailing list