This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH to translation unit dump


being systematic about debugging format helps debugging tools.  So,
now we're systematic with the FIELD:VALUE format.
We were spelling virtual as both "virt" and "virtual". This patch
makes us just emit one form.  Same for public, protected and private.


-- Gaby
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.

cp/
2005-07-02  Gabriel Dos Reis  <gdr@integrable-solutions.net>

	* dump.c: Use dump_string_field.

Index: tree-dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-dump.c,v
retrieving revision 1.44
diff -p -r1.44 tree-dump.c
*** tree-dump.c	3 Jul 2005 01:14:56 -0000	1.44
--- tree-dump.c	3 Jul 2005 06:46:53 -0000
*************** static void dump_index (dump_info_p, uns
*** 38,44 ****
  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
--- 38,43 ----
*************** dump_string (dump_info_p di, const char 
*** 195,201 ****
  
  /* Dump the string field S.  */
  
! static void
  dump_string_field (dump_info_p di, const char *field, const char *string)
  {
    dump_maybe_newline (di);
--- 194,200 ----
  
  /* Dump the string field S.  */
  
! void
  dump_string_field (dump_info_p di, const char *field, const char *string)
  {
    dump_maybe_newline (di);
*************** dequeue_and_dump (dump_info_p di)
*** 259,265 ****
        dump_child ("type", BINFO_TYPE (t));
  
        if (BINFO_VIRTUAL_P (t))
! 	dump_string (di, "virt");
  
        dump_int (di, "bases", BINFO_N_BASE_BINFOS (t));
        for (ix = 0; BINFO_BASE_ITERATE (t, ix, base); ix++)
--- 258,264 ----
        dump_child ("type", BINFO_TYPE (t));
  
        if (BINFO_VIRTUAL_P (t))
! 	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++)
*************** dequeue_and_dump (dump_info_p di)
*** 277,283 ****
  	  else
  	    gcc_unreachable ();
  
! 	  dump_string (di, string);
  	  queue_and_dump_index (di, "binf", base, DUMP_BINFO);
  	}
  
--- 276,282 ----
  	  else
  	    gcc_unreachable ();
  
! 	  dump_string_field (di, "accs", string);
  	  queue_and_dump_index (di, "binf", base, DUMP_BINFO);
  	}
  
*************** dequeue_and_dump (dump_info_p di)
*** 345,351 ****
  	}
        /* And any declaration can be compiler-generated.  */
        if (DECL_ARTIFICIAL (t))
! 	dump_string (di, "artificial");
        if (TREE_CHAIN (t) && !dump_flag (di, TDF_SLIM, NULL))
  	dump_child ("chan", TREE_CHAIN (t));
      }
--- 344,350 ----
  	}
        /* And any declaration can be compiler-generated.  */
        if (DECL_ARTIFICIAL (t))
! 	dump_string_field (di, "note", "artificial");
        if (TREE_CHAIN (t) && !dump_flag (di, TDF_SLIM, NULL))
  	dump_child ("chan", TREE_CHAIN (t));
      }
*************** dequeue_and_dump (dump_info_p di)
*** 427,434 ****
      case INTEGER_TYPE:
      case ENUMERAL_TYPE:
        dump_int (di, "prec", TYPE_PRECISION (t));
!       if (TYPE_UNSIGNED (t))
! 	dump_string (di, "unsigned");
        dump_child ("min", TYPE_MIN_VALUE (t));
        dump_child ("max", TYPE_MAX_VALUE (t));
  
--- 426,432 ----
      case INTEGER_TYPE:
      case ENUMERAL_TYPE:
        dump_int (di, "prec", TYPE_PRECISION (t));
!       dump_string_field (di, "sign", TYPE_UNSIGNED (t) ? "unsigned": "signed");
        dump_child ("min", TYPE_MIN_VALUE (t));
        dump_child ("max", TYPE_MAX_VALUE (t));
  
*************** dequeue_and_dump (dump_info_p di)
*** 465,473 ****
      case RECORD_TYPE:
      case UNION_TYPE:
        if (TREE_CODE (t) == RECORD_TYPE)
! 	dump_string (di, "struct");
        else
! 	dump_string (di, "union");
  
        dump_child ("flds", TYPE_FIELDS (t));
        dump_child ("fncs", TYPE_METHODS (t));
--- 463,471 ----
      case RECORD_TYPE:
      case UNION_TYPE:
        if (TREE_CODE (t) == RECORD_TYPE)
! 	dump_string_field (di, "tag", "struct");
        else
! 	dump_string_field (di, "tag", "union");
  
        dump_child ("flds", TYPE_FIELDS (t));
        dump_child ("fncs", TYPE_METHODS (t));
