summaryrefslogtreecommitdiff
path: root/libiberty/cp-demangle.c
diff options
context:
space:
mode:
authortlaurenzo <tlaurenzo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-11 01:34:02 +0000
committertlaurenzo <tlaurenzo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-11 01:34:02 +0000
commit4c8420c9b081e5e11b17aad8495674196307bf76 (patch)
treed3a6af3b149154654e7557325e0a2d26a3b83556 /libiberty/cp-demangle.c
parent169164630a30180d2b6a962d7094474d0a601ff2 (diff)
downloadgcc-4c8420c9b081e5e11b17aad8495674196307bf76.tar.gz
Fixes java/PR9861
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108374 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/cp-demangle.c')
-rw-r--r--libiberty/cp-demangle.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 8f1cfb17f87..109d533b524 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -1939,7 +1939,7 @@ d_function_type (struct d_info *di)
return ret;
}
-/* <bare-function-type> ::= <type>+ */
+/* <bare-function-type> ::= [J]<type>+ */
static struct demangle_component *
d_bare_function_type (struct d_info *di, int has_return_type)
@@ -1947,13 +1947,22 @@ d_bare_function_type (struct d_info *di, int has_return_type)
struct demangle_component *return_type;
struct demangle_component *tl;
struct demangle_component **ptl;
+ char peek;
+
+ /* Detect special qualifier indicating that the first argument
+ is the return type. */
+ peek = d_peek_char (di);
+ if (peek == 'J')
+ {
+ d_advance (di, 1);
+ has_return_type = 1;
+ }
return_type = NULL;
tl = NULL;
ptl = &tl;
while (1)
{
- char peek;
struct demangle_component *type;
peek = d_peek_char (di);
@@ -3025,13 +3034,16 @@ d_print_comp (struct d_print_info *dpi,
case DEMANGLE_COMPONENT_FUNCTION_TYPE:
{
+ if ((dpi->options & DMGL_RET_POSTFIX) != 0)
+ d_print_function_type (dpi, dc, dpi->modifiers);
+
+ /* Print return type if present */
if (d_left (dc) != NULL)
{
struct d_print_mod dpm;
/* We must pass this type down as a modifier in order to
print it in the right location. */
-
dpm.next = dpi->modifiers;
dpi->modifiers = &dpm;
dpm.mod = dc;
@@ -3045,10 +3057,14 @@ d_print_comp (struct d_print_info *dpi,
if (dpm.printed)
return;
- d_append_char (dpi, ' ');
+ /* In standard prefix notation, there is a space between the
+ return type and the function signature. */
+ if ((dpi->options & DMGL_RET_POSTFIX) == 0)
+ d_append_char (dpi, ' ');
}
- d_print_function_type (dpi, dc, dpi->modifiers);
+ if ((dpi->options & DMGL_RET_POSTFIX) == 0)
+ d_print_function_type (dpi, dc, dpi->modifiers);
return;
}
@@ -4003,7 +4019,8 @@ java_demangle_v3 (const char* mangled)
char *from;
char *to;
- demangled = d_demangle (mangled, DMGL_JAVA | DMGL_PARAMS, &alc);
+ demangled = d_demangle (mangled, DMGL_JAVA | DMGL_PARAMS | DMGL_RET_POSTFIX,
+ &alc);
if (demangled == NULL)
return NULL;