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

David Goldman via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 19 09:48:11 PST 2025


================
@@ -430,6 +439,27 @@ locateASTReferent(SourceLocation CurLoc, const syntax::Token *TouchedIdentifier,
         continue;
       }
     }
+    // Special case: - (void)^method {} should jump to overrides, but the decl
+    // shouldn't, only the definition. Note that an Objective-C method can
+    // override a parent class or protocol.
+    //
+    // FIXME: Support jumping from a protocol decl to overrides on go-to
+    // definition.
+    if (const auto *OMD = llvm::dyn_cast<ObjCMethodDecl>(D)) {
+      if (TouchedIdentifier &&
+          objcMethodIsTouched(SM, OMD, TouchedIdentifier->location()) &&
+          OMD->isThisDeclarationADefinition()) {
----------------
DavidGoldman wrote:

Done

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


More information about the cfe-commits mailing list