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

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 12 01:23:51 PDT 2019


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/XRefs.cpp:1238
   Optional<TypeHierarchyItem> Result =
-      getTypeAncestors(*CXXRD, AST.getASTContext(), RPSet);
+      getTypeAncestors(*CXXRD, AST.getASTContext(), RPSet, ResolveParents);
   if (!Result)
----------------
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?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64613





More information about the cfe-commits mailing list