1 /* Prints out tree in human readable form - GNU C++ compiler
2 Copyright (C) 1987 Free Software Foundation, Inc.
3 Hacked by Michael Tiemann (tiemann@mcc.com)
5 This file is part of GNU CC.
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 1, or (at your option)
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.
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. */
24 #include "cplus-tree.h"
28 extern char *tree_code_err_name
[];
29 extern char *tree_code_err_asg_name
[];
30 extern char *mode_name
[];
34 #define MIN(x,y) ((x < y) ? x : y)
38 /* This code is copied from print-tree.c. */
46 fputs ("<>", outfile
);
48 fprintf (outfile
, "%1d", TREE_UID (node
));
58 fprintf (outfile
, " %s = ", title
);
63 /* Similar to `part' but prefix with @ if value is not constant
64 and print the constant value if it is constant. */
67 cpart (title
, ct
, punct
)
72 fprintf (outfile
, " %s = ", title
);
74 fputs ("<>", outfile
);
77 if (!TREE_LITERAL (ct
))
83 fprintf (outfile
, "%ld", TREE_INT_CST_LOW (ct
));
85 putc (punct
, outfile
);
89 print_lang_decl (node
)
94 void walk_lang_decl (node
)
100 print_lang_type (node
)
104 if (! (TREE_CODE (node
) == RECORD_TYPE
105 || TREE_CODE (node
) == UNION_TYPE
))
108 fputs (" [", outfile
);
109 if (TYPE_NEEDS_CONSTRUCTOR (node
))
111 if (!first
) putc (' ', outfile
);
112 fputs ("needs-constructor", outfile
);
115 if (TYPE_NEEDS_DESTRUCTOR (node
))
117 if (!first
) putc (' ', outfile
);
118 fputs ("needs-destructor", outfile
);
121 if (TYPE_HAS_CONVERSION (node
))
123 if (!first
) putc (' ', outfile
);
124 fputs ("has-type-conversion", outfile
);
127 if (TYPE_HAS_INT_CONVERSION (node
))
129 if (!first
) putc (' ', outfile
);
130 fputs ("has-int-conversion", outfile
);
133 if (TYPE_HAS_REAL_CONVERSION (node
))
135 if (!first
) putc (' ', outfile
);
136 fputs ("has-float-conversion", outfile
);
139 if (TYPE_HAS_INIT_REF (node
))
141 if (!first
) putc (' ', outfile
);
142 fputs ("X(X&)", outfile
);
145 if (TREE_GETS_NEW (node
))
147 if (!first
) putc (' ', outfile
);
148 fputs ("gets-new", outfile
);
151 if (TREE_GETS_DELETE (node
))
153 if (!first
) putc (' ', outfile
);
154 fputs ("gets-delete", outfile
);
157 if (TYPE_HAS_ASSIGNMENT (node
))
159 if (!first
) putc (' ', outfile
);
160 fputs ("has=", outfile
);
163 if (TYPE_GETS_ASSIGNMENT (node
))
165 if (!first
) putc (' ', outfile
);
166 fputs ("gets=", outfile
);
169 if (TYPE_HAS_ASSIGN_REF (node
))
171 if (!first
) putc (' ', outfile
);
172 fputs ("this=(X&)", outfile
);
175 if (TYPE_GETS_ASSIGN_REF (node
))
177 if (!first
) putc (' ', outfile
);
178 fputs ("gets=(X&)", outfile
);
181 if (TYPE_HAS_WRAPPER (node
))
183 if (!first
) putc (' ', outfile
);
184 fputs ("wrapper", outfile
);
187 if (TYPE_OVERLOADS_METHOD_CALL_EXPR (node
))
189 if (!first
) putc (' ', outfile
);
190 fputs ("op->()", outfile
);
193 if (TYPE_GETS_INIT_AGGR (node
))
195 if (!first
) putc (' ', outfile
);
196 fputs ("gets X(X, ...)", outfile
);
199 if (TYPE_OVERLOADS_CALL_EXPR (node
))
201 if (!first
) putc (' ', outfile
);
202 fputs ("op()", outfile
);
205 if (TYPE_OVERLOADS_ARRAY_REF (node
))
207 if (!first
) putc (' ', outfile
);
208 fputs ("op[]", outfile
);
211 if (TYPE_USES_MULTIPLE_INHERITANCE (node
))
213 if (!first
) putc (' ', outfile
);
214 fputs ("uses-multiple-inheritance", outfile
);
218 fputs ("] ", outfile
);
222 walk_lang_type (node
)
225 if (! (TREE_CODE (node
) == RECORD_TYPE
))
228 part ("member functions", CLASSTYPE_METHOD_VEC (node
));
229 part ("baselinks", CLASSTYPE_BASELINK_VEC (node
));
230 cpart ("offset", CLASSTYPE_OFFSET (node
), ';');
231 fprintf (outfile
, "n_parents = %d; n_ancestors = %d;",
232 CLASSTYPE_N_BASECLASSES (node
),
233 CLASSTYPE_N_SUPERCLASSES (node
));