+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.
+
2015-05-16 Iain Buclaw <ibuclaw@gdcproject.org>
* d-demangle.c (dlang_identifier): Check encoded length of identifier
continue;
case 'g':
case 'h':
+ case 'k':
/* inout parameter is represented as 'Ng'.
vector parameter is represented as 'Nh'.
+ return paramenter is represented as 'Nk'.
If we see this, then we know we're really in the
parameter list. Rewind and break. */
mangled--;
mangled++;
string_append (decl, "@nogc ");
continue;
+ case 'j': /* return */
+ mangled++;
+ string_append (decl, "return ");
+ continue;
+
+ default: /* unknown attribute */
+ return NULL;
}
break;
}
string_append (decl, "scope ");
}
+ if (mangled[0] == 'N' && mangled[1] == 'k') /* return(T) */
+ {
+ mangled += 2;
+ string_append (decl, "return ");
+ }
+
switch (*mangled)
{
case 'J': /* out(T) */
demangle.test(scope char)
#
--format=dlang
+_D8demangle4testFNjaZv
+demangle.test(char)
+#
+--format=dlang
+_D8demangle4testFNkaZv
+demangle.test(return char)
+#
+--format=dlang
_D8demangle4testFaXv
demangle.test(char...)
#
demangle.test(char() @property @safe pure delegate)
#
--format=dlang
+_D8demangle4testFNjDFZaZv
+demangle.test(char() delegate)
+#
+--format=dlang
+_D8demangle4testFNkDFZaZv
+demangle.test(return char() delegate)
+#
+--format=dlang
+_D8demangle4testFDFNjZaZv
+demangle.test(char() return delegate)
+#
+--format=dlang
+_D8demangle4testFNjNkDFNjZaZv
+demangle.test(return char() return delegate)
+#
+--format=dlang
_D8demangle4testFFNaZaZv
demangle.test(char() pure function)
#
demangle.test(char() @property @safe pure function)
#
--format=dlang
+_D8demangle4testFNjFZaZv
+demangle.test(char() function)
+#
+--format=dlang
+_D8demangle4testFNkFZaZv
+demangle.test(return char() function)
+#
+--format=dlang
+_D8demangle4testFFNjZaZv
+demangle.test(char() return function)
+#
+--format=dlang
+_D8demangle4testFNjNkFNjZaZv
+demangle.test(return char() return function)
+#
+--format=dlang
_D8demangle4test6__initZ
demangle.test.init$
#