[PATCH] D71533: [clangd] Show template arguments in type hierarchy when possible

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 3 01:44:32 PST 2020


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/XRefs.cpp:140
   if (const SelectionTree::Node *N = Selection.commonAncestor()) {
-    auto Decls = targetDecl(N->ASTNode, Relations);
+    auto Decls = explicitReferenceTargets(N->ASTNode, Relations);
     Result.assign(Decls.begin(), Decls.end());
----------------
this will result in changes in behavior for other functionality (it is unfortunate if no tests regressed), for example `findReferences` did work on `template patterns` rather than `instantiations` now it won't receive pattern results when triggered on `instantiations`. whether we want that or not is up for debate, but definitely not part of this patch.


================
Comment at: clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp:418
+  EXPECT_THAT(*Result,
+              AllOf(WithName("S<0>"), WithKind(SymbolKind::Struct), Parents()));
 }
----------------
nridge wrote:
> kadircet wrote:
> > what about making use of template pattern in case of invalid instantiations?
> > 
> > as type hierarchy tries to provide information regarding `bases` and `children`, I think it is more important to show those instead of template instantiation arguments.
> Is there a way to query a `ClassTemplateSpecializationDecl` for whether instantiating its base specifier failed?
> 
> Or, should we fall back on the template pattern any time `bases()` is empty?
you can check for `CTSD->isInvalidDecl()` and fallback to pattern in such cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71533





More information about the cfe-commits mailing list