From: Richard Henderson Date: Fri, 31 Oct 2003 07:14:43 +0000 (-0800) Subject: c-objc-common.c (c_tree_printer): Handle types correctly. X-Git-Tag: releases/gcc-3.4.0~2594 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c157f85cd502738cdbdb57dee1388d14d97a00ad;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 822ff441dbf5..fee124fce18c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2003-10-30 Richard Henderson + + * c-objc-common.c (c_tree_printer): Handle types correctly. + Factor code a bit. + 2003-10-30 Kelley Cook * value-prof.c, web.c: Update to C90. diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c index 287cf300232f..e9a4a09ed8d3 100644 --- a/gcc/c-objc-common.c +++ b/gcc/c-objc-common.c @@ -293,29 +293,41 @@ static bool c_tree_printer (pretty_printer *pp, text_info *text) { tree t = va_arg (*text->args_ptr, tree); + const char *n = "({anonymous})"; switch (*text->format_spec) { case 'D': case 'F': + if (DECL_NAME (t)) + n = (*lang_hooks.decl_printable_name) (t, 2); + break; + case 'T': - { - const char *n = DECL_NAME (t) - ? (*lang_hooks.decl_printable_name) (t, 2) - : "({anonymous})"; - pp_string (pp, n); - } - return true; + if (TREE_CODE (t) == TYPE_DECL) + { + if (DECL_NAME (t)) + n = (*lang_hooks.decl_printable_name) (t, 2); + } + else + { + t = TYPE_NAME (t); + if (t) + n = IDENTIFIER_POINTER (t); + } + break; case 'E': - if (TREE_CODE (t) == IDENTIFIER_NODE) - { - pp_string (pp, IDENTIFIER_POINTER (t)); - return true; - } - return false; + if (TREE_CODE (t) == IDENTIFIER_NODE) + n = IDENTIFIER_POINTER (t); + else + return false; + break; default: return false; } + + pp_string (pp, n); + return true; }