* class.c (dump_class_hierarchy_1): dump fields after hierarchy information.
--- gcc/cp/class.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 14780e7..13579ac 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -8202,6 +8202,44 @@ dump_class_hierarchy_1 (FILE *stream, int flags, tree t) (unsigned long)(TYPE_ALIGN (CLASSTYPE_AS_BASE (t)) / BITS_PER_UNIT)); dump_class_hierarchy_r (stream, flags, TYPE_BINFO (t), TYPE_BINFO (t), 0); + if (TYPE_P (t)) + { + enum tree_code code; + + code = TREE_CODE (t); + if (code == RECORD_TYPE || code == UNION_TYPE) + { + tree field; + fprintf (stream, "fields:\n"); + for (field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field)) + { + tree field_type; + tree field_name; + tree size; + tree bpos; + enum tree_code code; + + code = TREE_CODE (field); + if (code != FIELD_DECL) + continue; + field_type = TREE_TYPE (field); + field_name = DECL_NAME (field); + size = DECL_SIZE (field); + + if (DECL_FIELD_OFFSET (field)) + bpos = bit_position (field); + else + bpos = NULL; + fprintf ( + stream, "%s %s;\n" + "size: %ld, bpos: %ld\n", + type_as_string (field_type, TFF_PLAIN_IDENTIFIER), + field_name ? IDENTIFIER_POINTER (field_name) : "(base)", + tree_to_shwi (size), bpos == NULL ? 0 : tree_to_shwi (bpos)); + } + } + } + fprintf (stream, "\n"); } -- 1.9.1