Commit Graph

32 Commits

Author SHA1 Message Date
Ben L 6c8dbbfe5c d-demangle.c (dlang_parse_assocarray): Correctly handle error result.
* d-demangle.c (dlang_parse_assocarray): Correctly handle error result.
     * testsuite/d-demangle-expected: Add testcase.

From-SVN: r270700
2019-04-30 08:39:14 -06:00
Ben L f181b8e780 d-demangle.c (dlang_parse_tuple): Correctly handle error result.
* d-demangle.c (dlang_parse_tuple): Correctly handle error result.
     * testsuite/d-demangle-expected: Add testcase.

From-SVN: r270699
2019-04-30 08:37:51 -06:00
Ben L dba20a5140 d-demangle.c (dlang_parse_structlit): Correctly handle error result.
* d-demangle.c (dlang_parse_structlit): Correctly handle error result.
    * testsuite/d-demangle-expected: Add testcase.

From-SVN: r270698
2019-04-30 08:36:24 -06:00
Ben L 80b1ab1579 d-demangle.c (dlang_parse_arrayliteral): Correctly handle error result.
* d-demangle.c (dlang_parse_arrayliteral): Correctly handle error result.
    * testsuite/d-demangle-expected: Add testcase.

From-SVN: r270697
2019-04-30 08:34:52 -06:00
Ben L 81adfd10c9 d-demangle.c (dlang_parse_integer): Fix stack underflow.
* d-demangle.c (dlang_parse_integer): Fix stack underflow.
     * testsuite/d-demangle-expected: Add testcase.

From-SVN: r270696
2019-04-30 08:32:38 -06:00
Jakub Jelinek a554497024 Update copyright years.
From-SVN: r267494
2019-01-01 13:31:55 +01:00
Jakub Jelinek 85ec4feb11 Update copyright years.
From-SVN: r256169
2018-01-03 11:03:58 +01:00
Iain Buclaw dc64856fdf d-demangle.c (dlang_identifier): Prefix mangled init symbols with `initializer for'.
libiberty/ChangeLog:

	* d-demangle.c (dlang_identifier): Prefix mangled init symbols
	with `initializer for'.
	* testsuite/demangle-expected: Update tests.

From-SVN: r248539
2017-05-27 11:30:22 +00:00
Iain Buclaw 0e3712f6aa d-demangle.c (dlang_call_convention_p): Move declaration before dlang_type.
libiberty/ChangeLog:

	* d-demangle.c (dlang_call_convention_p): Move declaration
	before dlang_type.
	(dlang_type): Handle function types.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r248538
2017-05-27 11:29:52 +00:00
Iain Buclaw 1a122a71ee d-demangle.c (dlang_parse_real): Remove stack buffer, write the demangled hexadecimal directly to string.
libiberty/ChangeLog:

	* d-demangle.c (dlang_parse_real): Remove stack buffer, write
	the demangled hexadecimal directly to string.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r248537
2017-05-27 11:29:38 +00:00
Iain Buclaw 5398cab9ca d-demangle.c (dlang_hexdigit): New function.
libiberty/ChangeLog:

	* d-demangle.c (dlang_hexdigit): New function.
	(ascii2hex): Remove function.
	(dlang_parse_string): Update to call dlang_hexdigit.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r247455
2017-05-01 23:38:50 +00:00
Iain Buclaw dbe65f77ff d-demangle.c (strtol): Remove declaration.
libiberty/ChangeLog:

	* d-demangle.c (strtol): Remove declaration.
	Updated all callers to use dlang_number.
	(dlang_number): New function.
	(dlang_value): Moved check for ISDIGIT into dlang_parse_integer.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r247453
2017-05-01 23:31:24 +00:00
Iain Buclaw 5a4dbf7d31 d-demangle.c (dlang_parse_symbol): Remove function.
libiberty/ChangeLog:

	* d-demangle.c (dlang_parse_symbol): Remove function.
	(dlang_parse_qualified): New function.
	(dlang_parse_mangle): New function.
	(dlang_type): Update to call dlang_parse_qualified.
	(dlang_identifier): Update to call either dlang_parse_qualified or
	dlang_parse_mangle.
	(dlang_type_modifier_p): Remove function.
	(dlang_call_convention_p): Don't allow type modifiers in mangle.
	(dlang_template_args): Update to call dlang_identifier.
	(dlang_demangle): Update to call dlang_parse_mangle.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r247450
