diff options
author | Mike Stump <mrs@gcc.gnu.org> | 1997-01-16 23:12:53 +0000 |
---|---|---|
committer | Mike Stump <mrs@gcc.gnu.org> | 1997-01-16 23:12:53 +0000 |
commit | 5d64469294e1b8c364e55a6b285f4282c9523d0d (patch) | |
tree | 86b99c5947da3fe787c98489aa4b365dcd37afb1 /gcc/cplus-dem.c | |
parent | 79aff5ac0d3a0862fd126b36038c553597368644 (diff) | |
download | gcc-5d64469294e1b8c364e55a6b285f4282c9523d0d.tar.gz |
cplus-dem.c: Fix indenting; note that this file also lives in libiberty.
* cplus-dem.c: Fix indenting; note that this file also lives in
libiberty.
(do_type, case 'M'): Check for a template as well as a class.
From-SVN: r13503
Diffstat (limited to 'gcc/cplus-dem.c')
-rw-r--r-- | gcc/cplus-dem.c | 932 |
1 files changed, 476 insertions, 456 deletions
diff --git a/gcc/cplus-dem.c b/gcc/cplus-dem.c index 90969a9faed..5028df1d10e 100644 --- a/gcc/cplus-dem.c +++ b/gcc/cplus-dem.c @@ -25,6 +25,9 @@ Boston, MA 02111-1307, USA. */ realloc except that they generate a fatal error if there is no available memory. */ +/* This file lives in both GCC and libiberty. When making changes, please + try not to break either. */ + #include <ctype.h> #include <string.h> #include <stdio.h> @@ -38,7 +41,7 @@ extern char *xrealloc PARAMS((char *, unsigned)); char * mystrstr (s1, s2) - char *s1, *s2; + char *s1, *s2; { register char *p = s1; register int len = strlen (s2); @@ -81,7 +84,7 @@ void set_cplus_marker_for_demangling (ch) int ch; { - cplus_markers[0] = ch; + cplus_markers[0] = ch; } /* Stuff that is shared between sub-routines. @@ -198,9 +201,9 @@ typedef struct string /* Beware: these aren't required to be */ #define STRING_EMPTY(str) ((str) -> b == (str) -> p) #define PREPEND_BLANK(str) {if (!STRING_EMPTY(str)) \ - string_prepend(str, " ");} + string_prepend(str, " ");} #define APPEND_BLANK(str) {if (!STRING_EMPTY(str)) \ - string_append(str, " ");} + string_append(str, " ");} #define ARM_VTABLE_STRING "__vtbl__" /* Lucid/ARM virtual table prefix */ #define ARM_VTABLE_STRLEN 8 /* strlen (ARM_VTABLE_STRING) */ @@ -308,17 +311,17 @@ string_prepends PARAMS ((string *, string *)); static int consume_count (type) - const char **type; + const char **type; { - int count = 0; + int count = 0; - while (isdigit (**type)) - { - count *= 10; - count += **type - '0'; - (*type)++; - } - return (count); + while (isdigit (**type)) + { + count *= 10; + count += **type - '0'; + (*type)++; + } + return (count); } int @@ -338,7 +341,7 @@ cplus_demangle_opname (opname, result, options) work->options = options; if (opname[0] == '_' && opname[1] == '_' - && opname[2] == 'o' && opname[3] == 'p') + && opname[2] == 'o' && opname[3] == 'p') { /* ANSI. */ /* type conversion operator. */ @@ -390,9 +393,9 @@ cplus_demangle_opname (opname, result, options) } } else if (len >= 3 - && opname[0] == 'o' - && opname[1] == 'p' - && strchr (cplus_markers, opname[2]) != NULL) + && opname[0] == 'o' + && opname[1] == 'p' + && strchr (cplus_markers, opname[2]) != NULL) { /* see if it's an assignment expression */ if (len >= 10 /* op$assign_ */ @@ -643,150 +646,150 @@ demangle_signature (work, mangled, declp) { switch (**mangled) { - case 'Q': - oldmangled = *mangled; - success = demangle_qualified (work, mangled, declp, 1, 0); - if (success) - { - remember_type (work, oldmangled, *mangled - oldmangled); - } - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - expect_func = 1; - } - oldmangled = NULL; - break; + case 'Q': + oldmangled = *mangled; + success = demangle_qualified (work, mangled, declp, 1, 0); + if (success) + { + remember_type (work, oldmangled, *mangled - oldmangled); + } + if (AUTO_DEMANGLING || GNU_DEMANGLING) + { + expect_func = 1; + } + oldmangled = NULL; + break; - case 'S': - /* Static member function */ - if (oldmangled == NULL) - { - oldmangled = *mangled; - } - (*mangled)++; - work -> static_type = 1; - break; + case 'S': + /* Static member function */ + if (oldmangled == NULL) + { + oldmangled = *mangled; + } + (*mangled)++; + work -> static_type = 1; + break; - case 'C': - /* a const member function */ - if (oldmangled == NULL) - { - oldmangled = *mangled; - } - (*mangled)++; - work -> const_type = 1; - break; + case 'C': + /* a const member function */ + if (oldmangled == NULL) + { + oldmangled = *mangled; + } + (*mangled)++; + work -> const_type = 1; + break; - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - if (oldmangled == NULL) - { - oldmangled = *mangled; - } - success = demangle_class (work, mangled, declp); - if (success) - { - remember_type (work, oldmangled, *mangled - oldmangled); - } - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - expect_func = 1; - } - oldmangled = NULL; - break; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + if (oldmangled == NULL) + { + oldmangled = *mangled; + } + success = demangle_class (work, mangled, declp); + if (success) + { + remember_type (work, oldmangled, *mangled - oldmangled); + } + if (AUTO_DEMANGLING || GNU_DEMANGLING) + { + expect_func = 1; + } + oldmangled = NULL; + break; - case 'F': - /* Function */ - /* ARM style demangling includes a specific 'F' character after + case 'F': + /* Function */ + /* ARM style demangling includes a specific 'F' character after the class name. For GNU style, it is just implied. So we can safely just consume any 'F' at this point and be compatible with either style. */ - oldmangled = NULL; - func_done = 1; - (*mangled)++; + oldmangled = NULL; + func_done = 1; + (*mangled)++; - /* For lucid/ARM style we have to forget any types we might - have remembered up to this point, since they were not argument - types. GNU style considers all types seen as available for - back references. See comment in demangle_args() */ + /* For lucid/ARM style we have to forget any types we might + have remembered up to this point, since they were not argument + types. GNU style considers all types seen as available for + back references. See comment in demangle_args() */ - if (LUCID_DEMANGLING || ARM_DEMANGLING) - { - forget_types (work); - } - success = demangle_args (work, mangled, declp); - break; + if (LUCID_DEMANGLING || ARM_DEMANGLING) + { + forget_types (work); + } + success = demangle_args (work, mangled, declp); + break; - case 't': - /* G++ Template */ - string_init(&trawname); - string_init(&tname); - if (oldmangled == NULL) - { - oldmangled = *mangled; - } - success = demangle_template (work, mangled, &tname, &trawname); - if (success) - { - remember_type (work, oldmangled, *mangled - oldmangled); - } - string_append(&tname, "::"); - string_prepends(declp, &tname); - if (work -> destructor & 1) - { - string_prepend (&trawname, "~"); - string_appends (declp, &trawname); - work->destructor -= 1; - } - if ((work->constructor & 1) || (work->destructor & 1)) - { - string_appends (declp, &trawname); - work->constructor -= 1; - } - string_delete(&trawname); - string_delete(&tname); - oldmangled = NULL; - expect_func = 1; - break; + case 't': + /* G++ Template */ + string_init(&trawname); + string_init(&tname); + if (oldmangled == NULL) + { + oldmangled = *mangled; + } + success = demangle_template (work, mangled, &tname, &trawname); + if (success) + { + remember_type (work, oldmangled, *mangled - oldmangled); + } + string_append(&tname, "::"); + string_prepends(declp, &tname); + if (work -> destructor & 1) + { + string_prepend (&trawname, "~"); + string_appends (declp, &trawname); + work->destructor -= 1; + } + if ((work->constructor & 1) || (work->destructor & 1)) + { + string_appends (declp, &trawname); + work->constructor -= 1; + } + string_delete(&trawname); + string_delete(&tname); + oldmangled = NULL; + expect_func = 1; + break; - case '_': - /* At the outermost level, we cannot have a return type specified, - so if we run into another '_' at this point we are dealing with - a mangled name that is either bogus, or has been mangled by - some algorithm we don't know how to deal with. So just - reject the entire demangling. */ - success = 0; - break; + case '_': + /* At the outermost level, we cannot have a return type specified, + so if we run into another '_' at this point we are dealing with + a mangled name that is either bogus, or has been mangled by + some algorithm we don't know how to deal with. So just + reject the entire demangling. */ + success = 0; + break; - default: - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - /* Assume we have stumbled onto the first outermost function - argument token, and start processing args. */ - func_done = 1; - success = demangle_args (work, mangled, declp); - } - else - { - /* Non-GNU demanglers use a specific token to mark the start - of the outermost function argument tokens. Typically 'F', - for ARM-demangling, for example. So if we find something - we are not prepared for, it must be an error. */ - success = 0; - } - break; - } -/* - if (AUTO_DEMANGLING || GNU_DEMANGLING) -*/ - { - if (success && expect_func) + default: + if (AUTO_DEMANGLING || GNU_DEMANGLING) { + /* Assume we have stumbled onto the first outermost function + argument token, and start processing args. */ func_done = 1; success = demangle_args (work, mangled, declp); } + else + { + /* Non-GNU demanglers use a specific token to mark the start + of the outermost function argument tokens. Typically 'F', + for ARM-demangling, for example. So if we find something + we are not prepared for, it must be an error. */ + success = 0; + } + break; } + /* + if (AUTO_DEMANGLING || GNU_DEMANGLING) + */ + { + if (success && expect_func) + { + func_done = 1; + success = demangle_args (work, mangled, declp); + } + } } if (success && !func_done) { @@ -910,70 +913,70 @@ demangle_template (work, mangled, tname, trawname) done = 0; /* temp is initialized in do_type */ success = do_type (work, mangled, &temp); -/* - if (success) + /* + if (success) { - string_appends (tname, &temp); + string_appends (tname, &temp); } -*/ + */ string_delete(&temp); if (!success) { break; } -/* - string_append (tname, "="); -*/ + /* + string_append (tname, "="); + */ while (*old_p && !done) { switch (*old_p) { - case 'P': - case 'p': - case 'R': - done = is_pointer = 1; - break; - case 'C': /* const */ - case 'S': /* explicitly signed [char] */ - case 'U': /* unsigned */ - case 'V': /* volatile */ - case 'F': /* function */ - case 'M': /* member function */ - case 'O': /* ??? */ - old_p++; - continue; - case 'Q': /* qualified name */ - done = is_integral = 1; - break; - case 'T': /* remembered type */ - abort (); - break; - case 'v': /* void */ - abort (); - break; - case 'x': /* long long */ - case 'l': /* long */ - case 'i': /* int */ - case 's': /* short */ - case 'w': /* wchar_t */ - done = is_integral = 1; - break; - case 'b': /* bool */ - done = is_bool = 1; - break; - case 'c': /* char */ - done = is_char = 1; - break; - case 'r': /* long double */ - case 'd': /* double */ - case 'f': /* float */ - done = is_real = 1; - break; - default: - /* it's probably user defined type, let's assume - it's integral, it seems hard to figure out - what it really is */ - done = is_integral = 1; + case 'P': + case 'p': + case 'R': + done = is_pointer = 1; + break; + case 'C': /* const */ + case 'S': /* explicitly signed [char] */ + case 'U': /* unsigned */ + case 'V': /* volatile */ + case 'F': /* function */ + case 'M': /* member function */ + case 'O': /* ??? */ + old_p++; + continue; + case 'Q': /* qualified name */ + done = is_integral = 1; + break; + case 'T': /* remembered type */ + abort (); + break; + case 'v': /* void */ + abort (); + break; + case 'x': /* long long */ + case 'l': /* long */ + case 'i': /* int */ + case 's': /* short */ + case 'w': /* wchar_t */ + done = is_integral = 1; + break; + case 'b': /* bool */ + done = is_bool = 1; + break; + case 'c': /* char */ + done = is_char = 1; + break; + case 'r': /* long double */ + case 'd': /* double */ + case 'f': /* float */ + done = is_real = 1; + break; + default: + /* it's probably user defined type, let's assume + it's integral, it seems hard to figure out + what it really is */ + done = is_integral = 1; } } if (is_integral) @@ -991,8 +994,8 @@ demangle_template (work, mangled, tname, trawname) } else if (is_char) { - char tmp[2]; - int val; + char tmp[2]; + int val; if (**mangled == 'm') { string_appendn (tname, "-", 1); @@ -1088,19 +1091,19 @@ demangle_template (work, mangled, tname, trawname) string_append (tname, " "); string_append (tname, ">"); -/* - if (work -> static_type) - { - string_append (declp, *mangled + 1); - *mangled += strlen (*mangled); - success = 1; - } - else - { - success = demangle_args (work, mangled, declp); - } + /* + if (work -> static_type) + { + string_append (declp, *mangled + 1); + *mangled += strlen (*mangled); + success = 1; } -*/ + else + { + success = demangle_args (work, mangled, declp); + } + } + */ return (success); } @@ -1114,14 +1117,14 @@ arm_pt (work, mangled, n, anchor, args) /* ARM template? */ if (ARM_DEMANGLING && (*anchor = mystrstr (mangled, "__pt__"))) { - int len; - *args = *anchor + 6; - len = consume_count (args); - if (*args + len == mangled + n && **args == '_') - { - ++*args; - return 1; - } + int len; + *args = *anchor + 6; + len = consume_count (args); + if (*args + len == mangled + n && **args == '_') + { + ++*args; + return 1; + } } return 0; } @@ -1139,26 +1142,26 @@ demangle_arm_pt (work, mangled, n, declp) /* ARM template? */ if (arm_pt (work, *mangled, n, &p, &args)) - { - string arg; - string_init (&arg); - string_appendn (declp, *mangled, p - *mangled); - string_append (declp, "<"); - /* should do error checking here */ - while (args < e) { - string_clear (&arg); - do_type (work, &args, &arg); - string_appends (declp, &arg); - string_append (declp, ","); - } - string_delete (&arg); - --declp->p; - string_append (declp, ">"); - } + { + string arg; + string_init (&arg); + string_appendn (declp, *mangled, p - *mangled); + string_append (declp, "<"); + /* should do error checking here */ + while (args < e) { + string_clear (&arg); + do_type (work, &args, &arg); + string_appends (declp, &arg); + string_append (declp, ","); + } + string_delete (&arg); + --declp->p; + string_append (declp, ">"); + } else - { - string_appendn (declp, *mangled, n); - } + { + string_appendn (declp, *mangled, n); + } *mangled += n; } @@ -1173,10 +1176,10 @@ demangle_class_name (work, mangled, declp) n = consume_count (mangled); if (strlen (*mangled) >= n) - { - demangle_arm_pt (work, mangled, n, declp); - success = 1; - } + { + demangle_arm_pt (work, mangled, n, declp); + success = 1; + } return (success); } @@ -1326,9 +1329,9 @@ demangle_prefix (work, mangled, declp) work->constructor = 2; } -/* This block of code is a reduction in strength time optimization - of: - scan = mystrstr (*mangled, "__"); */ + /* This block of code is a reduction in strength time optimization + of: + scan = mystrstr (*mangled, "__"); */ { scan = *mangled; @@ -1491,9 +1494,9 @@ gnu_special (work, mangled, declp) && (*mangled)[2] == 'v' && (*mangled)[3] == 't' && (*mangled)[4] == '_') - || ((*mangled)[1] == 'v' - && (*mangled)[2] == 't' - && strchr (cplus_markers, (*mangled)[3]) != NULL))) + || ((*mangled)[1] == 'v' + && (*mangled)[2] == 't' + && strchr (cplus_markers, (*mangled)[3]) != NULL))) { /* Found a GNU style virtual table, get past "_vt<CPLUS_MARKER>" and create the decl. Note that we consume the entire mangled @@ -1552,16 +1555,16 @@ gnu_special (work, mangled, declp) (*mangled)++; switch (**mangled) { - case 'Q': - success = demangle_qualified (work, mangled, declp, 0, 1); - break; - case 't': - success = demangle_template (work, mangled, declp, 0); - break; - default: - n = consume_count (mangled); - string_appendn (declp, *mangled, n); - (*mangled) += n; + case 'Q': + success = demangle_qualified (work, mangled, declp, 0, 1); + break; + case 't': + success = demangle_template (work, mangled, declp, 0); + break; + default: + n = consume_count (mangled); + string_appendn (declp, *mangled, n); + (*mangled) += n; } if (success && (p == *mangled)) { @@ -1604,16 +1607,16 @@ gnu_special (work, mangled, declp) (*mangled) += 4; switch (**mangled) { - case 'Q': - success = demangle_qualified (work, mangled, declp, 0, 1); - break; - case 't': - success = demangle_template (work, mangled, declp, 0); - break; - default: - n = consume_count (mangled); - string_appendn (declp, *mangled, n); - (*mangled) += n; + case 'Q': + success = demangle_qualified (work, mangled, declp, 0, 1); + break; + case 't': + success = demangle_template (work, mangled, declp, 0); + break; + default: + n = consume_count (mangled); + string_appendn (declp, *mangled, n); + (*mangled) += n; } if (success && **mangled != '\0') success = 0; @@ -1819,9 +1822,9 @@ demangle_qualified (work, mangled, result, isfuncname, append) namelength = consume_count (mangled); if (strlen (*mangled) < namelength) { - /* Simple sanity check failed */ - success = 0; - break; + /* Simple sanity check failed */ + success = 0; + break; } string_appendn (&temp, *mangled, namelength); *mangled += namelength; @@ -1947,20 +1950,20 @@ do_type (work, mangled, result) switch (**mangled) { - /* A pointer type */ + /* A pointer type */ case 'P': case 'p': (*mangled)++; string_prepend (&decl, "*"); break; - /* A reference type */ + /* A reference type */ case 'R': (*mangled)++; string_prepend (&decl, "&"); break; - /* An array */ + /* An array */ case 'A': { const char *p = ++(*mangled); @@ -1996,7 +1999,7 @@ do_type (work, mangled, result) } break; - /* A function */ + /* A function */ case 'F': (*mangled)++; if (!STRING_EMPTY (&decl) && decl.b[0] == '*') @@ -2026,22 +2029,39 @@ do_type (work, mangled, result) member = **mangled == 'M'; (*mangled)++; - if (!isdigit (**mangled)) - { - success = 0; - break; - } - n = consume_count (mangled); - if (strlen (*mangled) < n) + if (!isdigit (**mangled) && **mangled != 't') { success = 0; break; } + string_append (&decl, ")"); string_prepend (&decl, "::"); - string_prependn (&decl, *mangled, n); + if (isdigit (**mangled)) + { + n = consume_count (mangled); + if (strlen (*mangled) < n) + { + success = 0; + break; + } + string_prependn (&decl, *mangled, n); + *mangled += n; + } + else + { + string temp; + string_init (&temp); + success = demangle_template (work, mangled, &temp, NULL); + if (success) + { + string_prependn (&decl, temp.b, temp.p - temp.b); + string_clear (&temp); + } + else + break; + } string_prepend (&decl, "("); - *mangled += n; if (member) { if (**mangled == 'C') @@ -2084,27 +2104,27 @@ do_type (work, mangled, result) break; } case 'G': - (*mangled)++; - break; + (*mangled)++; + break; case 'C': (*mangled)++; -/* - if ((*mangled)[1] == 'P') + /* + if ((*mangled)[1] == 'P') { -*/ - if (PRINT_ANSI_QUALIFIERS) + */ + if (PRINT_ANSI_QUALIFIERS) + { + if (!STRING_EMPTY (&decl)) { - if (!STRING_EMPTY (&decl)) - { - string_prepend (&decl, " "); - } - string_prepend (&decl, "const"); + string_prepend (&decl, " "); } - break; -/* + string_prepend (&decl, "const"); } -*/ + break; + /* + } + */ /* fall through */ default: @@ -2116,13 +2136,13 @@ do_type (work, mangled, result) switch (**mangled) { /* A qualified name, such as "Outer::Inner". */ - case 'Q': - success = demangle_qualified (work, mangled, result, 0, 1); - break; + case 'Q': + success = demangle_qualified (work, mangled, result, 0, 1); + break; - default: - success = demangle_fund_type (work, mangled, result); - break; + default: + success = demangle_fund_type (work, mangled, result); + break; } if (success) @@ -2169,35 +2189,35 @@ demangle_fund_type (work, mangled, result) { switch (**mangled) { - case 'C': - (*mangled)++; - if (PRINT_ANSI_QUALIFIERS) - { - APPEND_BLANK (result); - string_append (result, "const"); - } - break; - case 'U': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "unsigned"); - break; - case 'S': /* signed char only */ - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "signed"); - break; - case 'V': - (*mangled)++; - if (PRINT_ANSI_QUALIFIERS) - { - APPEND_BLANK (result); - string_append (result, "volatile"); - } - break; - default: - done = 1; - break; + case 'C': + (*mangled)++; + if (PRINT_ANSI_QUALIFIERS) + { + APPEND_BLANK (result); + string_append (result, "const"); + } + break; + case 'U': + (*mangled)++; + APPEND_BLANK (result); + string_append (result, "unsigned"); + break; + case 'S': /* signed char only */ + (*mangled)++; + APPEND_BLANK (result); + string_append (result, "signed"); + break; + case 'V': + (*mangled)++; + if (PRINT_ANSI_QUALIFIERS) + { + APPEND_BLANK (result); + string_append (result, "volatile"); + } + break; + default: + done = 1; + break; } } @@ -2205,96 +2225,96 @@ demangle_fund_type (work, mangled, result) switch (**mangled) { - case '\0': - case '_': - break; - case 'v': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "void"); - break; - case 'x': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "long long"); - break; - case 'l': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "long"); - break; - case 'i': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "int"); - break; - case 's': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "short"); - break; - case 'b': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "bool"); - break; - case 'c': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "char"); - break; - case 'w': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "wchar_t"); - break; - case 'r': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "long double"); - break; - case 'd': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "double"); - break; - case 'f': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "float"); - break; - case 'G': - (*mangled)++; - if (!isdigit (**mangled)) - { - success = 0; - break; - } - /* fall through */ - /* An explicit type, such as "6mytype" or "7integer" */ - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - APPEND_BLANK (result); - if (!demangle_class_name (work, mangled, result)) { - --result->p; + case '\0': + case '_': + break; + case 'v': + (*mangled)++; + APPEND_BLANK (result); + string_append (result, "void"); + break; + case 'x': + (*mangled)++; + APPEND_BLANK (result); + string_append (result, "long long"); + break; + case 'l': + (*mangled)++; + APPEND_BLANK (result); + string_append (result, "long"); + break; + case 'i': + (*mangled)++; + APPEND_BLANK (result); + string_append (result, "int"); + break; + case 's': + (*mangled)++; + APPEND_BLANK (result); + string_append (result, "short"); + break; + case 'b': + (*mangled)++; + APPEND_BLANK (result); + string_append (result, "bool"); + break; + case 'c': + (*mangled)++; + APPEND_BLANK (result); + string_append (result, "char"); + break; + case 'w': + (*mangled)++; + APPEND_BLANK (result); + string_append (result, "wchar_t"); + break; + case 'r': + (*mangled)++; + APPEND_BLANK (result); + string_append (result, "long double"); + break; + case 'd': + (*mangled)++; + APPEND_BLANK (result); + string_append (result, "double"); + break; + case 'f': + (*mangled)++; + APPEND_BLANK (result); + string_append (result, "float"); + break; + case 'G': + (*mangled)++; + if (!isdigit (**mangled)) + { success = 0; + break; } - break; - case 't': - success = demangle_template(work,mangled, result, 0); - break; - default: + /* fall through */ + /* An explicit type, such as "6mytype" or "7integer" */ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + APPEND_BLANK (result); + if (!demangle_class_name (work, mangled, result)) { + --result->p; success = 0; - break; } + break; + case 't': + success = demangle_template(work,mangled, result, 0); + break; + default: + success = 0; + break; + } return (success); } @@ -2635,7 +2655,7 @@ demangle_function_name (work, mangled, declp, scan) } } else if (declp->b[0] == '_' && declp->b[1] == '_' - && declp->b[2] == 'o' && declp->b[3] == 'p') + && declp->b[2] == 'o' && declp->b[3] == 'p') { /* ANSI. */ /* type conversion operator. */ @@ -2846,7 +2866,7 @@ string_prependn (p, s, n) static void demangle_it (mangled_name) - char *mangled_name; + char *mangled_name; { char *result; @@ -2874,8 +2894,8 @@ usage (stream, status) { fprintf (stream, "\ Usage: %s [-_] [-n] [-s {gnu,lucid,arm}] [--strip-underscores]\n\ - [--no-strip-underscores] [--format={gnu,lucid,arm}]\n\ - [--help] [--version] [arg...]\n", + [--no-strip-underscores] [--format={gnu,lucid,arm}]\n\ + [--help] [--version] [arg...]\n", program_name); exit (status); } @@ -2913,40 +2933,40 @@ main (argc, argv) { switch (c) { - case '?': - usage (stderr, 1); - break; - case 'h': - usage (stdout, 0); - case 'n': - strip_underscore = 0; - break; - case 'v': - printf ("GNU %s version %s\n", program_name, program_version); - exit (0); - case '_': - strip_underscore = 1; - break; - case 's': - if (strcmp (optarg, "gnu") == 0) - { - current_demangling_style = gnu_demangling; - } - else if (strcmp (optarg, "lucid") == 0) - { - current_demangling_style = lucid_demangling; - } - else if (strcmp (optarg, "arm") == 0) - { - current_demangling_style = arm_demangling; - } - else - { - fprintf (stderr, "%s: unknown demangling style `%s'\n", - program_name, optarg); - exit (1); - } - break; + case '?': + usage (stderr, 1); + break; + case 'h': + usage (stdout, 0); + case 'n': + strip_underscore = 0; + break; + case 'v': + printf ("GNU %s version %s\n", program_name, program_version); + exit (0); + case '_': + strip_underscore = 1; + break; + case 's': + if (strcmp (optarg, "gnu") == 0) + { + current_demangling_style = gnu_demangling; + } + else if (strcmp (optarg, "lucid") == 0) + { + current_demangling_style = lucid_demangling; + } + else if (strcmp (optarg, "arm") == 0) + { + current_demangling_style = arm_demangling; + } + else + { + fprintf (stderr, "%s: unknown demangling style `%s'\n", + program_name, optarg); + exit (1); + } + break; } } |