nridge created this revision.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous, 
MaskRay, ilya-biryukov.
Herald added a project: clang.
sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clangd/XRefs.cpp:1233
+  llvm::SmallString<32> USR;
+  if (!index::generateUSRForDecl(&ND, USR)) {
+    THI.data = SymbolID(USR).str();
----------------
nit: use getSymbolID from AST.h instead


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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81845

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


Index: clang-tools-extra/clangd/XRefs.cpp
===================================================================
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -1225,6 +1225,15 @@
 
   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.
+  llvm::SmallString<32> USR;
+  if (!index::generateUSRForDecl(&ND, USR)) {
+    THI.data = SymbolID(USR).str();
+  }
+
   return THI;
 }
 


Index: clang-tools-extra/clangd/XRefs.cpp
===================================================================
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -1225,6 +1225,15 @@
 
   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.
+  llvm::SmallString<32> USR;
+  if (!index::generateUSRForDecl(&ND, USR)) {
+    THI.data = SymbolID(USR).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