aboutsummaryrefslogtreecommitdiff
path: root/libiberty/d-demangle.c
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2016-01-28 21:44:42 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2016-01-28 21:44:42 +0100
commit9d98de835cb018419e0ef97db37fcf9061247750 (patch)
tree0195a508fbf3e32c87071f962ce9701d5d9bd434 /libiberty/d-demangle.c
parent56e374a6bcc87f7ac8aeb09887628a3286908545 (diff)
downloadgdb-9d98de835cb018419e0ef97db37fcf9061247750.zip
gdb-9d98de835cb018419e0ef97db37fcf9061247750.tar.gz
gdb-9d98de835cb018419e0ef97db37fcf9061247750.tar.bz2
Sync libiberty with GCC.
libiberty/ChangeLog: * 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. * 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. * 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.
Diffstat (limited to 'libiberty/d-demangle.c')
-rw-r--r--libiberty/d-demangle.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
index 3d7ccf6..4ad90a6 100644
--- a/libiberty/d-demangle.c
+++ b/libiberty/d-demangle.c
@@ -1,5 +1,5 @@
/* Demangler for the D programming language
- Copyright 2014, 2015 Free Software Foundation, Inc.
+ Copyright 2014, 2015, 2016 Free Software Foundation, Inc.
Written by Iain Buclaw (ibuclaw@gdcproject.org)
This file is part of the libiberty library.
@@ -223,6 +223,10 @@ dlang_call_convention (string *decl, const char *mangled)
mangled++;
string_append (decl, "extern(C++) ");
break;
+ case 'Y': /* (Objective-C) */
+ mangled++;
+ string_append (decl, "extern(Objective-C) ");
+ break;
default:
return NULL;
}
@@ -399,7 +403,9 @@ dlang_function_args (string *decl, const char *mangled)
return mangled;
case 'Y': /* (variadic T t, ...) style. */
mangled++;
- string_append (decl, ", ...");
+ if (n != 0)
+ string_append (decl, ", ");
+ string_append (decl, "...");
return mangled;
case 'Z': /* Normal function. */
mangled++;
@@ -533,6 +539,15 @@ dlang_type (string *decl, const char *mangled)
}
case 'P': /* pointer (T*) */
mangled++;
+ /* Function pointer types don't include the trailing asterisk. */
+ switch (*mangled)
+ {
+ case 'F': case 'U': case 'W':
+ case 'V': case 'R': case 'Y':
+ mangled = dlang_function_type (decl, mangled);
+ string_append (decl, "function");
+ return mangled;
+ }
mangled = dlang_type (decl, mangled);
string_append (decl, "*");
return mangled;
@@ -564,13 +579,6 @@ dlang_type (string *decl, const char *mangled)
mangled++;
return dlang_parse_tuple (decl, mangled);
- /* Function types */
- case 'F': case 'U': case 'W':
- case 'V': case 'R':
- mangled = dlang_function_type (decl, mangled);
- string_append (decl, "function");
- return mangled;
-
/* Basic types */
case 'n':
mangled++;
@@ -1334,7 +1342,7 @@ dlang_call_convention_p (const char *mangled)
switch (*mangled)
{
case 'F': case 'U': case 'V':
- case 'W': case 'R':
+ case 'W': case 'R': case 'Y':
return 1;
default: