Commit 1966af04 by Gabriel Dos Reis Committed by Gabriel Dos Reis

tree-dump.h (dump_string_field): Declare.

        * tree-dump.h (dump_string_field): Declare.
        * tree-dump.c: Use it instead of dump_string.
        (dump_string_field): Make non-static.

cp/
        * dump.c: Use dump_string_field.

From-SVN: r101547
parent 384a8760
2005-07-02 Gabriel Dos Reis <gdr@integrable-solutions.net>
* tree-dump.h (dump_string_field): Declare.
* tree-dump.c: Use it instead of dump_string.
(dump_string_field): Make non-static.
2005-07-03 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.c (sh_output_mi_thunk): Initialize and clean
......
2005-07-02 Gabriel Dos Reis <gdr@integrable-solutions.net>
* dump.c: Use dump_string_field.
2005-07-03 Joseph S. Myers <joseph@codesourcery.com>
* cp-tree.h (GCC_DIAG_STYLE): #undef before defining. Change
......
......@@ -39,11 +39,11 @@ static void
dump_access (dump_info_p di, tree t)
{
if (TREE_PROTECTED(t))
dump_string (di, "protected");
dump_string_field (di, "accs", "prot");
else if (TREE_PRIVATE(t))
dump_string (di, "private");
dump_string_field (di, "accs", "priv");
else
dump_string (di, "public");
dump_string_field (di, "accs", "pub");
}
/* Dump a representation of the specific operator for an overloaded
......@@ -215,7 +215,7 @@ cp_dump_tree (void* dump_info, tree t)
if (DECL_P (t))
{
if (DECL_LANG_SPECIFIC (t) && DECL_LANGUAGE (t) != lang_cplusplus)
dump_string (di, language_to_string (DECL_LANGUAGE (t)));
dump_string_field (di, "lang", language_to_string (DECL_LANGUAGE (t)));
}
switch (code)
......@@ -223,7 +223,7 @@ cp_dump_tree (void* dump_info, tree t)
case IDENTIFIER_NODE:
if (IDENTIFIER_OPNAME_P (t))
{
dump_string (di, "operator");
dump_string_field (di, "note", "operator");
return true;
}
else if (IDENTIFIER_TYPENAME_P (t))
......@@ -234,7 +234,7 @@ cp_dump_tree (void* dump_info, tree t)
break;
case OFFSET_TYPE:
dump_string (di, "ptrmem");
dump_string_field (di, "note", "ptrmem");
dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
return true;
......@@ -242,7 +242,7 @@ cp_dump_tree (void* dump_info, tree t)
case RECORD_TYPE:
if (TYPE_PTRMEMFUNC_P (t))
{
dump_string (di, "ptrmem");
dump_string_field (di, "note", "ptrmem");
dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
return true;
......@@ -276,7 +276,7 @@ cp_dump_tree (void* dump_info, tree t)
{
dump_child ("base", BINFO_TYPE (base_binfo));
if (BINFO_VIRTUAL_P (base_binfo))
dump_string (di, "virtual");
dump_string_field (di, "spec", "virt");
dump_access (di, base_binfo);
}
}
......@@ -285,55 +285,55 @@ cp_dump_tree (void* dump_info, tree t)
case FIELD_DECL:
dump_access (di, t);
if (DECL_MUTABLE_P (t))
dump_string(di, "mutable");
dump_string_field (di, "spec", "mutable");
break;
case VAR_DECL:
if (TREE_CODE (CP_DECL_CONTEXT (t)) == RECORD_TYPE)
dump_access (di, t);
if (TREE_STATIC (t) && !TREE_PUBLIC (t))
dump_string (di, "static");
dump_string_field (di, "link", "static");
break;
case FUNCTION_DECL:
if (!DECL_THUNK_P (t))
{
if (DECL_OVERLOADED_OPERATOR_P (t)) {
dump_string (di, "operator");
dump_string_field (di, "note", "operator");
dump_op (di, t);
}
if (DECL_FUNCTION_MEMBER_P (t))
{
dump_string (di, "member");
dump_string_field (di, "note", "member");
dump_access (di, t);
}
if (DECL_PURE_VIRTUAL_P (t))
dump_string (di, "pure");
dump_string_field (di, "spec", "pure");
if (DECL_VIRTUAL_P (t))
dump_string (di, "virtual");
dump_string_field (di, "spec", "virt");
if (DECL_CONSTRUCTOR_P (t))
dump_string (di, "constructor");
dump_string_field (di, "note", "constructor");
if (DECL_DESTRUCTOR_P (t))
dump_string (di, "destructor");
dump_string_field (di, "note", "destructor");
if (DECL_CONV_FN_P (t))
dump_string (di, "conversion");
dump_string_field (di, "note", "conversion");
if (DECL_GLOBAL_CTOR_P (t))
dump_string (di, "global init");
dump_string_field (di, "note", "global init");
if (DECL_GLOBAL_DTOR_P (t))
dump_string (di, "global fini");
dump_string_field (di, "note", "global fini");
if (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t))
dump_string (di, "pseudo tmpl");
dump_string_field (di, "note", "pseudo tmpl");
}
else
{
tree virt = THUNK_VIRTUAL_OFFSET (t);
dump_string (di, "thunk");
dump_string_field (di, "note", "thunk");
if (DECL_THIS_THUNK_P (t))
dump_string (di, "this adjusting");
dump_string_field (di, "note", "this adjusting");
else
{
dump_string (di, "result adjusting");
dump_string_field (di, "note", "result adjusting");
if (virt)
virt = BINFO_VPTR_FIELD (virt);
}
......@@ -366,7 +366,7 @@ cp_dump_tree (void* dump_info, tree t)
case TRY_BLOCK:
dump_stmt (di, t);
if (CLEANUP_P (t))
dump_string (di, "cleanup");
dump_string_field (di, "note", "cleanup");
dump_child ("body", TRY_STMTS (t));
dump_child ("hdlr", TRY_HANDLERS (t));
break;
......
......@@ -38,7 +38,6 @@ static void dump_index (dump_info_p, unsigned int);
static void dequeue_and_dump (dump_info_p);
static void dump_new_line (dump_info_p);
static void dump_maybe_newline (dump_info_p);
static void dump_string_field (dump_info_p, const char *, const char *);
static int dump_enable_all (int, int);
/* Add T to the end of the queue of nodes to dump. Returns the index
......@@ -195,7 +194,7 @@ dump_string (dump_info_p di, const char *string)
/* Dump the string field S. */
static void
void
dump_string_field (dump_info_p di, const char *field, const char *string)
{
dump_maybe_newline (di);
......@@ -259,7 +258,7 @@ dequeue_and_dump (dump_info_p di)
dump_child ("type", BINFO_TYPE (t));
if (BINFO_VIRTUAL_P (t))
dump_string (di, "virt");
dump_string_field (di, "spec", "virt");
dump_int (di, "bases", BINFO_N_BASE_BINFOS (t));
for (ix = 0; BINFO_BASE_ITERATE (t, ix, base); ix++)
......@@ -277,7 +276,7 @@ dequeue_and_dump (dump_info_p di)
else
gcc_unreachable ();
dump_string (di, string);
dump_string_field (di, "accs", string);
queue_and_dump_index (di, "binf", base, DUMP_BINFO);
}
......@@ -345,7 +344,7 @@ dequeue_and_dump (dump_info_p di)
}
/* And any declaration can be compiler-generated. */
if (DECL_ARTIFICIAL (t))
dump_string (di, "artificial");
dump_string_field (di, "note", "artificial");
if (TREE_CHAIN (t) && !dump_flag (di, TDF_SLIM, NULL))
dump_child ("chan", TREE_CHAIN (t));
}
......@@ -427,8 +426,7 @@ dequeue_and_dump (dump_info_p di)
case INTEGER_TYPE:
case ENUMERAL_TYPE:
dump_int (di, "prec", TYPE_PRECISION (t));
if (TYPE_UNSIGNED (t))
dump_string (di, "unsigned");
dump_string_field (di, "sign", TYPE_UNSIGNED (t) ? "unsigned": "signed");
dump_child ("min", TYPE_MIN_VALUE (t));
dump_child ("max", TYPE_MAX_VALUE (t));
......@@ -465,9 +463,9 @@ dequeue_and_dump (dump_info_p di)
case RECORD_TYPE:
case UNION_TYPE:
if (TREE_CODE (t) == RECORD_TYPE)
dump_string (di, "struct");
dump_string_field (di, "tag", "struct");
else
dump_string (di, "union");
dump_string_field (di, "tag", "union");
dump_child ("flds", TYPE_FIELDS (t));
dump_child ("fncs", TYPE_METHODS (t));
......@@ -500,18 +498,18 @@ dequeue_and_dump (dump_info_p di)
{
dump_int (di, "used", TREE_USED (t));
if (DECL_REGISTER (t))
dump_string (di, "register");
dump_string_field (di, "spec", "register");
}
break;
case FUNCTION_DECL:
dump_child ("args", DECL_ARGUMENTS (t));
if (DECL_EXTERNAL (t))
dump_string (di, "undefined");
dump_string_field (di, "body", "undefined");
if (TREE_PUBLIC (t))
dump_string (di, "extern");
dump_string_field (di, "link", "extern");
else
dump_string (di, "static");
dump_string_field (di, "link", "static");
if (DECL_LANG_SPECIFIC (t) && !dump_flag (di, TDF_SLIM, t))
dump_child ("body", DECL_SAVED_TREE (t));
break;
......
......@@ -82,6 +82,7 @@ struct dump_info
extern void dump_pointer (dump_info_p, const char *, void *);
extern void dump_int (dump_info_p, const char *, int);
extern void dump_string (dump_info_p, const char *);
extern void dump_string_field (dump_info_p, const char *, const char *);
extern void dump_stmt (dump_info_p, tree);
extern void queue_and_dump_index (dump_info_p, const char *, tree, int);
extern void queue_and_dump_type (dump_info_p, tree);
......
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