kadircet added inline comments.
================
Comment at: clang-tools-extra/clangd/XRefs.cpp:687
- const Decl *D = Decls[0];
+ const Decl *D = nullptr;
+ for (const Decl *Candidate : Decls) {
----------------
maybe just
```
const Decl *D = Decls.front()
for(const auto *C : Decls) {
if(isa<ClassTempl...>(C)) {
D = C;
break;
}
}
```
================
Comment at: clang-tools-extra/clangd/XRefs.cpp:773
+ // specializations, so if we have one, use the template pattern instead.
+ if (auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(CXXRD)) {
+ CXXRD = CTSD->getTemplateInstantiationPattern();
----------------
nit: no need for braces
================
Comment at: clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp:418
+ EXPECT_THAT(*Result,
+ AllOf(WithName("S<0>"), WithKind(SymbolKind::Struct),
Parents()));
}
----------------
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.
================
Comment at: clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp:464
+TEST(TypeHierarchy, DeriveFromImplicitSpec) {
+ Annotations Source(R"cpp(
----------------
can you also add a case for deriving from explicit (partial) specialization and
type hierarchy on instantiation of a different pattern?
e.g.
```
template <typename T> class X {};
template <typename T> class X<T*> {};
struct Child : X<int*> {};
X<int> fo^o;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71533/new/
https://reviews.llvm.org/D71533
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits