libiberty: Add support for D `typeof(*null)' types
The D language has a new bottom type `typeof(*null)'. Null types were also incorrectly being demangled as `none', this has been fixed to be `typeof(null)'. libiberty/ChangeLog: * d-demangle.c (dlang_attributes): Handle typeof(*null). (dlang_type): Likewise. Demangle 'n' as typeof(null). * testsuite/d-demangle-expected: Update tests.
This commit is contained in:
parent
c3c669ac81
commit
0e32a5aa8b
2 changed files with 15 additions and 3 deletions
|
@ -573,9 +573,11 @@ dlang_attributes (string *decl, const char *mangled)
|
|||
case 'g':
|
||||
case 'h':
|
||||
case 'k':
|
||||
case 'n':
|
||||
/* inout parameter is represented as 'Ng'.
|
||||
vector parameter is represented as 'Nh'.
|
||||
return paramenter is represented as 'Nk'.
|
||||
return parameter is represented as 'Nk'.
|
||||
typeof(*null) parameter is represented as 'Nn'.
|
||||
If we see this, then we know we're really in the
|
||||
parameter list. Rewind and break. */
|
||||
mangled--;
|
||||
|
@ -787,6 +789,12 @@ dlang_type (string *decl, const char *mangled, struct dlang_info *info)
|
|||
string_append (decl, ")");
|
||||
return mangled;
|
||||
}
|
||||
else if (*mangled == 'n') /* typeof(*null) */
|
||||
{
|
||||
mangled++;
|
||||
string_append (decl, "typeof(*null)");
|
||||
return mangled;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
case 'A': /* dynamic array (T[]) */
|
||||
|
@ -884,7 +892,7 @@ dlang_type (string *decl, const char *mangled, struct dlang_info *info)
|
|||
/* Basic types */
|
||||
case 'n':
|
||||
mangled++;
|
||||
string_append (decl, "none");
|
||||
string_append (decl, "typeof(null)");
|
||||
return mangled;
|
||||
case 'v':
|
||||
mangled++;
|
||||
|
|
|
@ -83,7 +83,11 @@ demangle.test(ulong)
|
|||
#
|
||||
--format=dlang
|
||||
_D8demangle4testFnZv
|
||||
demangle.test(none)
|
||||
demangle.test(typeof(null))
|
||||
#
|
||||
--format=dlang
|
||||
_D8demangle4testFNnZv
|
||||
demangle.test(typeof(*null))
|
||||
#
|
||||
--format=dlang
|
||||
_D8demangle4testFoZv
|
||||
|
|
Loading…
Add table
Reference in a new issue