diff options
author | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-17 21:28:01 +0000 |
---|---|---|
committer | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-17 21:28:01 +0000 |
commit | c6934f8a4cb3f7e899efcd5a793a1f4632fce7b6 (patch) | |
tree | 15d7cd2785a35ae3fa7e9ddb0823dfc38dd0fd40 /gcc/tree-pretty-print.c | |
parent | 467829319b1fd38f35b497a6ebb34faebd0c0046 (diff) | |
download | gcc-c6934f8a4cb3f7e899efcd5a793a1f4632fce7b6.tar.gz |
* tree-pretty-print.c (dump_generic_node): Add break
after TREE_BINFO handler.
Handle COMPLEX_TYPE, REAL_TYPE and FIXED_POINT_TYPE
Handle NULL TREE_TYPEs.
Handle METHOD_TYPE and FUNCTION_TYPE together.
Call print_struct_decl when printing structures and
TDF_SLIM is not given.
(print_struct_decl): Fix logic for detecting recursion.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146293 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-pretty-print.c')
-rw-r--r-- | gcc/tree-pretty-print.c | 62 |
1 files changed, 51 insertions, 11 deletions
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index a497ca794f5..c8cbe1d4351 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -488,6 +488,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, case TREE_BINFO: dump_generic_node (buffer, BINFO_TYPE (node), spc, flags, false); + break; case TREE_VEC: { @@ -551,8 +552,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, else if (TREE_CODE (node) == VECTOR_TYPE) { pp_string (buffer, "vector "); - dump_generic_node (buffer, TREE_TYPE (node), - spc, flags, false); + dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false); } else if (TREE_CODE (node) == INTEGER_TYPE) { @@ -562,6 +562,24 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, pp_decimal_int (buffer, TYPE_PRECISION (node)); pp_string (buffer, ">"); } + else if (TREE_CODE (node) == COMPLEX_TYPE) + { + pp_string (buffer, "__complex__ "); + dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false); + } + else if (TREE_CODE (node) == REAL_TYPE) + { + pp_string (buffer, "<float:"); + pp_decimal_int (buffer, TYPE_PRECISION (node)); + pp_string (buffer, ">"); + } + else if (TREE_CODE (node) == FIXED_POINT_TYPE) + { + pp_string (buffer, "<fixed-point-"); + pp_string (buffer, TYPE_SATURATING (node) ? "sat:" : "nonsat:"); + pp_decimal_int (buffer, TYPE_PRECISION (node)); + pp_string (buffer, ">"); + } else pp_string (buffer, "<unnamed type>"); } @@ -572,7 +590,12 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, case REFERENCE_TYPE: str = (TREE_CODE (node) == POINTER_TYPE ? "*" : "&"); - if (TREE_CODE (TREE_TYPE (node)) == FUNCTION_TYPE) + if (TREE_TYPE (node) == NULL) + { + pp_string (buffer, str); + pp_string (buffer, "<null type>"); + } + else if (TREE_CODE (TREE_TYPE (node)) == FUNCTION_TYPE) { tree fnode = TREE_TYPE (node); @@ -612,11 +635,6 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, NIY; break; - case METHOD_TYPE: - dump_decl_name (buffer, TYPE_NAME (TYPE_METHOD_BASETYPE (node)), flags); - pp_string (buffer, "::"); - break; - case TARGET_MEM_REF: { const char *sep = ""; @@ -710,7 +728,12 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, if (TYPE_NAME (node)) dump_generic_node (buffer, TYPE_NAME (node), spc, flags, false); - else + else if (!(flags & TDF_SLIM)) + /* FIXME: If we eliminate the 'else' above and attempt + to show the fields for named types, we may get stuck + following a cycle of pointers to structs. The alleged + self-reference check in print_struct_decl will not detect + cycles involving more than one pointer or struct type. */ print_struct_decl (buffer, node, spc, flags); break; } @@ -836,6 +859,23 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, break; case FUNCTION_TYPE: + case METHOD_TYPE: + dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false); + pp_space (buffer); + if (TREE_CODE (node) == METHOD_TYPE) + { + if (TYPE_METHOD_BASETYPE (node)) + dump_decl_name (buffer, TYPE_NAME (TYPE_METHOD_BASETYPE (node)), + flags); + else + pp_string (buffer, "<null method basetype>"); + pp_string (buffer, "::"); + } + if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node))) + dump_decl_name (buffer, TYPE_NAME (node), flags); + else + pp_printf (buffer, "<T%x>", TYPE_UID (node)); + dump_function_declaration (buffer, node, spc, flags); break; case FUNCTION_DECL: @@ -2206,8 +2246,8 @@ print_struct_decl (pretty_printer *buffer, const_tree node, int spc, int flags) Maybe this could be solved by looking at the scope in which the structure was declared. */ if (TREE_TYPE (tmp) != node - || (TREE_CODE (TREE_TYPE (tmp)) == POINTER_TYPE - && TREE_TYPE (TREE_TYPE (tmp)) != node)) + && (TREE_CODE (TREE_TYPE (tmp)) != POINTER_TYPE + || TREE_TYPE (TREE_TYPE (tmp)) != node)) { print_declaration (buffer, tmp, spc+2, flags); pp_newline (buffer); |