================
@@ -104,9 +104,12 @@ bool isRootStmt(const Node *N) {
// Root statement cannot be partially selected.
if (N->Selected == SelectionTree::Partial)
return false;
- // Only DeclStmt can be an unselected RootStmt since VarDecls claim the
entire
- // selection range in selectionTree.
- if (N->Selected == SelectionTree::Unselected && !N->ASTNode.get<DeclStmt>())
+ // A DeclStmt can be an unselected RootStmt since VarDecls claim the entire
+ // selection range in selectionTree. Additionally, a CXXOperatorCallExpr of a
+ // binary operation can be unselected because it's children claim the entire
+ // selection range in the selection tree (e.g. <<).
+ if (N->Selected == SelectionTree::Unselected && !N->ASTNode.get<DeclStmt>()
&&
----------------
HighCommander4 wrote:
Do we need to make a corresponding change
[here](https://searchfox.org/llvm/rev/30213e99b86a078c9d472264c7edeea9aa638dd4/clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp#141-146)?
The comment suggests that it's special-casing `DeclStmt` for the same reason
as this code.
https://github.com/llvm/llvm-project/pull/81640
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits