summaryrefslogtreecommitdiff
path: root/gcc/cplus-dem.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1998-02-06 01:18:06 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1998-02-06 01:18:06 +0000
commit08532d4f73587fd37d94fb61133cdade24ae8a14 (patch)
tree5d24951e6f65a794707a6a64e1c7b521375dd809 /gcc/cplus-dem.c
parent01b84a934eeabd0d901c1d3d80627d1d750f0532 (diff)
downloadgcc-08532d4f73587fd37d94fb61133cdade24ae8a14.tar.gz
* dwarf2out.c: Add old_args_size.
(dwarf2out_args_size): Use it. (dwarf2out_begin_prologue): Initialize it. (dwarf2out_stack_adjust): If !asynchronous_exceptions, save up pushed args until we see a call. * final.c (final_scan_insn): Hand CALL_INSNs off to the dwarf2 code before outputting them. * cplus-dem.c (demangle_template_template_parm): New function. (demangle_template): Handle template template parameters. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@17685 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cplus-dem.c')
-rw-r--r--gcc/cplus-dem.c144
1 files changed, 135 insertions, 9 deletions
diff --git a/gcc/cplus-dem.c b/gcc/cplus-dem.c
index 1fb474f47ea..b915fe1498f 100644
--- a/gcc/cplus-dem.c
+++ b/gcc/cplus-dem.c
@@ -226,6 +226,10 @@ demangle_method_args PARAMS ((struct work_stuff *work, const char **, string *))
#endif
static int
+demangle_template_template_parm PARAMS ((struct work_stuff *work,
+ const char **, string *));
+
+static int
demangle_template PARAMS ((struct work_stuff *work, const char **, string *,
string *, int));
@@ -926,6 +930,70 @@ demangle_method_args (work, mangled, declp)
#endif
static int
+demangle_template_template_parm (work, mangled, tname)
+ struct work_stuff *work;
+ const char **mangled;
+ string *tname;
+{
+ int i;
+ int r;
+ int need_comma = 0;
+ int success = 1;
+ string temp;
+
+ string_append (tname, "template <");
+ /* get size of template parameter list */
+ if (get_count (mangled, &r))
+ {
+ for (i = 0; i < r; i++)
+ {
+ if (need_comma)
+ {
+ string_append (tname, ", ");
+ }
+
+ /* Z for type parameters */
+ if (**mangled == 'Z')
+ {
+ (*mangled)++;
+ string_append (tname, "class");
+ }
+ /* z for template parameters */
+ else if (**mangled == 'z')
+ {
+ (*mangled)++;
+ success =
+ demangle_template_template_parm (work, mangled, tname);
+ if (!success)
+ {
+ break;
+ }
+ }
+ else
+ {
+ /* temp is initialized in do_type */
+ success = do_type (work, mangled, &temp);
+ if (success)
+ {
+ string_appends (tname, &temp);
+ }
+ string_delete(&temp);
+ if (!success)
+ {
+ break;
+ }
+ }
+ need_comma = 1;
+ }
+
+ }
+ if (tname->p[-1] == '>')
+ string_append (tname, " ");
+ string_append (tname, "> class");
+ return (success);
+}
+
+static int
demangle_template (work, mangled, tname, trawname, is_type)
struct work_stuff *work;
const char **mangled;
@@ -954,19 +1022,50 @@ demangle_template (work, mangled, tname, trawname, is_type)
{
start = *mangled;
/* get template name */
- if ((r = consume_count (mangled)) == 0 || strlen (*mangled) < r)
+ if (**mangled == 'z')
{
- return (0);
+ int idx;
+ (*mangled)++;
+ (*mangled)++;
+
+ idx = consume_count_with_underscores (mangled);
+ if (idx == -1
+ || (work->tmpl_argvec && idx >= work->ntmpl_args)
+ || consume_count_with_underscores (mangled) == -1)
+ {
+ return (0);
+ }
+ if (work->tmpl_argvec)
+ {
+ string_append (tname, work->tmpl_argvec[idx]);
+ if (trawname)
+ string_append (trawname, work->tmpl_argvec[idx]);
+ }
+ else
+ {
+ char buf[10];
+ sprintf(buf, "T%d", idx);
+ string_append (tname, buf);
+ if (trawname)
+ string_append (trawname, work->tmpl_argvec[idx]);
+ }
}
- if (trawname)
- string_appendn (trawname, *mangled, r);
- is_java_array = (work -> options & DMGL_JAVA)
- && strncmp (*mangled, "JArray1Z", 8) == 0;
- if (! is_java_array)
+ else
{
- string_appendn (tname, *mangled, r);
+ if ((r = consume_count (mangled)) == 0 || strlen (*mangled) < r)
+ {
+ return (0);
+ }
+ if (trawname)
+ string_appendn (trawname, *mangled, r);
+ is_java_array = (work -> options & DMGL_JAVA)
+ && strncmp (*mangled, "JArray1Z", 8) == 0;
+ if (! is_java_array)
+ {
+ string_appendn (tname, *mangled, r);
+ }
+ *mangled += r;
}
- *mangled += r;
}
if (!is_java_array)
string_append (tname, "<");
@@ -1014,6 +1113,33 @@ demangle_template (work, mangled, tname, trawname, is_type)
break;
}
}
+ /* z for template parameters */
+ else if (**mangled == 'z')
+ {
+ int r2;
+ (*mangled)++;
+ success = demangle_template_template_parm (work, mangled, tname);
+
+ if (success
+ && (r2 = consume_count (mangled)) > 0 && strlen (*mangled) >= r2)
+ {
+ string_append (tname, " ");
+ string_appendn (tname, *mangled, r2);
+ if (!is_type)
+ {
+ /* Save the template argument. */
+ int len = r2;
+ work->tmpl_argvec[i] = xmalloc (len + 1);
+ memcpy (work->tmpl_argvec[i], *mangled, len);
+ work->tmpl_argvec[i][len] = '\0';
+ }
+ *mangled += r2;
+ }
+ if (!success)
+ {
+ break;
+ }
+ }
else
{
string param;