summaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2021-08-29 19:00:33 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2021-08-30 01:14:18 +0200
commit0e32a5aa8bc967bc183142a596d0a6460be27438 (patch)
tree1e4a2a1d03104cc7fccdaffac7965169cfe8899e /libiberty
parentc3c669ac811429033c0151f910b38fc009e21ca8 (diff)
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.
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/d-demangle.c12
-rw-r--r--libiberty/testsuite/d-demangle-expected6
2 files changed, 15 insertions, 3 deletions
diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
index 822c7580782..c34f91843de 100644
--- a/libiberty/d-demangle.c
+++ b/libiberty/d-demangle.c
@@ -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++;
diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/d-demangle-expected
index ba0ffed5c8d..00036e7810a 100644
--- a/libiberty/testsuite/d-demangle-expected
+++ b/libiberty/testsuite/d-demangle-expected
@@ -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