home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / NeXT / GnuSource / cc-61.0.1 / cc / cplus-ptree.c < prev    next >
C/C++ Source or Header  |  1991-06-03  |  4KB  |  127 lines

  1. /* Prints out tree in human readable form - GNU C++ compiler
  2.    Copyright (C) 1990 Free Software Foundation, Inc.
  3.    Hacked by Michael Tiemann (tiemann@cygnus.com)
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21.  
  22. #include "config.h"
  23. #include "tree.h"
  24. #include "cplus-tree.h"
  25. #include <stdio.h>
  26.  
  27. void
  28. print_lang_decl (file, node, indent)
  29.      FILE *file;
  30.      tree node;
  31.      int indent;
  32. {
  33.   if (TREE_CODE (node) == TEMPLATE_DECL)
  34.     {
  35.       indent_to (file, indent + 3);
  36.       fprintf (file, " template-info %x", DECL_LANG_SPECIFIC (node));
  37.       return;
  38.     }
  39.   if (!DECL_LANG_SPECIFIC (node))
  40.     return;
  41.   indent_to (file, indent + 3);
  42.   if (DECL_ORIGINAL_NAME (node))
  43.     fprintf (file, " original-name %x", DECL_ORIGINAL_NAME (node));
  44.   if (DECL_MAIN_VARIANT (node))
  45.     fprintf (file, " decl-main-variant %x", DECL_MAIN_VARIANT (node));
  46.   if (DECL_PENDING_INLINE_INFO (node))
  47.     fprintf (file, " pending-inline-info %x", DECL_PENDING_INLINE_INFO (node));
  48. }
  49.  
  50. void
  51. print_lang_type (file, node, indent)
  52.      FILE *file;
  53.      register tree node;
  54.      int indent;
  55. {
  56.   if (! (TREE_CODE (node) == RECORD_TYPE
  57.      || TREE_CODE (node) == UNION_TYPE))
  58.     return;
  59.  
  60.   indent_to (file, indent + 3);
  61.  
  62.   if (TYPE_NEEDS_CONSTRUCTOR (node))
  63.     fputs ( "needs-constructor", file);
  64.   if (TYPE_NEEDS_DESTRUCTOR (node))
  65.     fputs (" needs-destructor", file);
  66.   if (TYPE_HAS_CONVERSION (node))
  67.     fputs (" has-type-conversion", file);
  68.   if (TYPE_HAS_INT_CONVERSION (node))
  69.     fputs (" has-int-conversion", file);
  70.   if (TYPE_HAS_REAL_CONVERSION (node))
  71.     fputs (" has-float-conversion", file);
  72.   if (TYPE_HAS_INIT_REF (node))
  73.     fputs (" X(X&)", file);
  74.   if (TREE_GETS_NEW (node))
  75.     fputs (" gets-new", file);
  76.   if (TREE_GETS_DELETE (node))
  77.     fputs (" gets-delete", file);
  78.   if (TYPE_HAS_ASSIGNMENT (node))
  79.     fputs (" has=", file);
  80.   if (TYPE_GETS_ASSIGNMENT (node))
  81.     fputs (" gets=", file);
  82.   if (TYPE_HAS_ASSIGN_REF (node))
  83.     fputs (" this=(X&)", file);
  84.   if (TYPE_GETS_ASSIGN_REF (node))
  85.     fputs (" gets=(X&)", file);
  86.   if (TYPE_HAS_WRAPPER (node))
  87.     fputs (" wrapper", file);
  88.   if (TYPE_OVERLOADS_METHOD_CALL_EXPR (node))
  89.     fputs (" op->()", file);
  90.   if (TYPE_GETS_INIT_AGGR (node))
  91.     fputs (" gets X(X, ...)", file);
  92.   if (TYPE_OVERLOADS_CALL_EXPR (node))
  93.     fputs (" op()", file);
  94.   if (TYPE_OVERLOADS_ARRAY_REF (node))
  95.     fputs (" op[]", file);
  96.   if (TYPE_USES_MULTIPLE_INHERITANCE (node))
  97.     fputs (" uses-multiple-inheritance", file);
  98.  
  99.   if (TREE_CODE (node) == RECORD_TYPE)
  100.     {
  101.       fprintf (file, " n_parents %d n_ancestors %d",
  102.            CLASSTYPE_N_BASECLASSES (node),
  103.            CLASSTYPE_N_SUPERCLASSES (node));
  104.       print_node (file, "member-functions", CLASSTYPE_METHOD_VEC (node),
  105.           indent + 4);
  106.       print_node (file, "baselinks",
  107.           TYPE_BASETYPES (node) ? CLASSTYPE_BASELINK_VEC (node) : NULL_TREE,
  108.           indent + 4);
  109.       print_node (file, "offset", CLASSTYPE_OFFSET (node), indent + 4);
  110.     }
  111. }
  112.  
  113. void
  114. print_lang_identifier (file, node, indent)
  115.      FILE *file;
  116.      tree node;
  117.      int indent;
  118. {
  119.   print_node (file, "global", IDENTIFIER_GLOBAL_VALUE (node), indent + 4);
  120.   print_node (file, "class", IDENTIFIER_CLASS_VALUE (node), indent + 4);
  121.   print_node (file, "local", IDENTIFIER_LOCAL_VALUE (node), indent + 4);
  122.   print_node (file, "label", IDENTIFIER_LABEL_VALUE (node), indent + 4);
  123.   print_node (file, "template", IDENTIFIER_TEMPLATE (node), indent + 4);
  124.   print_node (file, "implicit", IDENTIFIER_IMPLICIT_DECL (node), indent + 4);
  125.   print_node (file, "error locus", IDENTIFIER_ERROR_LOCUS (node), indent + 4);
  126. }
  127.