2017-05-01 22:51:04 +00:00
Iain Buclaw dd03444ba5 d-demangle.c (dlang_value): Add comment explaining why cases for digits are required.
libiberty/ChangeLog:

	* d-demangle.c (dlang_value): Add comment explaining why cases for
	digits are required.
	* testsuite/d-demangle-expected: Update integer value tests.

From-SVN: r247436
2017-05-01 11:01:02 +00:00
Iain Buclaw 98bb7ee2da d-demangle.c (dlang_parse_symbol): Skip over anonymous symbols.
libiberty/ChangeLog:

	* d-demangle.c (dlang_parse_symbol): Skip over anonymous symbols.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r247434
2017-05-01 10:50:58 +00:00
Iain Buclaw c6f44bae7e 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
2017-05-01 10:45:35 +00:00
Iain Buclaw ec89d258a0 d-demangle.c (dlang_attributes): Handle scope attributes.
libiberty/ChangeLog:

	* d-demangle.c (dlang_attributes): Handle scope attributes.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r247432
2017-05-01 10:39:52 +00:00
Jakub Jelinek 2afd3180c5 Update copyright years.
From-SVN: r244052
2017-01-04 12:30:51 +01:00
Iain Buclaw 13617162e3 d-demangle.c (dlang_call_convention): Handle extern Objective-C function calling convention.
libiberty/ChangeLog:

2016-01-26  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_call_convention): Handle extern Objective-C
	function calling convention.
	(dlang_call_convention_p): Likewise.
	(dlang_type): Likewise.
	* testsuite/d-demangle-expected: Add coverage tests.

From-SVN: r232864
2016-01-27 01:07:26 +00:00
Iain Buclaw acf1f7da96 d-demangle.c (dlang_function_args): Append ',' for variadic functions only if parameters were seen before the...
libiberty/ChangeLog:

2016-01-26  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_function_args): Append ',' for variadic functions
	only if parameters were seen before the elipsis symbol.
	* testsuite/d-demangle-expected: Add coverage test for parameter-less
	variadic functions.

From-SVN: r232863
2016-01-27 01:07:17 +00:00
Iain Buclaw 0f4b8b316f d-demangle.c (dlang_type): Handle function types only in the context of seeing a pointer type symbol.
libiberty/ChangeLog:

2016-01-27  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_type): Handle function types only in the context
	of seeing a pointer type symbol.
	* testsuite/d-demangle-expected: Update function pointer tests.

From-SVN: r232862
2016-01-27 01:07:08 +00:00
Iain Buclaw fd91ffb805 Fix test failure on Solaris 9 where strtod() does not accept hexadecimals
2015-08-11  Iain Buclaw  <ibuclaw@gdcproject.org>

libiberty/

	* d-demangle.c (dlang_parse_real): Remove call to strtod.
	(strtod): Remove declaration.
	* testsuite/d-demangle-expected: Update float and complex literal
	tests to check correct hexadecimal demangling.

From-SVN: r226774
2015-08-11 07:12:19 +00:00
Iain Buclaw 7e8655412c d-demangle.c (dlang_symbol_kinds): New enum.
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_symbol_kinds): New enum.
	(dlang_parse_symbol): Update signature.  Handle an ambiguity between
	pascal functions and template value arguments.  Only check for a type
	if parsing a function, or at the top level.  Return failure if the
	entire symbol was not successfully demangled.
	(dlang_identifier): Update signature.  Handle an ambiguity between two
	adjacent digits in a mangled symbol string.
	(dlang_type): Update call to dlang_parse_symbol.
	(dlang_template_args): Likewise.
	(dlang_parse_template): Likewise.
	(dlang_demangle): Likewise.
	* testsuite/d-demangle-expected: Fix bad tests found, and add problematic
	examples to the unittests.

From-SVN: r223247
2015-05-16 16:50:30 +00:00
Iain Buclaw ed4cdb8502 d-demangle.c (dlang_template_args): Skip over specialized template parameters in mangled symbol.
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_template_args): Skip over specialized template
	parameters in mangled symbol.
	* testsuite/d-demangle-expected: Add coverage and unittest for specialized
	template parameters.

