Repository navigation
Template specializations cause duplicate nodes in the Info Tree #562
Description
Activity
- addedPlugin: C++Issues related to the parsing and presentation of C++ projects.Issues related to the parsing and presentation of C++ projects.Target: WebGUIIssues related to the web frontend.Issues related to the web frontend.
on Mar 7, 2022 I realized this happens because template specializations are considered separate entities. So technically what we're seeing is correct, but I don't think it's a very good UI. It would be easier to read if specializations were grouped together in some way.
I think the best way to do this would be to have a toggle for displaying a less detailed tree where they are not differentiated at all. Another solution would be to group them into expandable nodes, but that may lead to a very cluttered tree.
Currently the database seems to lack any information about templates, so that would probably have to be added.
Thanks for the discovery. We had a long debate on how to visualize templates - show the source or the instantiations. Actually, this is tricky, because instantiations of different templates may result different AST subtree, eg, when using "if constexpr" or similar. However, the "average" case is usually is not that complex.
Before we decide here, perhaps we should check how some tools (e.g. understand or woboq works.Wouldn't it be enough to aggregate references? For example, if
myfunc<A>()callsa()andmyfunc<B>()callsb1()andb2(), then querying the callees ofmyfunc<>()would return[a(), b1(), b2()].I checked Understand, Woboq and Visual Studio 2019, and they completely ignore template specializations. When listing usages/callers/callees, they treat template functions and classes as if the part between
<>wasn't there. Understand has a "Template parameters" node in its info tree which lists the generic template parameter types of a template, that's all I could find for support.Maybe we could ignore specializations too, unless we are viewing the info tree of a template function/class. Then we'd show a "Specializations" node, the children of which are the info tree of each specialization (your idea from an earlier meeting). This way the specializations would only be seen when we're fully "zoomed in" to the template function/class. Showing them in other situations would be unnecessary clutter, I think.
- changed the title
[-]Duplicate nodes in Info Tree[/-][+]Template specializations cause duplicate nodes in the Info Tree[/+]on Mar 22, 2022
Sometimes there are duplicate nodes in the info tree.
For example,
tinyxml2::DynArray::Pushhas the following code:But in the info tree, it is shown as calling
EnsureCapacity9 times (should be 1), and being called bytinyxml2::MemPoolT::Alloc5 times (should also be 1). Also, all the usages are listed twice. All of these duplicates have the same line number.Info Tree
This might be related to #544.Actually, they're unrelated.