cp-demangle.c (status_allocation_failed): Rearrange whitespace.

* cp-demangle.c (status_allocation_failed): Rearrange whitespace.
	(demangle_type): Handle substitution candidates correctly in the
	face of special substitutions.

From-SVN: r36228
This commit is contained in:
Alex Samuel 2000-09-07 05:44:46 +00:00 committed by Alex Samuel
parent 93ca1662a2
commit d93998ecbe
2 changed files with 32 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2000-09-06 Alex Samuel <samuel@codesourcery.com>
* cp-demangle.c (status_allocation_failed): Rearrange whitespace.
(demangle_type): Handle substitution candidates correctly in the
face of special substitutions.
2000-09-05 Alex Samuel <samuel@codesourcery.com>
* cp-demangle.c (demangle_encoding): Rename variable.

View File

@ -2284,10 +2284,31 @@ demangle_type (dm)
is_substitution_candidate = 0;
}
else
/* While the special substitution token itself is not a
substitution candidate, the <class-enum-type> is, so
don't clear is_substitution_candidate. */
RETURN_IF_ERROR (demangle_class_enum_type (dm, &encode_return_type));
{
/* Now some trickiness. We have a special substitution
here. Often, the special substitution provides the
name of a template that's subsequently instantiated,
for instance `SaIcE' => std::allocator<char>. In these
cases we need to add a substitution candidate for the
entire <class-enum-type> and thus don't want to clear
the is_substitution_candidate flag.
However, it's possible that what we have here is a
substitution token representing an entire type, such as
`Ss' => std::string. In this case, we mustn't add a
new substitution candidate for this substitution token.
To detect this case, remember where the start of the
substitution token is. */
const char *next = dm->next;
/* Now demangle the <class-enum-type>. */
RETURN_IF_ERROR
(demangle_class_enum_type (dm, &encode_return_type));
/* If all that was just demangled is the two-character
special substitution token, supress the addition of a
new candidate for it. */
if (dm->next == next + 2)
is_substitution_candidate = 0;
}
break;