sammccall added a comment.

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

> Looking further into the indexing support, I've questions:
>
> - How `targetDecl` should behave for these objc container types


(Hmm, targetDecl doesn't seem to canonicalize decls anywhere, which might be a 
bug, but it's unrelated to objc)

The main thing is that AIUI @implementation is one thing, as far as clang's 
concerned, while @class+@interface are another.
i.e. getCanonicalDecl() and USR generation both split them into equivalence 
classes {@implementation} and {@class, @interface}. Is that right?

In that case the thing targetDecl needs to do is "jump" from the implementation 
to the interface, because we're pretending they're the same decl.
It doesn't need to jump from the @class to the @interface, semantic 
canonicalization doesn't belong there. (In fact it may need to do the opposite, 
since targetDecl might be relying on implicitly canonicalizing with clang's 
semantics).

> - Similarly for SymbolCollector (guessing in 
> `SymbolCollector::handleDeclOccurrence` ?)

Right - this is where most of the real canonicalization happens.
You need to ensure that:

- isPreferred is true for @interface, so that when we see both @class and 
@interface we'll take the latter as our preferred declaration
- addDefinition gets called for @implementation, so that the definition 
location is set correctly. Also the SymbolID used in this case must be based on 
the USR of the interface, so we're considering them a single symbol. (Either 
addDeclaration should not be called in this case, or it should be called with 
the @implementation again somehow).

I think that should be enough...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83501



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to