Runtime tables deterministic ordering (4)

Output C/C++ type strings (| separated) in swig_type_info tables in
fixed order. The types are output in alphabetically sorted order,
with an exception. The final type is a fully resolved type, but
does not necessarily include default template parameters.
This type is the one used by SWIG_TypePrettyName which is commonly
used to display a type when the wrong type is passed in as a
parameter.

Previously the order was not very deterministic due to the use of
internal hash tables which do not have an ordering guarantee.
This commit is contained in:
William S Fulton 2022-09-26 18:14:19 +01:00
commit 15b2ec53e3
3 changed files with 48 additions and 20 deletions

View file

@ -358,9 +358,9 @@ SWIG_TypeName(const swig_type_info *ty) {
SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info *type) {
/* The "str" field contains the equivalent pretty names of the
type, separated by vertical-bar characters. We choose
to print the last name, as it is often (?) the most
specific. */
type, separated by vertical-bar characters. Choose the last
name. It should be the most specific; a fully resolved name
but not necessarily with default template parameters expanded. */
if (!type) return NULL;
if (type->str != NULL) {
const char *last_name = type->str;