[PATCH] D131385: [clangd] Support for standard type hierarchy

Utkarsh Saxena via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 16 01:26:24 PDT 2022


usaxena95 added inline comments.


================
Comment at: clang-tools-extra/clangd/Protocol.cpp:1228
+    Result["parents"] = RP.parents;
+  return std::move(Result);
+}
----------------
Nit: Allow RVO.


================
Comment at: clang-tools-extra/clangd/Protocol.h:1415
+  /// The range that should be selected and revealed when this symbol is being
+  /// picked, e.g. the name of a function. Must be contained by the range.
   Range selectionRange;
----------------
nit.


================
Comment at: clang-tools-extra/clangd/XRefs.cpp:1954-1964
       [&AST](const SelectionTree::Node *N) -> std::vector<LocatedSymbol> {
     std::vector<LocatedSymbol> LocatedSymbols;
 
     // NOTE: unwrapFindType might return duplicates for something like
-    // unique_ptr<unique_ptr<T>>. Let's *not* remove them, because it gives you some
-    // information about the type you may have not known before
-    // (since unique_ptr<unique_ptr<T>> != unique_ptr<T>).
-    for (const QualType& Type : unwrapFindType(typeForNode(N), AST.getHeuristicResolver()))
-        llvm::copy(locateSymbolForType(AST, Type), std::back_inserter(LocatedSymbols));
+    // unique_ptr<unique_ptr<T>>. Let's *not* remove them, because it gives you
+    // some information about the type you may have not known before (since
+    // unique_ptr<unique_ptr<T>> != unique_ptr<T>).
----------------
Can you revert the formatting changes in l:1894-1964



================
Comment at: clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp:780
+                  withResolveParents(HasValue(UnorderedElementsAre(
+                      withResolveID(Result.front().data.symbolID.str())))))));
+}
----------------
It would be clearer if we use `getSymbolID(&findDecl(AST, "Parent1"))` here and in `SuperTypes`.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131385



More information about the cfe-commits mailing list