[PATCH] D58880: [WIP] [Looking for API feedback] [clangd] Type hierarchy subtypes

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 21:58:59 PST 2019


nridge added a comment.

In D58880#1416754 <https://reviews.llvm.org/D58880#1416754>, @kadircet wrote:

> Sorry I didn't notice the mailing thread beforehand, looks like Sam had a good point regarding performing operations on types rather than symbols(http://lists.llvm.org/pipermail/clangd-dev/2019-January/000241.html).
>  Does current implementation take this into account by either pointing at template specializations and/or base template declarations?


I thought about this, and I believe that having the relationship be between symbols is sufficient.

The main utility in a type hierarchy view is to allow the user to navigate to base/derived classes. If a base or derived class is an //implicit// specialization, the desired navigation is to the corresponding template definition; if it's an //explicit// specialization, the desired navigation is to the explicit specialization's definition.

A class template will obviously have its own symbol, so that part's fine. Explicit specializations are not currently stored in the index, but I think it would make sense for them to be, for other reasons as well (e.g. a user may want to navigate to an explicit specialization definition via `"workspace/symbol"`), in which case they too will get their own symbols. So, in either case, the desired type hierarchy item can be obtained from a symbol.

The updated patch has tests covering these scenarios, specifically `Subtypes.ClassTemplate` and `Subtypes.DependentBase`. Two additional tests, `Subtypes.TemplateSpec1` and `Subtypes.TemplateSpec2` are disabled until we start storing explicit specializations in the index.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58880





More information about the cfe-commits mailing list