OSDN Git Service

fix
[pf3gnuchains/gcc-fork.git] / gcc / cp / dump.c
index fa55833..f765c32 100644 (file)
@@ -2,20 +2,20 @@
    Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    Written by Mark Mitchell <mark@codesourcery.com>
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC is free software; you can redistribute it and/or modify
+GCC is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2, or (at your option)
 any later version.
 
-GNU CC is distributed in the hope that it will be useful,
+GCC is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
+along with GCC; see the file COPYING.  If not, write to
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
@@ -27,19 +27,15 @@ Boston, MA 02111-1307, USA.  */
 #include "cp-tree.h"
 #include "tree-dump.h"
 
-static void dump_access
-  PARAMS ((dump_info_p, tree));
+static void dump_access (dump_info_p, tree);
 
-static void dump_op
-  PARAMS ((dump_info_p, tree));
+static void dump_op (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;
+dump_access (dump_info_p di, tree t)
 {
   if (TREE_PROTECTED(t))
     dump_string (di, "protected");
@@ -53,9 +49,7 @@ dump_access (di, t)
    operator associated with node t.  */
 
 static void
-dump_op (di, t)
-     dump_info_p di;
-     tree t;
+dump_op (dump_info_p di, tree t)
 {
   switch (DECL_OVERLOADED_OPERATOR_P (t)) {
     case NEW_EXPR:
@@ -208,10 +202,8 @@ dump_op (di, t)
   }
 }
 
-int
-cp_dump_tree (dump_info, t)
-     void *dump_info;
-     tree t;
+bool
+cp_dump_tree (void* dump_info, tree t)
 {
   enum tree_code code;
   dump_info_p di = (dump_info_p) dump_info;
@@ -222,7 +214,7 @@ cp_dump_tree (dump_info, t)
   if (DECL_P (t))
     {
       if (DECL_LANG_SPECIFIC (t) && DECL_LANGUAGE (t) != lang_cplusplus)
-       dump_string (di, language_to_string (DECL_LANGUAGE (t), 0));
+       dump_string (di, language_to_string (DECL_LANGUAGE (t)));
     }
 
   switch (code)
@@ -231,39 +223,42 @@ cp_dump_tree (dump_info, t)
       if (IDENTIFIER_OPNAME_P (t))
        {
          dump_string (di, "operator");
-         return 1;
+         return true;
        }
       else if (IDENTIFIER_TYPENAME_P (t))
        {
          dump_child ("tynm", TREE_TYPE (t));
-         return 1;
-       }
-      else if (t == anonymous_namespace_name)
-       {
-         dump_string (di, "unnamed");
-         return 1;
+         return true;
        }
       break;
 
-    case POINTER_TYPE:
-      if (TYPE_PTRMEM_P (t))
+    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;
+
+    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 1;
+         return true;
        }
-      break;
+      /* Fall through.  */
 
-    case RECORD_TYPE:
     case UNION_TYPE:
-      if (TYPE_PTRMEMFUNC_P (t))
+      /* Is it a type used as a base? */
+      if (TYPE_CONTEXT (t) && TREE_CODE (TYPE_CONTEXT (t)) == TREE_CODE (t)
+         && CLASSTYPE_AS_BASE (TYPE_CONTEXT (t)) == t)
        {
-         dump_string (di, "ptrmem");
-         dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
-         dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
-         return 1;
+         dump_child ("bfld", TYPE_CONTEXT (t));
+         return true;
        }
+      
+      if (! IS_AGGR_TYPE (t))
+       break;
 
       dump_child ("vfld", TYPE_VFIELD (t));
       if (CLASSTYPE_TEMPLATE_SPECIALIZATION(t))
@@ -328,13 +323,20 @@ cp_dump_tree (dump_info, t)
        }
       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");
+           {
+             dump_string (di, "result adjusting");
+             if (virt)
+               virt = BINFO_VPTR_FIELD (virt);
+           }
          dump_int (di, "fixd", THUNK_FIXED_OFFSET (t));
-         dump_child ("virt", THUNK_VIRTUAL_OFFSET (t));
+         if (virt)
+           dump_int (di, "virt", tree_low_cst (virt, 0));
          dump_child ("fn", DECL_INITIAL (t));
        }
       break;
@@ -364,14 +366,12 @@ cp_dump_tree (dump_info, t)
        dump_string (di, "cleanup");
       dump_child ("body", TRY_STMTS (t));
       dump_child ("hdlr", TRY_HANDLERS (t));
-      dump_next_stmt (di, t);
       break;
 
     case EH_SPEC_BLOCK:
       dump_stmt (di, t);
       dump_child ("body", EH_SPEC_STMTS (t));
       dump_child ("raises", EH_SPEC_RAISES (t));
-      dump_next_stmt (di, t);
       break;
 
     case PTRMEM_CST:
@@ -395,21 +395,32 @@ cp_dump_tree (dump_info, t)
       dump_stmt (di, t);
       dump_child ("parm", HANDLER_PARMS (t));
       dump_child ("body", HANDLER_BODY (t));
-      dump_next_stmt (di, t);
       break;
 
     case MUST_NOT_THROW_EXPR:
       dump_stmt (di, t);
       dump_child ("body", TREE_OPERAND (t, 0));
-      dump_next_stmt (di, t);
       break;
 
     case USING_STMT:
       dump_stmt (di, t);
       dump_child ("nmsp", USING_STMT_NAMESPACE (t));
-      dump_next_stmt (di, t);
       break;
-      
+
+    case CLEANUP_STMT:
+      dump_stmt (di, t);
+      dump_child ("decl", CLEANUP_DECL (t));
+      dump_child ("expr", CLEANUP_EXPR (t));
+      dump_child ("body", CLEANUP_BODY (t));
+      break;
+
+    case IF_STMT:
+      dump_stmt (di, t);
+      dump_child ("cond", IF_COND (t));
+      dump_child ("then", THEN_CLAUSE (t));
+      dump_child ("else", ELSE_CLAUSE (t));
+      break;
+
     default:
       break;
     }