*************** dequeue_and_dump (dump_info_p di)
*** 500,517 ****
  	{
  	  dump_int (di, "used", TREE_USED (t));
  	  if (DECL_REGISTER (t))
! 	    dump_string (di, "register");
  	}
        break;
  
      case FUNCTION_DECL:
        dump_child ("args", DECL_ARGUMENTS (t));
        if (DECL_EXTERNAL (t))
! 	dump_string (di, "undefined");
        if (TREE_PUBLIC (t))
! 	dump_string (di, "extern");
        else
! 	dump_string (di, "static");
        if (DECL_LANG_SPECIFIC (t) && !dump_flag (di, TDF_SLIM, t))
  	dump_child ("body", DECL_SAVED_TREE (t));
        break;
--- 498,515 ----
  	{
  	  dump_int (di, "used", TREE_USED (t));
  	  if (DECL_REGISTER (t))
! 	    dump_string_field (di, "spec", "register");
  	}
        break;
  
      case FUNCTION_DECL:
        dump_child ("args", DECL_ARGUMENTS (t));
        if (DECL_EXTERNAL (t))
! 	dump_string_field (di, "body", "undefined");
        if (TREE_PUBLIC (t))
! 	dump_string_field (di, "link", "extern");
        else
! 	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;
Index: tree-dump.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-dump.h,v
retrieving revision 1.11
diff -p -r1.11 tree-dump.h
*** tree-dump.h	25 Jun 2005 02:01:20 -0000	1.11
--- tree-dump.h	3 Jul 2005 06:46:53 -0000
*************** struct dump_info
*** 82,87 ****
--- 82,88 ----
  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);
