This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Type hierarchy: don't resolve parents if the client only asked for children
ClosedPublic

Authored by nridge on Jul 11 2019, 8:29 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

nridge created this revision.Jul 11 2019, 8:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2019, 8:29 PM

This is an issue I noticed while writing the unit test for D64308.

kadircet added inline comments.Jul 12 2019, 1:21 AM
clang-tools-extra/clangd/XRefs.cpp
1238 ↗(On Diff #209407)

having a function named getTypeAncestors with a parameter ResolveParents doesn't make much sense. maybe move the check to caller side and simply don't call it if we are not interested in parents?

I think it makes sense to make this part also similar to subtypes:

  • let's generate the item in here with Optional<TypeHierarchyItem> Result = declToTypeHierarchyItem(ASTCtx, CXXRD);, which is used by both parents and children.
  • bail out if we couldn't get the item.
  • fill in parents if need be
  • fill in children if need be

WDYT?

nridge updated this revision to Diff 209677.Jul 12 2019, 9:08 PM

Address review comment

nridge edited the summary of this revision. (Show Details)Jul 12 2019, 9:09 PM
nridge marked 2 inline comments as done.
nridge added inline comments.
clang-tools-extra/clangd/XRefs.cpp
1238 ↗(On Diff #209407)

Agreed, this makes the code cleaner.

nridge edited reviewers, added: kadircet; removed: sammccall.Jul 16 2019, 4:39 AM
nridge marked an inline comment as done.

(Changed reviewer to Kadir as he reviewed the previous version.)

kadircet accepted this revision.Jul 17 2019, 6:05 AM

LGTM, thanks!

This revision is now accepted and ready to land.Jul 17 2019, 6:05 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2019, 8:27 AM