[PATCH] D56370: [clangd] Add support for type hierarchy (super types only for now)
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 12 18:22:39 PST 2019
nridge marked an inline comment as done.
nridge added inline comments.
Herald added a subscriber: jdoerfert.
================
Comment at: clang-tools-extra/clangd/ClangdServer.cpp:543
+ return CB(InpAST.takeError());
+ CB(clangd::getTypeHierarchy(InpAST->AST, Item.range.start, Resolve,
+ Direction));
----------------
sammccall wrote:
> relying on the item range to resolve the actual symbol isn't reliable:
> - the source code may have changed
> - the range may not be within the TU, and might be e.g. in an indexed header we don't have a compile command for.
Good point. I appreciate a bit better now why you suggested trying to avoid `resolve` for now :)
What do you think of the following implementation approach:
* Use the `data` field of `TypeHierarchyItem` (which the client will send back to the server for `resolve` queries) to send the `SymbolID` of the item to the client.
* When the client sends back the `SymbolID` in the `resolve` request, look up the symbol in the index, and use the source range from the symbol.
(Later, when we start storing base <--> derived relationships in the index for subtype support, we could just answer the entire `resolve` query using the index.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56370/new/
https://reviews.llvm.org/D56370
More information about the cfe-commits
mailing list