From-SVN: r223246
2015-05-16 16:50:19 +00:00
Iain Buclaw 59251a7367 d-demangle.c (dlang_type): Handle cent and ucent types.
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_type): Handle cent and ucent types.
	* testsuite/d-demangle-expected: Add coverage tests for cent and ucent.

From-SVN: r223245
2015-05-16 16:50:08 +00:00
Iain Buclaw 7ce4461f37 d-demangle.c (dlang_attributes): Handle return attributes, ignoring return parameters in the mangled string.
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_attributes): Handle return attributes, ignoring
	return parameters in the mangled string.  Return NULL if have encountered
	an unknown attribute.
	(dlang_function_args): Handle return parameters in the mangled string.
	* testsuite/d-demangle-expected: Add coverage tests for functions with
	return parameters and return attributes.

From-SVN: r223244
2015-05-16 16:49:57 +00:00
Iain Buclaw 5cc158e9a9 d-demangle.c (dlang_identifier): Check encoded length of identifier to verify strncmp matches entire string.
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_identifier): Check encoded length of identifier
	to verify strncmp matches entire string.
	* testsuite/d-demangle-expected: Fix wrong test for postblit symbol.

From-SVN: r223243
2015-05-16 16:49:46 +00:00
Iain Buclaw fa66ced4bf d-demangle.c (dlang_type_modifiers): New function.
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_type_modifiers): New function.
	(dlang_type_modifier_p): New function.
	(dlang_call_convention_p): Ignore any kind of type modifier.
	(dlang_type): Handle and emit the type modifier after delegate types.
	(dlang_parse_symbol): Handle and emit the type modifier after the symbol.
	* testsuite/d-demangle-expected: Add coverage tests for all valid
	usages of function symbols with type modifiers.

From-SVN: r223242
2015-05-16 16:49:35 +00:00
Iain Buclaw 76b41cad1c d-demangle.c (dlang_call_convention): Return NULL if have reached the end of the symbol, but expected something to read.
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_call_convention): Return NULL if have reached the
	end of the symbol, but expected something to read.
	(dlang_attributes): Likewise.
	(dlang_function_type): Likewise.
	(dlang_type): Likewise.
	(dlang_identifier): Likewise.
	(dlang_value): Likewise.

From-SVN: r223241
2015-05-16 16:49:25 +00:00
Iain Buclaw eb058b7de6 d-demangle.c (dlang_parse_string): Represent embedded whitespace or non-printable characters as hex or escape...
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_parse_string): Represent embedded whitespace or
	non-printable characters as hex or escape sequences.
	* testsuite/d-demangle-expected: Add test for templates with tabs and
	newlines embedded into the signature.

From-SVN: r223240
2015-05-16 16:49:13 +00:00
Joel Brobecker 2a523cfe4e Use strtod instead of strtold in libiberty/d-demangle.c
strtold is currently used to decode templates which have a floating-point
value encoded inside; but this routine is not available on some systems,
such as Solaris 2.9 for instance.

This patch fixes the issue by replace the use of strtold by strtod.
It reduces a bit the precision, but it should still remain acceptable
in most cases.

libiberty/ChangeLog:

        * d-demangle.c: Replace strtold with strtod in global comment.
        (strtold): Remove declaration.
        (strtod): New declaration.
        (dlang_parse_real): Declare value as double instead of long
        double.  Replace call to strtold by call to strtod.
        Update format in call to snprintf.

From-SVN: r216216
2014-10-14 17:57:08 +00:00
Iain Buclaw 43b1b9edfc demangle.h (DMGL_DLANG): New macro.
include/:
	* demangle.h (DMGL_DLANG): New macro.
	(DMGL_STYLE_MASK): Add DMGL_DLANG.
	(demangling_styles): Add dlang_demangling.
	(DLANG_DEMANGLING_STYLE_STRING): New macro.
	(DLANG_DEMANGLING): New macro.
	(dlang_demangle): New prototype.
libiberty/:
	* Makefile.in (CFILES): Add d-demangle.c.
	(REQUIRED_OFILES): Add d-demangle.o.
	* cplus-dem.c (libiberty_demanglers): Add dlang_demangling case.
	(cplus_demangle): Likewise.
	* d-demangle.c: New file.
	* testsuite/Makefile.in (really-check): Add check-d-demangle.
	* testsuite/d-demangle-expected: New file.

From-SVN: r215530
2014-09-23 18:36:14 +00:00