Author: Nathan Ridge
Date: 2020-06-15T11:59:23-04:00
New Revision: 7759f70fb0ee2cd6752d9188bd2578cc3d9a7a2e

URL: 
https://github.com/llvm/llvm-project/commit/7759f70fb0ee2cd6752d9188bd2578cc3d9a7a2e
DIFF: 
https://github.com/llvm/llvm-project/commit/7759f70fb0ee2cd6752d9188bd2578cc3d9a7a2e.diff

LOG: [clangd] Support typeHierarchy/resolve for children of parents as well

Summary:
The initial implementation of typeHierarchy/resolve only supported
cases where an initial request was made for children, and then
typeHierarchy/resolve was used to get additional levels of children.

However, a client may also want to make an initial request for
parents, and then show other children of those parents, so support
typeHierarchy/resolve for items returned in response to a request
for parents as well.

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, 
cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D81845

Added: 
    

Modified: 
    clang-tools-extra/clangd/XRefs.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/XRefs.cpp 
b/clang-tools-extra/clangd/XRefs.cpp
index df2c7a7c7228..6aa031541846 100644
--- a/clang-tools-extra/clangd/XRefs.cpp
+++ b/clang-tools-extra/clangd/XRefs.cpp
@@ -1225,6 +1225,14 @@ declToTypeHierarchyItem(ASTContext &Ctx, const NamedDecl 
&ND,
 
   THI.uri = URIForFile::canonicalize(*FilePath, *TUPath);
 
+  // Compute the SymbolID and store it in the 'data' field.
+  // This allows typeHierarchy/resolve to be used to
+  // resolve children of items returned in a previous request
+  // for parents.
+  if (auto ID = getSymbolID(&ND)) {
+    THI.data = ID->str();
+  }
+
   return THI;
 }
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to