hokein added inline comments.

================
Comment at: clang-tools-extra/clangd/XRefs.cpp:1150
     // DeclRelation::Underlying.
-    DeclRelationSet Relations = DeclRelation::TemplatePattern |
+    DeclRelationSet Relations = DeclRelation::TemplateInstantiation |
                                 DeclRelation::Alias | DeclRelation::Underlying;
----------------
IIRC, clangd's index doesn't distinguish refs of template 
specifications/primary templates, all refs are treated as primary templates -- 
if we query refs for a template specification from the index, we'll get no 
results, so we will end up with refs from the main file (which are from the 
AST) only.


================
Comment at: clang-tools-extra/clangd/unittests/XRefsTests.cpp:1574
+       class Foo {};
        void func([[Fo^o]]<int>);
       )cpp",
----------------
hmm, the new behavior seems wired (at least in this case), I thought it is a 
bug at first glance, then I realized that this is xrefs for template 
specification. I'd expect to see  the primary template in refs in xrefs result.

however if there is an explicit template specification, excluding the primary 
template maybe reasonable.

```
template <typename T>
class Foo {};
template <> class [[Foo]]<int> {};
void func([[Fo^o]]<int>);
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87225

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

Reply via email to