kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: clang-tools-extra/clangd/FindTarget.cpp:478
+          explicitReferenceTargets(DynTypedNode::create(L.getType()),
+                                   DeclRelation::Alias)};
     }
----------------
ilya-biryukov wrote:
> kadircet wrote:
> > can you explain why these two are special and get to keep `Alias` decls? 
> > Whereas the others dont?
> There are two cases to consider for a reference of the form `Templ<int>` in 
> type positions:
> 1. `Templ` is a template type alias
> ```
> template <class X>
> Templ = vector<X>;
> ```
> in this case `targetDecl` returns `Templ` with mask `Alias | TemplatePattern` 
>  and `vector<int>` with mask `Underlying`
> since we are interested in the thing explicitly written in the source code, 
> we want `Templ` and **not** `vector`.
> 
> 2. `Templ` is a name of some template type (a class or template template 
> parameter)
> in this case `targetDecl` returns `Templ` with mask `TemplatePattern` and 
> that's what we want to return, since this is what was written in the source 
> code.
> 
> So in both cases the important thing is to **not** filter-out the result with 
> mask `Alias`. This is exactly what this patch does.
thanks! I was rather asking for comments in the code though :D

Please also mention them in comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68124



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

Reply via email to