Commit c157f85c by Richard Henderson Committed by Richard Henderson

c-objc-common.c (c_tree_printer): Handle types correctly.

        * c-objc-common.c (c_tree_printer): Handle types correctly.
        Factor code a bit.

From-SVN: r73121
parent ad37274a
2003-10-30 Richard Henderson <rth@redhat.com>
* c-objc-common.c (c_tree_printer): Handle types correctly.
Factor code a bit.
2003-10-30 Kelley Cook <kcook@gcc.gnu.org> 2003-10-30 Kelley Cook <kcook@gcc.gnu.org>
* value-prof.c, web.c: Update to C90. * value-prof.c, web.c: Update to C90.
......
...@@ -293,29 +293,41 @@ static bool ...@@ -293,29 +293,41 @@ static bool
c_tree_printer (pretty_printer *pp, text_info *text) c_tree_printer (pretty_printer *pp, text_info *text)
{ {
tree t = va_arg (*text->args_ptr, tree); tree t = va_arg (*text->args_ptr, tree);
const char *n = "({anonymous})";
switch (*text->format_spec) switch (*text->format_spec)
{ {
case 'D': case 'D':
case 'F': case 'F':
if (DECL_NAME (t))
n = (*lang_hooks.decl_printable_name) (t, 2);
break;
case 'T': case 'T':
if (TREE_CODE (t) == TYPE_DECL)
{ {
const char *n = DECL_NAME (t) if (DECL_NAME (t))
? (*lang_hooks.decl_printable_name) (t, 2) n = (*lang_hooks.decl_printable_name) (t, 2);
: "({anonymous})";
pp_string (pp, n);
} }
return true; else
{
t = TYPE_NAME (t);
if (t)
n = IDENTIFIER_POINTER (t);
}
break;
case 'E': case 'E':
if (TREE_CODE (t) == IDENTIFIER_NODE) if (TREE_CODE (t) == IDENTIFIER_NODE)
{ n = IDENTIFIER_POINTER (t);
pp_string (pp, IDENTIFIER_POINTER (t)); else
return true;
}
return false; return false;
break;
default: default:
return false; return false;
} }
pp_string (pp, n);
return true;
} }
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