X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=libiberty%2Fcp-demangle.c;h=109d533b524e4175f61b304caa84b1199ed3c7d9;hb=03f0fdd81264feaf39579e6b510639d3dcc61822;hp=8f1cfb17f87f2734e0b756390eeaa94a69dc87ab;hpb=d8d90ee3bdeb439ed1830c8a1f55fecee2324cf1;p=pf3gnuchains%2Fgcc-fork.git 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; } -/* ::= + */ +/* ::= [J]+ */ 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;