[clangd-dev] Prototyping a "type hierarchy" request

Simon Marchi via clangd-dev clangd-dev at lists.llvm.org
Tue Aug 28 07:54:13 PDT 2018

On 2018-08-28 02:21, Sam McCall wrote:
> On Mon, Aug 27, 2018, 22:22 Simon Marchi via clangd-dev <
> clangd-dev at lists.llvm.org> wrote:
>> Hi all,
>> There is no request to obtain the type hierarchy starting from a
>> particular type in the LSP specification yet, but there are some
>> proposals [1] and some other language servers have their own extension
>> to the protocol to support that.  I thought I would start prototyping
>> the feature in clangd to see how we can retrieve this information, so
>> that once the specification is modified to include such a request, we
>> are not too far from supporting it.  It can also help steer the 
>> proposed
>> changes to the specification to make sure it supports what we need for
>> the C++ language.
>> The scope of my prototype is: given a type or variable, recursively 
>> find
>> the base classes of that type (or the type of that variable).  I am 
>> not
>> considering derived classes right now, because it would require 
>> dealing
>> with the index.  Here is my work so far:
>> https://reviews.llvm.org/D51311
> Haven't looked at the patch yet, but this sounds awesome and you're 
> right
> about the index needing work to support this.
> One approach would be to use the XRefs APIs that are landing, make
> "overrides" a role, and allow the payload to be a symbol ID rather than 
> a
> location.

I'll take a look, but I am not sure how this solves the problem of 
extracting the required information from the AST.


More information about the clangd-dev mailing list