Fix type table lookups of specialized templates.
commitcdec4f48b37ede2bd7d953e10548519067b052d7
authorJohannes Sixt <j6t@kdbg.org>
Tue, 2 Dec 2008 21:43:39 +0000 (2 22:43 +0100)
committerJohannes Sixt <j6t@kdbg.org>
Mon, 8 Dec 2008 21:27:17 +0000 (8 22:27 +0100)
tree3e3b8bda55afae99ef9d928e6dc012ac98611ac6
parent79229f13ab1d04936f8b2f31c4f6004e3f6f4a09
Fix type table lookups of  specialized templates.

The typetable can store more than one template parameter lists per
template name. In this case it can happen that a particular template
instantiation matches more than one of the parameter lists because of
wildcards that they contain.

This improves the lookup procedure to look for a "best-matching" template
by ordering the parameter lists according to where they contain
wildcards: Parameter lists that have wildcards in earlier positions
are ranked worse than those that have the wildcards in later positions.
(Note that parameter lists that have the wildcards in the same
positions need not be compared because then they must be different in the
non-wildcard parameters -- although this is not enforced -- and at most
one of them can match.)

Consider the template parameter lists

   std::vector<*>
   std::vector<bool,*>

Here, the second is a better match than the first.

With this algorithm in place, we can now also define a type display for
std::vector<bool>.
kdbg/testprogs/std.cpp
kdbg/typetable.cpp
kdbg/typetables/stdc++6.kdbgtt