Commit 5d644692 by Mike Stump

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
parent 79aff5ac
...@@ -25,6 +25,9 @@ Boston, MA 02111-1307, USA. */ ...@@ -25,6 +25,9 @@ Boston, MA 02111-1307, USA. */
realloc except that they generate a fatal error if there is no realloc except that they generate a fatal error if there is no
available memory. */ available memory. */
/* This file lives in both GCC and libiberty. When making changes, please
try not to break either. */
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
...@@ -777,9 +780,9 @@ demangle_signature (work, mangled, declp) ...@@ -777,9 +780,9 @@ demangle_signature (work, mangled, declp)
} }
break; break;
} }
/* /*
if (AUTO_DEMANGLING || GNU_DEMANGLING) if (AUTO_DEMANGLING || GNU_DEMANGLING)
*/ */
{ {
if (success && expect_func) if (success && expect_func)
{ {
...@@ -910,20 +913,20 @@ demangle_template (work, mangled, tname, trawname) ...@@ -910,20 +913,20 @@ demangle_template (work, mangled, tname, trawname)
done = 0; done = 0;
/* temp is initialized in do_type */ /* temp is initialized in do_type */
success = do_type (work, mangled, &temp); success = do_type (work, mangled, &temp);
/* /*
if (success) if (success)
{ {
string_appends (tname, &temp); string_appends (tname, &temp);
} }
*/ */
string_delete(&temp); string_delete(&temp);
if (!success) if (!success)
{ {
break; break;
} }
/* /*
string_append (tname, "="); string_append (tname, "=");
*/ */
while (*old_p && !done) while (*old_p && !done)
{ {
switch (*old_p) switch (*old_p)
...@@ -1088,7 +1091,7 @@ demangle_template (work, mangled, tname, trawname) ...@@ -1088,7 +1091,7 @@ demangle_template (work, mangled, tname, trawname)
string_append (tname, " "); string_append (tname, " ");
string_append (tname, ">"); string_append (tname, ">");
/* /*
if (work -> static_type) if (work -> static_type)
{ {
string_append (declp, *mangled + 1); string_append (declp, *mangled + 1);
...@@ -1100,7 +1103,7 @@ demangle_template (work, mangled, tname, trawname) ...@@ -1100,7 +1103,7 @@ demangle_template (work, mangled, tname, trawname)
success = demangle_args (work, mangled, declp); success = demangle_args (work, mangled, declp);
} }
} }
*/ */
return (success); return (success);
} }
...@@ -1326,7 +1329,7 @@ demangle_prefix (work, mangled, declp) ...@@ -1326,7 +1329,7 @@ demangle_prefix (work, mangled, declp)
work->constructor = 2; work->constructor = 2;
} }
/* This block of code is a reduction in strength time optimization /* This block of code is a reduction in strength time optimization
of: of:
scan = mystrstr (*mangled, "__"); */ scan = mystrstr (*mangled, "__"); */
...@@ -2026,22 +2029,39 @@ do_type (work, mangled, result) ...@@ -2026,22 +2029,39 @@ do_type (work, mangled, result)
member = **mangled == 'M'; member = **mangled == 'M';
(*mangled)++; (*mangled)++;
if (!isdigit (**mangled)) if (!isdigit (**mangled) && **mangled != 't')
{ {
success = 0; success = 0;
break; break;
} }
string_append (&decl, ")");
string_prepend (&decl, "::");
if (isdigit (**mangled))
{
n = consume_count (mangled); n = consume_count (mangled);
if (strlen (*mangled) < n) if (strlen (*mangled) < n)
{ {
success = 0; success = 0;
break; break;
} }
string_append (&decl, ")");
string_prepend (&decl, "::");
string_prependn (&decl, *mangled, n); string_prependn (&decl, *mangled, n);
string_prepend (&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, "(");
if (member) if (member)
{ {
if (**mangled == 'C') if (**mangled == 'C')
...@@ -2089,10 +2109,10 @@ do_type (work, mangled, result) ...@@ -2089,10 +2109,10 @@ do_type (work, mangled, result)
case 'C': case 'C':
(*mangled)++; (*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))
...@@ -2102,9 +2122,9 @@ do_type (work, mangled, result) ...@@ -2102,9 +2122,9 @@ do_type (work, mangled, result)
string_prepend (&decl, "const"); string_prepend (&decl, "const");
} }
break; break;
/* /*
} }
*/ */
/* fall through */ /* fall through */
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment