[clang-tools-extra] [clangd] Update XRefs to support overriden ObjC methods (PR #127109)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 14 02:20:11 PST 2025


================
@@ -1283,6 +1295,17 @@ std::vector<LocatedSymbol> findImplementations(ParsedAST &AST, Position Pos,
     } else if (const auto *RD = dyn_cast<CXXRecordDecl>(ND)) {
       IDs.insert(getSymbolID(RD));
       QueryKind = RelationKind::BaseOf;
+    } else if (const auto *OMD = dyn_cast<ObjCMethodDecl>(ND)) {
+      IDs.insert(getSymbolID(OMD));
+      QueryKind = RelationKind::OverriddenBy;
+
+      llvm::SmallVector<const ObjCMethodDecl *, 4> Overrides;
+      OMD->getOverriddenMethods(Overrides);
+      for (const auto *Override : Overrides)
+        IDs.insert(getSymbolID(Override));
----------------
kadircet wrote:

just to be clear, this is going to retrieve implementations for the virtual method hierarchy starting from parent of this node, not just the subtree rooted at this particular method-decl. this seems a little surprising to me, is this intended ?

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


More information about the cfe-commits mailing list