Index: cp/dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/dump.c,v
retrieving revision 1.88
diff -p -r1.88 dump.c
*** cp/dump.c	25 Jun 2005 00:58:11 -0000	1.88
--- cp/dump.c	3 Jul 2005 06:46:54 -0000
*************** static void
*** 39,49 ****
  dump_access (dump_info_p di, tree t)
  {
    if (TREE_PROTECTED(t))
!     dump_string (di, "protected");
    else if (TREE_PRIVATE(t))
!     dump_string (di, "private");
    else
!     dump_string (di, "public");
  }
  
  /* Dump a representation of the specific operator for an overloaded
--- 39,49 ----
  dump_access (dump_info_p di, tree t)
  {
    if (TREE_PROTECTED(t))
!     dump_string_field (di, "accs", "prot");
    else if (TREE_PRIVATE(t))
!     dump_string_field (di, "accs", "priv");
    else
!     dump_string_field (di, "accs", "pub");
  }
  
  /* Dump a representation of the specific operator for an overloaded
*************** cp_dump_tree (void* dump_info, tree t)
*** 215,221 ****
    if (DECL_P (t))
      {
        if (DECL_LANG_SPECIFIC (t) && DECL_LANGUAGE (t) != lang_cplusplus)
! 	dump_string (di, language_to_string (DECL_LANGUAGE (t)));
      }
  
    switch (code)
--- 215,221 ----
    if (DECL_P (t))
      {
        if (DECL_LANG_SPECIFIC (t) && DECL_LANGUAGE (t) != lang_cplusplus)
! 	dump_string_field (di, "lang", language_to_string (DECL_LANGUAGE (t)));
      }
  
    switch (code)
*************** cp_dump_tree (void* dump_info, tree t)
*** 223,229 ****
      case IDENTIFIER_NODE:
        if (IDENTIFIER_OPNAME_P (t))
  	{
! 	  dump_string (di, "operator");
  	  return true;
  	}
        else if (IDENTIFIER_TYPENAME_P (t))
--- 223,229 ----
      case IDENTIFIER_NODE:
        if (IDENTIFIER_OPNAME_P (t))
  	{
! 	  dump_string_field (di, "note", "operator");
  	  return true;
  	}
        else if (IDENTIFIER_TYPENAME_P (t))
*************** cp_dump_tree (void* dump_info, tree t)
*** 234,240 ****
        break;
  
      case OFFSET_TYPE:
!       dump_string (di, "ptrmem");
        dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
        dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
        return true;
--- 234,240 ----
        break;
  
      case OFFSET_TYPE:
!       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;
*************** cp_dump_tree (void* dump_info, tree t)
*** 242,248 ****
      case RECORD_TYPE:
        if (TYPE_PTRMEMFUNC_P (t))
  	{
! 	  dump_string (di, "ptrmem");
  	  dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
  	  dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
  	  return true;
--- 242,248 ----
      case RECORD_TYPE:
        if (TYPE_PTRMEMFUNC_P (t))
  	{
! 	  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;
*************** cp_dump_tree (void* dump_info, tree t)
*** 276,282 ****
  	    {
  	      dump_child ("base", BINFO_TYPE (base_binfo));
  	      if (BINFO_VIRTUAL_P (base_binfo))
! 		dump_string (di, "virtual");
  	      dump_access (di, base_binfo);
  	    }
  	}
--- 276,282 ----
  	    {
  	      dump_child ("base", BINFO_TYPE (base_binfo));
  	      if (BINFO_VIRTUAL_P (base_binfo))
! 		dump_string_field (di, "spec", "virt");
  	      dump_access (di, base_binfo);
  	    }
  	}
*************** cp_dump_tree (void* dump_info, tree t)
*** 285,339 ****
      case FIELD_DECL:
        dump_access (di, t);
        if (DECL_MUTABLE_P (t))
! 	dump_string(di, "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");
        break;
  
      case FUNCTION_DECL:
        if (!DECL_THUNK_P (t))
  	{
  	  if (DECL_OVERLOADED_OPERATOR_P (t)) {
! 	    dump_string (di, "operator");
  	    dump_op (di, t);
  	  }
  	  if (DECL_FUNCTION_MEMBER_P (t))
  	    {
! 	      dump_string (di, "member");
  	      dump_access (di, t);
  	    }
  	  if (DECL_PURE_VIRTUAL_P (t))
! 	    dump_string (di, "pure");
  	  if (DECL_VIRTUAL_P (t))
! 	    dump_string (di, "virtual");
  	  if (DECL_CONSTRUCTOR_P (t))
! 	    dump_string (di, "constructor");
  	  if (DECL_DESTRUCTOR_P (t))
! 	    dump_string (di, "destructor");
  	  if (DECL_CONV_FN_P (t))
! 	    dump_string (di, "conversion");
  	  if (DECL_GLOBAL_CTOR_P (t))
! 	    dump_string (di, "global init");
  	  if (DECL_GLOBAL_DTOR_P (t))
! 	    dump_string (di, "global fini");
  	  if (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t))
! 	    dump_string (di, "pseudo tmpl");
  	}
        else
  	{
  	  tree virt = THUNK_VIRTUAL_OFFSET (t);
  
! 	  dump_string (di, "thunk");
  	  if (DECL_THIS_THUNK_P (t))
! 	    dump_string (di, "this adjusting");
  	  else
  	    {
! 	      dump_string (di, "result adjusting");
  	      if (virt)
  		virt = BINFO_VPTR_FIELD (virt);
  	    }
--- 285,339 ----
      case FIELD_DECL:
        dump_access (di, t);
        if (DECL_MUTABLE_P (t))
! 	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_field (di, "link", "static");
        break;
  
      case FUNCTION_DECL:
        if (!DECL_THUNK_P (t))
  	{
  	  if (DECL_OVERLOADED_OPERATOR_P (t)) {
! 	    dump_string_field (di, "note", "operator");
  	    dump_op (di, t);
  	  }
  	  if (DECL_FUNCTION_MEMBER_P (t))
  	    {
! 	      dump_string_field (di, "note", "member");
  	      dump_access (di, t);
  	    }
  	  if (DECL_PURE_VIRTUAL_P (t))
! 	    dump_string_field (di, "spec", "pure");
  	  if (DECL_VIRTUAL_P (t))
! 	    dump_string_field (di, "spec", "virt");
  	  if (DECL_CONSTRUCTOR_P (t))
! 	    dump_string_field (di, "note", "constructor");
  	  if (DECL_DESTRUCTOR_P (t))
! 	    dump_string_field (di, "note", "destructor");
  	  if (DECL_CONV_FN_P (t))
! 	    dump_string_field (di, "note", "conversion");
  	  if (DECL_GLOBAL_CTOR_P (t))
! 	    dump_string_field (di, "note", "global init");
  	  if (DECL_GLOBAL_DTOR_P (t))
! 	    dump_string_field (di, "note", "global fini");
  	  if (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t))
! 	    dump_string_field (di, "note", "pseudo tmpl");
  	}
        else
  	{
  	  tree virt = THUNK_VIRTUAL_OFFSET (t);
  
! 	  dump_string_field (di, "note", "thunk");
  	  if (DECL_THIS_THUNK_P (t))
! 	    dump_string_field (di, "note", "this adjusting");
  	  else
  	    {
! 	      dump_string_field (di, "note", "result adjusting");
  	      if (virt)
  		virt = BINFO_VPTR_FIELD (virt);
  	    }
*************** cp_dump_tree (void* dump_info, tree t)
*** 366,372 ****
      case TRY_BLOCK:
        dump_stmt (di, t);
        if (CLEANUP_P (t))
! 	dump_string (di, "cleanup");
        dump_child ("body", TRY_STMTS (t));
        dump_child ("hdlr", TRY_HANDLERS (t));
        break;
--- 366,372 ----
      case TRY_BLOCK:
        dump_stmt (di, t);
        if (CLEANUP_P (t))
! 	dump_string_field (di, "note", "cleanup");
        dump_child ("body", TRY_STMTS (t));
        dump_child ("hdlr", TRY_HANDLERS (t));
        break;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]