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

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 19 06:07:31 PST 2025


================
@@ -411,6 +411,58 @@ TEST(LocateSymbol, FindOverrides) {
                                    sym("foo", Code.range("2"), std::nullopt)));
 }
 
+TEST(LocateSymbol, FindOverridesObjC) {
+  auto Code = Annotations(R"objc(
+    @protocol Fooey
+    - (void)foo;
+    @end
+    @interface Base
+    - (void)foo;
+    @end
+    @interface Foo : Base<Fooey>
+    - (void)$1[[foo]];
+    @end
+
+    @interface Bar : Foo
+    - (void)$2[[foo]];
----------------
kadircet wrote:

so we'll now also report 2 symbols when you invoke go-to here. both $1 and $3. i don't think that'll help users in the general case (99% of the time you just want to go to defintion file, without clicking any extra buttons).

do you think it'd make sense to limit this to the case where we're on the definition ? (i have my hesitations even for that one, but doing go-to-def on definition is less common so showing more alternatives at that point sounds OK).

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


More information about the cfe-commits mailing list