d-demangle.c (dlang_identifier): Handle template constraint symbols.

libiberty/ChangeLog:

	* d-demangle.c (dlang_identifier): Handle template constraint symbols.
	(dlang_parse_template): Only advance if template symbol prefix is
	followed by a digit.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r247433
This commit is contained in:
Iain Buclaw 2017-05-01 10:45:35 +00:00 committed by Iain Buclaw
parent ec89d258a0
commit c6f44bae7e
3 changed files with 18 additions and 9 deletions

View File

@ -1,3 +1,10 @@
2017-04-15 Iain Buclaw <ibuclaw@gdcproject.org>
* d-demangle.c (dlang_identifier): Handle template constraint symbols.
(dlang_parse_template): Only advance if template symbol prefix is
followed by a digit.
* testsuite/d-demangle-expected: Add tests.
2017-05-01 Iain Buclaw <ibuclaw@gdcproject.org>
* d-demangle.c (dlang_attributes): Handle scope attributes.

View File

@ -769,14 +769,9 @@ dlang_identifier (string *decl, const char *mangled,
mangled = endptr;
/* May be a template instance. */
if (len >= 5 && strncmp (mangled, "__T", 3) == 0)
{
/* Template symbol. */
if (ISDIGIT (mangled[3]) && mangled[3] != '0')
return dlang_parse_template (decl, mangled, len);
return NULL;
}
if (len >= 5 && mangled[0] == '_' && mangled[1] == '_'
&& (mangled[2] == 'T' || mangled[2] == 'U'))
return dlang_parse_template (decl, mangled, len);
switch (len)
{
@ -1541,11 +1536,14 @@ dlang_parse_template (string *decl, const char *mangled, long len)
TemplateInstanceName:
Number __T LName TemplateArgs Z
Number __U LName TemplateArgs Z
^
The start pointer should be at the above location, and LEN should be
the value of the decoded number.
*/
if (strncmp (mangled, "__T", 3) != 0)
/* Template symbol. */
if (!ISDIGIT (mangled[3]) || mangled[3] == '0')
return NULL;
mangled += 3;

View File

@ -650,6 +650,10 @@ _D8demangle9__T4testZv
demangle.test!()
#
--format=dlang
_D8demangle9__U4testZv
demangle.test!()
#
--format=dlang
_D8demangle11__T4testTaZv
demangle.test!(char)
#