[PATCH] D83501: [clangd][ObjC] Improve xrefs for protocols and classes

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 15 09:24:20 PDT 2020


sammccall added a comment.

In D83501#2148671 <https://reviews.llvm.org/D83501#2148671>, @dgoldman wrote:

> I implemented goto-definition from Foo() --> Foo impl in Xrefs, on the symbolcollector side I don't think there's anything to do?


This can't be done purely in xrefs as the AST may not be available.

A.m: `@class Foo; ^Foo x;` <-- go-to-definition at ^
B.m: `@interface Foo... at end @implementation Foo... at end`

The index needs to know that for the USR associated with the @class (found by targetDecl), the canonical decl is the @interface in B and the definition is the @implementation in B.
So SymbolCollector needs to see it as a definition. **The tests seem to show it does already**, but it's not obvious why from the code. Do you know? Maybe it's the fact that they share a USR and thus a symbol ID. This is worth making explicit somewhere.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83501/new/

https://reviews.llvm.org/D83501





More information about the cfe-commits mailing list