[clang-tools-extra] [clangd] Find better insertion locations in DefineOutline tweak (PR #128164)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 5 22:53:21 PST 2025


================
@@ -470,10 +490,164 @@ TEST_F(DefineOutlineTest, InCppFile) {
             }
             }
         )cpp"},
+
+      // Criterion 1: Distance
+      {
+          R"cpp(
+            struct Foo {
+                void ignored1();     // Too far away
+                void ignored2();     // No definition
+                void ignored3() {}   // Defined inline
+                void fo^o() {}
+                void neighbor();
+            };
+            void Foo::ignored1() {}
+            void Foo::neighbor() {}
+        )cpp",
+          R"cpp(
+            struct Foo {
+                void ignored1();     // Too far away
+                void ignored2();     // No definition
+                void ignored3() {}   // Defined inline
+                void foo() ;
+                void neighbor();
+            };
+            void Foo::ignored1() {}
+            void Foo::foo() {}
+void Foo::neighbor() {}
+        )cpp",
+          SymbolSpecs{{"", "Foo", "ignored3", MakePos(4, 21), MakePos(4, 29),
----------------
HighCommander4 wrote:

Could you reformulate the tests to use the `DefineOutlineWorkspaceTest` fixture added in https://github.com/llvm/llvm-project/pull/160391? That should avoid any of this hard-coding of positions, manually building USRs, etc.

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


More information about the cfe-commits mailing list