00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "config.h"
00025 #include "system.h"
00026 #include "tree.h"
00027 #include "cp-tree.h"
00028
00029 void
00030 cxx_print_decl (file, node, indent)
00031 FILE *file;
00032 tree node;
00033 int indent;
00034 {
00035 if (TREE_CODE (node) == FIELD_DECL)
00036 {
00037 if (DECL_MUTABLE_P (node))
00038 {
00039 indent_to (file, indent + 3);
00040 fprintf (file, " mutable ");
00041 }
00042 return;
00043 }
00044
00045 if (!DECL_LANG_SPECIFIC (node))
00046 return;
00047 indent_to (file, indent + 3);
00048 if (TREE_CODE (node) == FUNCTION_DECL
00049 && DECL_PENDING_INLINE_INFO (node))
00050 {
00051 fprintf (file, " pending-inline-info ");
00052 fprintf (file, HOST_PTR_PRINTF, DECL_PENDING_INLINE_INFO (node));
00053 }
00054 if (TREE_CODE (node) == TYPE_DECL
00055 && DECL_SORTED_FIELDS (node))
00056 {
00057 fprintf (file, " sorted-fields ");
00058 fprintf (file, HOST_PTR_PRINTF, DECL_SORTED_FIELDS (node));
00059 }
00060 if ((TREE_CODE (node) == FUNCTION_DECL || TREE_CODE (node) == VAR_DECL)
00061 && DECL_TEMPLATE_INFO (node))
00062 {
00063 fprintf (file, " template-info ");
00064 fprintf (file, HOST_PTR_PRINTF, DECL_TEMPLATE_INFO (node));
00065 }
00066 }
00067
00068 void
00069 cxx_print_type (file, node, indent)
00070 FILE *file;
00071 register tree node;
00072 int indent;
00073 {
00074 switch (TREE_CODE (node))
00075 {
00076 case TEMPLATE_TYPE_PARM:
00077 case TEMPLATE_TEMPLATE_PARM:
00078 case BOUND_TEMPLATE_TEMPLATE_PARM:
00079 indent_to (file, indent + 3);
00080 fputs ("index ", file);
00081 fprintf (file, HOST_WIDE_INT_PRINT_DEC, TEMPLATE_TYPE_IDX (node));
00082 fputs (" level ", file);
00083 fprintf (file, HOST_WIDE_INT_PRINT_DEC, TEMPLATE_TYPE_LEVEL (node));
00084 fputs (" orig_level ", file);
00085 fprintf (file, HOST_WIDE_INT_PRINT_DEC, TEMPLATE_TYPE_ORIG_LEVEL (node));
00086 return;
00087
00088 case FUNCTION_TYPE:
00089 case METHOD_TYPE:
00090 if (TYPE_RAISES_EXCEPTIONS (node))
00091 print_node (file, "throws", TYPE_RAISES_EXCEPTIONS (node), indent + 4);
00092 return;
00093
00094 case RECORD_TYPE:
00095 case UNION_TYPE:
00096 break;
00097
00098 default:
00099 return;
00100 }
00101
00102 if (TYPE_PTRMEMFUNC_P (node))
00103 print_node (file, "ptrmemfunc fn type", TYPE_PTRMEMFUNC_FN_TYPE (node),
00104 indent + 4);
00105
00106 if (! CLASS_TYPE_P (node))
00107 return;
00108
00109 indent_to (file, indent + 3);
00110
00111 if (TYPE_NEEDS_CONSTRUCTING (node))
00112 fputs ( "needs-constructor", file);
00113 if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (node))
00114 fputs (" needs-destructor", file);
00115 if (TYPE_HAS_DESTRUCTOR (node))
00116 fputs (" ~X()", file);
00117 if (TYPE_HAS_DEFAULT_CONSTRUCTOR (node))
00118 fputs (" X()", file);
00119 if (TYPE_HAS_CONVERSION (node))
00120 fputs (" has-type-conversion", file);
00121 if (TYPE_HAS_INIT_REF (node))
00122 {
00123 if (TYPE_HAS_CONST_INIT_REF (node))
00124 fputs (" X(constX&)", file);
00125 else
00126 fputs (" X(X&)", file);
00127 }
00128 if (TYPE_HAS_NEW_OPERATOR (node))
00129 fputs (" new", file);
00130 if (TYPE_HAS_ARRAY_NEW_OPERATOR (node))
00131 fputs (" new[]", file);
00132 if (TYPE_GETS_DELETE (node) & 1)
00133 fputs (" delete", file);
00134 if (TYPE_GETS_DELETE (node) & 2)
00135 fputs (" delete[]", file);
00136 if (TYPE_HAS_ASSIGN_REF (node))
00137 fputs (" this=(X&)", file);
00138 if (TYPE_OVERLOADS_CALL_EXPR (node))
00139 fputs (" op()", file);
00140 if (TYPE_OVERLOADS_ARRAY_REF (node))
00141 fputs (" op[]", file);
00142 if (TYPE_OVERLOADS_ARROW (node))
00143 fputs (" op->", file);
00144 if (TYPE_USES_MULTIPLE_INHERITANCE (node))
00145 fputs (" uses-multiple-inheritance", file);
00146
00147 if (TREE_CODE (node) == RECORD_TYPE)
00148 {
00149 fprintf (file, " n_parents %d", CLASSTYPE_N_BASECLASSES (node));
00150 fprintf (file, " use_template=%d", CLASSTYPE_USE_TEMPLATE (node));
00151 if (CLASSTYPE_INTERFACE_ONLY (node))
00152 fprintf (file, " interface-only");
00153 if (CLASSTYPE_INTERFACE_UNKNOWN (node))
00154 fprintf (file, " interface-unknown");
00155 print_node (file, "member-functions", CLASSTYPE_METHOD_VEC (node),
00156 indent + 4);
00157 }
00158 }
00159
00160 static void
00161 cxx_print_binding (FILE *stream, cxx_binding *binding, const char *prefix)
00162 {
00163 fprintf (stream, "%s <", prefix);
00164 fprintf (stream, HOST_PTR_PRINTF, (char *) binding);
00165 fprintf (stream, ">");
00166 }
00167
00168 void
00169 cxx_print_identifier (file, node, indent)
00170 FILE *file;
00171 tree node;
00172 int indent;
00173 {
00174 cxx_print_binding (file, IDENTIFIER_NAMESPACE_BINDINGS (node), "bindings");
00175 print_node (file, "class", IDENTIFIER_CLASS_VALUE (node), indent + 4);
00176 cxx_print_binding (file, IDENTIFIER_BINDING (node), "local bindings");
00177 print_node (file, "label", IDENTIFIER_LABEL_VALUE (node), indent + 4);
00178 print_node (file, "template", IDENTIFIER_TEMPLATE (node), indent + 4);
00179 print_node (file, "implicit", IDENTIFIER_IMPLICIT_DECL (node), indent + 4);
00180 print_node (file, "error locus", IDENTIFIER_ERROR_LOCUS (node), indent + 4);
00181 }
00182
00183 void
00184 cxx_print_xnode (file, node, indent)
00185 FILE *file;
00186 tree node;
00187 int indent;
00188 {
00189 switch (TREE_CODE (node))
00190 {
00191 case OVERLOAD:
00192 print_node (file, "function", OVL_FUNCTION (node), indent+4);
00193 print_node (file, "chain", TREE_CHAIN (node), indent+4);
00194 break;
00195 case TEMPLATE_PARM_INDEX:
00196 indent_to (file, indent + 3);
00197 fputs ("index ", file);
00198 fprintf (file, HOST_WIDE_INT_PRINT_DEC, TEMPLATE_PARM_IDX (node));
00199 fputs (" level ", file);
00200 fprintf (file, HOST_WIDE_INT_PRINT_DEC, TEMPLATE_PARM_LEVEL (node));
00201 fputs (" orig_level ", file);
00202 fprintf (file, HOST_WIDE_INT_PRINT_DEC, TEMPLATE_PARM_ORIG_LEVEL (node));
00203 break;
00204 default:
00205 break;
00206 }
00207 }