503c22e21f07132f2d168b274b4022735e55d090
[deliverable/binutils-gdb.git] / gdb / c-typeprint.c
1 /* Support for printing C and C++ types for GDB, the GNU debugger.
2 Copyright 1986, 1988, 1989, 1991 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 #include "defs.h"
21 #include "obstack.h"
22 #include "bfd.h" /* Binary File Description */
23 #include "symtab.h"
24 #include "gdbtypes.h"
25 #include "expression.h"
26 #include "value.h"
27 #include "gdbcore.h"
28 #include "target.h"
29 #include "command.h"
30 #include "gdbcmd.h"
31 #include "language.h"
32 #include "demangle.h"
33 #include "c-lang.h"
34 #include "typeprint.h"
35
36 #include <string.h>
37 #include <errno.h>
38
39 extern int demangle; /* whether to print C++ syms raw or source-form */
40
41 static void
42 c_type_print_args PARAMS ((struct type *, FILE *));
43
44 static void
45 c_type_print_varspec_suffix PARAMS ((struct type *, FILE *, int, int, int));
46
47 static void
48 cp_type_print_derivation_info PARAMS ((FILE *, struct type *));
49
50 void
51 c_type_print_varspec_prefix PARAMS ((struct type *, FILE *, int, int));
52
53 void
54 c_type_print_base PARAMS ((struct type *, FILE *, int, int));
55
56 \f
57 /* Print a description of a type in the format of a
58 typedef for the current language.
59 NEW is the new name for a type TYPE. */
60
61 void
62 c_typedef_print (type, new, stream)
63 struct type *type;
64 struct symbol *new;
65 FILE *stream;
66 {
67 switch (current_language->la_language)
68 {
69 #ifdef _LANG_c
70 case language_c:
71 case language_cplus:
72 fprintf_filtered(stream, "typedef ");
73 type_print(type,"",stream,0);
74 if(TYPE_NAME ((SYMBOL_TYPE (new))) == 0
75 || 0 != strcmp (TYPE_NAME ((SYMBOL_TYPE (new))),
76 SYMBOL_NAME (new)))
77 fprintf_filtered(stream, " %s", SYMBOL_NAME(new));
78 break;
79 #endif
80 #ifdef _LANG_m2
81 case language_m2:
82 fprintf_filtered(stream, "TYPE ");
83 if(!TYPE_NAME(SYMBOL_TYPE(new)) ||
84 strcmp (TYPE_NAME(SYMBOL_TYPE(new)),
85 SYMBOL_NAME(new)))
86 fprintf_filtered(stream, "%s = ", SYMBOL_NAME(new));
87 else
88 fprintf_filtered(stream, "<builtin> = ");
89 type_print(type,"",stream,0);
90 break;
91 #endif
92 /* start-sanitize-chill */
93 #ifdef _LANG_chill
94 case language_chill:
95 error ("Missing Chill support in function c_typedef_print."); /*FIXME*/
96 #endif
97 /* end-sanitize-chill */
98 default:
99 error("Language not supported.");
100 }
101 fprintf_filtered(stream, ";\n");
102 }
103
104
105 /* LEVEL is the depth to indent lines by. */
106
107 void
108 c_print_type (type, varstring, stream, show, level)
109 struct type *type;
110 char *varstring;
111 FILE *stream;
112 int show;
113 int level;
114 {
115 register enum type_code code;
116 char *demangled = NULL;
117 int demangled_args;
118
119 c_type_print_base (type, stream, show, level);
120 code = TYPE_CODE (type);
121 if ((varstring != NULL && *varstring != '\0')
122 ||
123 /* Need a space if going to print stars or brackets;
124 but not if we will print just a type name. */
125 ((show > 0 || TYPE_NAME (type) == 0)
126 &&
127 (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC
128 || code == TYPE_CODE_METHOD
129 || code == TYPE_CODE_ARRAY
130 || code == TYPE_CODE_MEMBER
131 || code == TYPE_CODE_REF)))
132 fputs_filtered (" ", stream);
133 c_type_print_varspec_prefix (type, stream, show, 0);
134
135 /* See if the name has a C++ demangled equivalent, and if so, print that
136 instead. */
137
138 if (demangle)
139 {
140 demangled = cplus_demangle (varstring, DMGL_ANSI | DMGL_PARAMS);
141 }
142 fputs_filtered ((demangled != NULL) ? demangled : varstring, stream);
143
144 /* For demangled function names, we have the arglist as part of the name,
145 so don't print an additional pair of ()'s */
146
147 demangled_args = (demangled != NULL) && (code == TYPE_CODE_FUNC);
148 c_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
149
150 if (demangled != NULL)
151 {
152 free (demangled);
153 }
154 }
155
156 /* Print the C++ method arguments ARGS to the file STREAM. */
157
158 void
159 cp_type_print_method_args (args, prefix, varstring, staticp, stream)
160 struct type **args;
161 char *prefix;
162 char *varstring;
163 int staticp;
164 FILE *stream;
165 {
166 int i;
167
168 fputs_demangled (prefix, stream, DMGL_ANSI | DMGL_PARAMS);
169 fputs_demangled (varstring, stream, DMGL_ANSI | DMGL_PARAMS);
170 fputs_filtered (" (", stream);
171 if (args && args[!staticp] && args[!staticp]->code != TYPE_CODE_VOID)
172 {
173 i = !staticp; /* skip the class variable */
174 while (1)
175 {
176 type_print (args[i++], "", stream, 0);
177 if (!args[i])
178 {
179 fprintf_filtered (stream, " ...");
180 break;
181 }
182 else if (args[i]->code != TYPE_CODE_VOID)
183 {
184 fprintf_filtered (stream, ", ");
185 }
186 else break;
187 }
188 }
189 fprintf_filtered (stream, ")");
190 }
191
192 /* If TYPE is a derived type, then print out derivation information.
193 Print only the actual base classes of this type, not the base classes
194 of the base classes. I.E. for the derivation hierarchy:
195
196 class A { int a; };
197 class B : public A {int b; };
198 class C : public B {int c; };
199
200 Print the type of class C as:
201
202 class C : public B {
203 int c;
204 }
205
206 Not as the following (like gdb used to), which is not legal C++ syntax for
207 derived types and may be confused with the multiple inheritance form:
208
209 class C : public B : public A {
210 int c;
211 }
212
213 In general, gdb should try to print the types as closely as possible to
214 the form that they appear in the source code. */
215
216 static void
217 cp_type_print_derivation_info (stream, type)
218 FILE *stream;
219 struct type *type;
220 {
221 char *name;
222 int i;
223
224 for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
225 {
226 fputs_filtered (i == 0 ? ": " : ", ", stream);
227 fprintf_filtered (stream, "%s%s ",
228 BASETYPE_VIA_PUBLIC (type, i) ? "public" : "private",
229 BASETYPE_VIA_VIRTUAL(type, i) ? " virtual" : "");
230 name = type_name_no_tag (TYPE_BASECLASS (type, i));
231 fprintf_filtered (stream, "%s", name ? name : "(null)");
232 }
233 if (i > 0)
234 {
235 fputs_filtered (" ", stream);
236 }
237 }
238
239 /* Print any asterisks or open-parentheses needed before the
240 variable name (to describe its type).
241
242 On outermost call, pass 0 for PASSED_A_PTR.
243 On outermost call, SHOW > 0 means should ignore
244 any typename for TYPE and show its details.
245 SHOW is always zero on recursive calls. */
246
247 void
248 c_type_print_varspec_prefix (type, stream, show, passed_a_ptr)
249 struct type *type;
250 FILE *stream;
251 int show;
252 int passed_a_ptr;
253 {
254 char *name;
255 if (type == 0)
256 return;
257
258 if (TYPE_NAME (type) && show <= 0)
259 return;
260
261 QUIT;
262
263 switch (TYPE_CODE (type))
264 {
265 case TYPE_CODE_PTR:
266 c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
267 fprintf_filtered (stream, "*");
268 break;
269
270 case TYPE_CODE_MEMBER:
271 if (passed_a_ptr)
272 fprintf_filtered (stream, "(");
273 c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
274 fprintf_filtered (stream, " ");
275 name = type_name_no_tag (TYPE_DOMAIN_TYPE (type));
276 if (name)
277 fputs_filtered (name, stream);
278 else
279 c_type_print_base (TYPE_DOMAIN_TYPE (type), stream, 0, passed_a_ptr);
280 fprintf_filtered (stream, "::");
281 break;
282
283 case TYPE_CODE_METHOD:
284 if (passed_a_ptr)
285 fprintf (stream, "(");
286 c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
287 if (passed_a_ptr)
288 {
289 fprintf_filtered (stream, " ");
290 c_type_print_base (TYPE_DOMAIN_TYPE (type), stream, 0, passed_a_ptr);
291 fprintf_filtered (stream, "::");
292 }
293 break;
294
295 case TYPE_CODE_REF:
296 c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
297 fprintf_filtered (stream, "&");
298 break;
299
300 case TYPE_CODE_FUNC:
301 c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
302 if (passed_a_ptr)
303 fprintf_filtered (stream, "(");
304 break;
305
306 case TYPE_CODE_ARRAY:
307 c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
308 if (passed_a_ptr)
309 fprintf_filtered (stream, "(");
310 break;
311
312 case TYPE_CODE_UNDEF:
313 case TYPE_CODE_STRUCT:
314 case TYPE_CODE_UNION:
315 case TYPE_CODE_ENUM:
316 case TYPE_CODE_INT:
317 case TYPE_CODE_FLT:
318 case TYPE_CODE_VOID:
319 case TYPE_CODE_ERROR:
320 case TYPE_CODE_CHAR:
321 case TYPE_CODE_BOOL:
322 case TYPE_CODE_SET:
323 case TYPE_CODE_RANGE:
324 case TYPE_CODE_PASCAL_ARRAY:
325 /* These types need no prefix. They are listed here so that
326 gcc -Wall will reveal any types that haven't been handled. */
327 break;
328 }
329 }
330
331 static void
332 c_type_print_args (type, stream)
333 struct type *type;
334 FILE *stream;
335 {
336 int i;
337 struct type **args;
338
339 fprintf_filtered (stream, "(");
340 args = TYPE_ARG_TYPES (type);
341 if (args != NULL)
342 {
343 if (args[1] == NULL)
344 {
345 fprintf_filtered (stream, "...");
346 }
347 else
348 {
349 for (i = 1;
350 args[i] != NULL && args[i]->code != TYPE_CODE_VOID;
351 i++)
352 {
353 c_print_type (args[i], "", stream, -1, 0);
354 if (args[i+1] == NULL)
355 {
356 fprintf_filtered (stream, "...");
357 }
358 else if (args[i+1]->code != TYPE_CODE_VOID)
359 {
360 fprintf_filtered (stream, ",");
361 wrap_here (" ");
362 }
363 }
364 }
365 }
366 fprintf_filtered (stream, ")");
367 }
368
369 /* Print any array sizes, function arguments or close parentheses
370 needed after the variable name (to describe its type).
371 Args work like c_type_print_varspec_prefix. */
372
373 static void
374 c_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args)
375 struct type *type;
376 FILE *stream;
377 int show;
378 int passed_a_ptr;
379 int demangled_args;
380 {
381 if (type == 0)
382 return;
383
384 if (TYPE_NAME (type) && show <= 0)
385 return;
386
387 QUIT;
388
389 switch (TYPE_CODE (type))
390 {
391 case TYPE_CODE_ARRAY:
392 if (passed_a_ptr)
393 fprintf_filtered (stream, ")");
394
395 fprintf_filtered (stream, "[");
396 if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
397 fprintf_filtered (stream, "%d",
398 (TYPE_LENGTH (type)
399 / TYPE_LENGTH (TYPE_TARGET_TYPE (type))));
400 fprintf_filtered (stream, "]");
401
402 c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
403 break;
404
405 case TYPE_CODE_MEMBER:
406 if (passed_a_ptr)
407 fprintf_filtered (stream, ")");
408 c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
409 break;
410
411 case TYPE_CODE_METHOD:
412 if (passed_a_ptr)
413 fprintf_filtered (stream, ")");
414 c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
415 if (passed_a_ptr)
416 {
417 c_type_print_args (type, stream);
418 }
419 break;
420
421 case TYPE_CODE_PTR:
422 case TYPE_CODE_REF:
423 c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0);
424 break;
425
426 case TYPE_CODE_FUNC:
427 c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
428 passed_a_ptr, 0);
429 if (passed_a_ptr)
430 fprintf_filtered (stream, ")");
431 if (!demangled_args)
432 fprintf_filtered (stream, "()");
433 break;
434
435 case TYPE_CODE_UNDEF:
436 case TYPE_CODE_STRUCT:
437 case TYPE_CODE_UNION:
438 case TYPE_CODE_ENUM:
439 case TYPE_CODE_INT:
440 case TYPE_CODE_FLT:
441 case TYPE_CODE_VOID:
442 case TYPE_CODE_ERROR:
443 case TYPE_CODE_CHAR:
444 case TYPE_CODE_BOOL:
445 case TYPE_CODE_SET:
446 case TYPE_CODE_RANGE:
447 case TYPE_CODE_PASCAL_ARRAY:
448 /* These types do not need a suffix. They are listed so that
449 gcc -Wall will report types that may not have been considered. */
450 break;
451 }
452 }
453
454 /* Print the name of the type (or the ultimate pointer target,
455 function value or array element), or the description of a
456 structure or union.
457
458 SHOW nonzero means don't print this type as just its name;
459 show its real definition even if it has a name.
460 SHOW zero means print just typename or struct tag if there is one
461 SHOW negative means abbreviate structure elements.
462 SHOW is decremented for printing of structure elements.
463
464 LEVEL is the depth to indent by.
465 We increase it for some recursive calls. */
466
467 void
468 c_type_print_base (type, stream, show, level)
469 struct type *type;
470 FILE *stream;
471 int show;
472 int level;
473 {
474 char *name;
475 register int i;
476 register int len;
477 register int lastval;
478 char *mangled_name;
479 char *demangled_name;
480 enum {s_none, s_public, s_private, s_protected} section_type;
481 QUIT;
482
483 wrap_here (" ");
484 if (type == NULL)
485 {
486 fputs_filtered ("<type unknown>", stream);
487 return;
488 }
489
490 /* When SHOW is zero or less, and there is a valid type name, then always
491 just print the type name directly from the type. */
492
493 if ((show <= 0) && (TYPE_NAME (type) != NULL))
494 {
495 fputs_filtered (TYPE_NAME (type), stream);
496 return;
497 }
498
499 switch (TYPE_CODE (type))
500 {
501 case TYPE_CODE_ARRAY:
502 case TYPE_CODE_PTR:
503 case TYPE_CODE_MEMBER:
504 case TYPE_CODE_REF:
505 case TYPE_CODE_FUNC:
506 case TYPE_CODE_METHOD:
507 c_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
508 break;
509
510 case TYPE_CODE_STRUCT:
511 fprintf_filtered (stream,
512 HAVE_CPLUS_STRUCT (type) ? "class " : "struct ");
513 goto struct_union;
514
515 case TYPE_CODE_UNION:
516 fprintf_filtered (stream, "union ");
517 struct_union:
518 if ((name = type_name_no_tag (type)) != NULL)
519 {
520 fputs_filtered (name, stream);
521 fputs_filtered (" ", stream);
522 wrap_here (" ");
523 }
524 if (show < 0)
525 fprintf_filtered (stream, "{...}");
526 else
527 {
528 check_stub_type (type);
529
530 cp_type_print_derivation_info (stream, type);
531
532 fprintf_filtered (stream, "{\n");
533 if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
534 {
535 if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
536 fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
537 else
538 fprintfi_filtered (level + 4, stream, "<no data fields>\n");
539 }
540
541 /* Start off with no specific section type, so we can print
542 one for the first field we find, and use that section type
543 thereafter until we find another type. */
544
545 section_type = s_none;
546
547 /* If there is a base class for this type,
548 do not print the field that it occupies. */
549
550 len = TYPE_NFIELDS (type);
551 for (i = TYPE_N_BASECLASSES (type); i < len; i++)
552 {
553 QUIT;
554 /* Don't print out virtual function table. */
555 if ((TYPE_FIELD_NAME (type, i))[5] == CPLUS_MARKER &&
556 !strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5))
557 continue;
558
559 /* If this is a C++ class we can print the various C++ section
560 labels. */
561
562 if (HAVE_CPLUS_STRUCT (type))
563 {
564 if (TYPE_FIELD_PROTECTED (type, i))
565 {
566 if (section_type != s_protected)
567 {
568 section_type = s_protected;
569 fprintfi_filtered (level + 2, stream,
570 "protected:\n");
571 }
572 }
573 else if (TYPE_FIELD_PRIVATE (type, i))
574 {
575 if (section_type != s_private)
576 {
577 section_type = s_private;
578 fprintfi_filtered (level + 2, stream, "private:\n");
579 }
580 }
581 else
582 {
583 if (section_type != s_public)
584 {
585 section_type = s_public;
586 fprintfi_filtered (level + 2, stream, "public:\n");
587 }
588 }
589 }
590
591 print_spaces_filtered (level + 4, stream);
592 if (TYPE_FIELD_STATIC (type, i))
593 {
594 fprintf_filtered (stream, "static ");
595 }
596 c_print_type (TYPE_FIELD_TYPE (type, i),
597 TYPE_FIELD_NAME (type, i),
598 stream, show - 1, level + 4);
599 if (!TYPE_FIELD_STATIC (type, i)
600 && TYPE_FIELD_PACKED (type, i))
601 {
602 /* It is a bitfield. This code does not attempt
603 to look at the bitpos and reconstruct filler,
604 unnamed fields. This would lead to misleading
605 results if the compiler does not put out fields
606 for such things (I don't know what it does). */
607 fprintf_filtered (stream, " : %d",
608 TYPE_FIELD_BITSIZE (type, i));
609 }
610 fprintf_filtered (stream, ";\n");
611 }
612
613 /* If there are both fields and methods, put a space between. */
614 len = TYPE_NFN_FIELDS (type);
615 if (len && section_type != s_none)
616 fprintf_filtered (stream, "\n");
617
618 /* C++: print out the methods */
619
620 for (i = 0; i < len; i++)
621 {
622 struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
623 int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
624 char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
625 int is_constructor = name && strcmp(method_name, name) == 0;
626 for (j = 0; j < len2; j++)
627 {
628 QUIT;
629 if (TYPE_FN_FIELD_PROTECTED (f, j))
630 {
631 if (section_type != s_protected)
632 {
633 section_type = s_protected;
634 fprintfi_filtered (level + 2, stream,
635 "protected:\n");
636 }
637 }
638 else if (TYPE_FN_FIELD_PRIVATE (f, j))
639 {
640 if (section_type != s_private)
641 {
642 section_type = s_private;
643 fprintfi_filtered (level + 2, stream, "private:\n");
644 }
645 }
646 else
647 {
648 if (section_type != s_public)
649 {
650 section_type = s_public;
651 fprintfi_filtered (level + 2, stream, "public:\n");
652 }
653 }
654
655 print_spaces_filtered (level + 4, stream);
656 if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
657 fprintf_filtered (stream, "virtual ");
658 else if (TYPE_FN_FIELD_STATIC_P (f, j))
659 fprintf_filtered (stream, "static ");
660 if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0)
661 {
662 /* Keep GDB from crashing here. */
663 fprintf (stream, "<undefined type> %s;\n",
664 TYPE_FN_FIELD_PHYSNAME (f, j));
665 break;
666 }
667 else if (!is_constructor)
668 {
669 type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
670 "", stream, 0);
671 fputs_filtered (" ", stream);
672 }
673 if (TYPE_FN_FIELD_STUB (f, j))
674 {
675 /* Build something we can demangle. */
676 mangled_name = gdb_mangle_name (type, i, j);
677 demangled_name =
678 cplus_demangle (mangled_name,
679 DMGL_ANSI | DMGL_PARAMS);
680 if (demangled_name == NULL)
681 fprintf_filtered (stream, "<badly mangled name %s>",
682 mangled_name);
683 else
684 {
685 fprintf_filtered (stream, "%s",
686 strchr (demangled_name, ':') + 2);
687 free (demangled_name);
688 }
689 free (mangled_name);
690 }
691 else if (TYPE_FN_FIELD_PHYSNAME (f, j)[0] == '_'
692 && TYPE_FN_FIELD_PHYSNAME (f, j)[1] == CPLUS_MARKER)
693 cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j) + 1,
694 "~", method_name, 0, stream);
695 else
696 cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j), "",
697 method_name,
698 TYPE_FN_FIELD_STATIC_P (f, j),
699 stream);
700
701 fprintf_filtered (stream, ";\n");
702 }
703 }
704
705 fprintfi_filtered (level, stream, "}");
706 }
707 break;
708
709 case TYPE_CODE_ENUM:
710 fprintf_filtered (stream, "enum ");
711 if ((name = type_name_no_tag (type)) != NULL)
712 {
713 fputs_filtered (name, stream);
714 fputs_filtered (" ", stream);
715 }
716 wrap_here (" ");
717 if (show < 0)
718 fprintf_filtered (stream, "{...}");
719 else
720 {
721 fprintf_filtered (stream, "{");
722 len = TYPE_NFIELDS (type);
723 lastval = 0;
724 for (i = 0; i < len; i++)
725 {
726 QUIT;
727 if (i) fprintf_filtered (stream, ", ");
728 wrap_here (" ");
729 fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
730 if (lastval != TYPE_FIELD_BITPOS (type, i))
731 {
732 fprintf_filtered (stream, " = %d", TYPE_FIELD_BITPOS (type, i));
733 lastval = TYPE_FIELD_BITPOS (type, i);
734 }
735 lastval++;
736 }
737 fprintf_filtered (stream, "}");
738 }
739 break;
740
741 case TYPE_CODE_VOID:
742 fprintf_filtered (stream, "void");
743 break;
744
745 case TYPE_CODE_UNDEF:
746 fprintf_filtered (stream, "struct <unknown>");
747 break;
748
749 case TYPE_CODE_ERROR:
750 fprintf_filtered (stream, "<unknown type>");
751 break;
752
753 case TYPE_CODE_RANGE:
754 /* This should not occur */
755 fprintf_filtered (stream, "<range type>");
756 break;
757
758 default:
759 /* Handle types not explicitly handled by the other cases,
760 such as fundamental types. For these, just print whatever
761 the type name is, as recorded in the type itself. If there
762 is no type name, then complain. */
763 if (TYPE_NAME (type) != NULL)
764 {
765 fputs_filtered (TYPE_NAME (type), stream);
766 }
767 else
768 {
769 error ("Invalid type code (%d) in symbol table.", TYPE_CODE (type));
770 }
771 break;
772 }
773 }
774
This page took 0.044227 seconds and 4 git commands to generate.