diff options
Diffstat (limited to 'clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp index 1532c951a26..e9f617e2dc7 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp @@ -113,15 +113,12 @@ const Node *getParentOfRootStmts(const Node *CommonAnc) { return nullptr; switch (CommonAnc->Selected) { case SelectionTree::Selection::Unselected: + // Typicaly a block, with the { and } unselected, could also be ForStmt etc // Ensure all Children are RootStmts. return llvm::all_of(CommonAnc->Children, isRootStmt) ? CommonAnc : nullptr; case SelectionTree::Selection::Partial: - // Treat Partially selected VarDecl as completely selected since - // SelectionTree doesn't always select VarDecls correctly. - // FIXME: Remove this after D66872 is upstream) - if (!CommonAnc->ASTNode.get<VarDecl>()) - return nullptr; - LLVM_FALLTHROUGH; + // Only a fully-selected single statement can be selected. + return nullptr; case SelectionTree::Selection::Complete: // If the Common Ancestor is completely selected, then it's a root statement // and its parent will be unselected. |

