Dependent bases are handled heuristically, by replacing them with the class
template that they are a specialization of, where possible. Care is taken
to avoid infinite recursion.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
This patch aims to implement the more proper solution suggested here.
I couldn't actually use CXXRecordDecl->getTemplateInstantiationPattern() as suggested, because the base-specifiers resolve to types, not declarations, but I believe what I did here implements the same intention (please let me know if I misunderstood).
LG, though I think your patch might be based on top of some uncommitted changes.
I noticed template names rather than type names are shown (not new in this patch) - we should fix that I think.
clang-tools-extra/unittests/clangd/TypeHierarchyTests.cpp | ||
---|---|---|
384 ↗ | (On Diff #192053) | can we give this a more descriptive name like RecursiveHierarchyUnbounded? |
405 ↗ | (On Diff #192053) | Sorry, I realize this isn't related to this patch, but I didn't see the final form of the previous one. This should be WithName("S<0>"), ... Parents(AllOf(WithName("S<1>")), ...). S is the name of the template, not the name of the type. Can you add a fixme? |
410 ↗ | (On Diff #192053) | RecursiveHierarchyBounded |
447 ↗ | (On Diff #192053) | this can be merged with the previous test case, using two named points. |
463 ↗ | (On Diff #192053) | (in this case the printed name for the parent might end up looking odd - printing the spelled S<N - 1> is probably ideal but I don't really mind what we end up with, this is an edge case. Not for this patch, in any case) |
609 ↗ | (On Diff #192053) | this patch doesn't seem to be against HEAD |
clang-tools-extra/unittests/clangd/TypeHierarchyTests.cpp | ||
---|---|---|
405 ↗ | (On Diff #192053) | AFAICS D59639 is something subtly different - it prints the args of *specializations* as written in the source code, not instantiations. i.e. if you try to use this for vector<int>, it won't work as there's no specialization, you'll get vector<T> instead. |