[clang-tools-extra] [clangd] SelectionTree marks nodes as complete only if children are complete (PR #82237)

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 19 03:26:24 PST 2024


https://github.com/sam-mccall created https://github.com/llvm/llvm-project/pull/82237

This seems to be the semantics expected by ~all callers, and simplifies
upcoming patches extending extract-variable.


>From 517d60a66ecae616e7c4037980b61fb4162b0c29 Mon Sep 17 00:00:00 2001
From: Sam McCall <sam.mccall at gmail.com>
Date: Mon, 19 Feb 2024 12:25:31 +0100
Subject: [PATCH] [clangd] SelectionTree marks nodes as complete only if
 children are complete

This seems to be the semantics expected by ~all callers, and simplifies
upcoming patches extending extract-variable.
---
 clang-tools-extra/clangd/unittests/SelectionTests.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang-tools-extra/clangd/unittests/SelectionTests.cpp b/clang-tools-extra/clangd/unittests/SelectionTests.cpp
index 754e8c287c5148..162428f8169158 100644
--- a/clang-tools-extra/clangd/unittests/SelectionTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SelectionTests.cpp
@@ -688,6 +688,7 @@ TEST(SelectionTest, Selected) {
       )cpp",
       R"cpp( $C[[^$C[[int]] a^]]; )cpp",
       R"cpp( $C[[^$C[[int]] a = $C[[5]]^]]; )cpp",
+      R"cpp( int x = [[2 ^+ $C[[2]]^]]; )cpp",
   };
   for (const char *C : Cases) {
     Annotations Test(C);



More information about the cfe-commits mailing list