[clang-tools-extra] Implemented recursive search for findImplementations (PR #177564)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 26 22:03:11 PST 2026


================
@@ -1923,6 +1923,42 @@ TEST(FindImplementations, Inheritance) {
   }
 }
 
+TEST(FindImplementations, InheritanceRecursion) {
+  // Make sure inheritance is followed, but does not diverge.
+  llvm::StringRef Test = R"cpp(
+    template <int>
+    struct [[Ev^en]];
----------------
HighCommander4 wrote:

nit: It's a bit misleading that the test is using [`LocatedSymbol::PreferredDeclaration`](https://searchfox.org/llvm/rev/f4d41a4efb2359a54a3879cd056db2fdb5082b80/clang-tools-extra/clangd/unittests/XRefsTests.cpp#55), which in this case is the forward-decl, when the [actual LSP request](https://searchfox.org/llvm/rev/f4d41a4efb2359a54a3879cd056db2fdb5082b80/clang-tools-extra/clangd/ClangdLSPServer.cpp#1531) returns `LocatedSymbol::Definition` when available (here, the primary template definition).

Can we introduce a `defRange` and use that in `findImplementations` tests?

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


More information about the cfe-commits mailing list