diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-31 07:14:43 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-31 07:14:43 +0000 |
commit | e14083e04548801c04171dac3ddbfdb23f036c70 (patch) | |
tree | 059c7084e2e13dc06d4f05204f437a4535dae739 /gcc/c-objc-common.c | |
parent | 04bf85aa72994c69309424537f514ca11ca82553 (diff) | |
download | gcc-e14083e04548801c04171dac3ddbfdb23f036c70.tar.gz |
* c-objc-common.c (c_tree_printer): Handle types correctly.
Factor code a bit.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73121 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-objc-common.c')
-rw-r--r-- | gcc/c-objc-common.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c index 287cf300232..e9a4a09ed8d 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; } |