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]

C++ Dumping Patch



I've committed the attached patch, which is mostly Mike's work, with a
few formatting fixes from me.  

I put this patch on the branch because it can't hurt (it's only in
debugging code) and because Bjarne asked me to.  AT&T is using the
debugging dumps in a tool they're building.

Tested (by building cc1plus) on i686-pc-linux-gnu.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2001-03-26  Mike Yang <yang@research.att.com>
	    Mark Mitchell  <mark@codesourcery.com>

	* dump.c (dump_access): New function.
	(cp_dump_tree): Use it.  Dump basetype information for class
	types.

Index: dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/dump.c,v
retrieving revision 1.52
diff -c -p -r1.52 dump.c
*** dump.c	2000/11/10 04:50:53	1.52
--- dump.c	2001/03/27 04:50:12
***************
*** 1,5 ****
  /* Tree-dumping functionality for intermediate representation.
!    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
     Written by Mark Mitchell <mark@codesourcery.com>
  
  This file is part of GNU CC.
--- 1,5 ----
  /* Tree-dumping functionality for intermediate representation.
!    Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
     Written by Mark Mitchell <mark@codesourcery.com>
  
  This file is part of GNU CC.
*************** Boston, MA 02111-1307, USA.  */
*** 25,30 ****
--- 25,49 ----
  #include "cp-tree.h"
  #include "c-dump.h"
  
+ static void dump_access
+   PARAMS ((dump_info_p, tree));
+ 
+ /* Dump a representation of the accessibility information associated
+    with T.  */
+ 
+ static void
+ dump_access (di, t)
+      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");
+ }
+ 
  int
  cp_dump_tree (di, t)
       dump_info_p di;
*************** cp_dump_tree (di, t)
*** 82,94 ****
  	}
  
        dump_child ("vfld", TYPE_VFIELD (t));
        break;
  
      case FUNCTION_DECL:
        if (!DECL_THUNK_P (t))
  	{
! 	  if (DECL_FUNCTION_MEMBER_P (t))
! 	    dump_string (di, "member");
  	  if (DECL_CONSTRUCTOR_P (t))
  	    dump_string (di, "constructor");
  	  if (DECL_DESTRUCTOR_P (t))
--- 101,133 ----
  	}
  
        dump_child ("vfld", TYPE_VFIELD (t));
+ 	
+       {
+ 	int i;
+ 
+ 	for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); ++i)
+ 	  {
+ 	    tree base_binfo = BINFO_BASETYPE (TYPE_BINFO (t), i);
+ 	    dump_child ("base", BINFO_TYPE (base_binfo));
+ 	    if (TREE_VIA_VIRTUAL (base_binfo)) 
+ 	      dump_string (di, "virtual");
+ 	    dump_access (di, base_binfo);
+ 	  }
+       }
+       break;
+ 
+     case FIELD_DECL:
+       dump_access (di, t);
        break;
  
      case FUNCTION_DECL:
        if (!DECL_THUNK_P (t))
  	{
! 	  if (DECL_FUNCTION_MEMBER_P (t)) 
! 	    {
! 	      dump_string (di, "member");
! 	      dump_access (di, t);
! 	    }
  	  if (DECL_CONSTRUCTOR_P (t))
  	    dump_string (di, "constructor");
  	  if (DECL_DESTRUCTOR_P (t))
*************** cp_dump_tree (di, t)
*** 132,137 ****
--- 171,177 ----
        dump_child ("rslt", DECL_TEMPLATE_RESULT (t));
        dump_child ("inst", DECL_TEMPLATE_INSTANTIATIONS (t));
        dump_child ("spcs", DECL_TEMPLATE_SPECIALIZATIONS (t));
+       dump_child ("prms", DECL_TEMPLATE_PARMS (t));
        break;
  
      case OVERLOAD:


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