1 /* D language support routines for GDB, the GNU debugger.
3 Copyright (C) 2005-2014 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program 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 3 of the License, or
10 (at your option) any later version.
12 This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
26 #include "parser-defs.h"
27 #include "gdb_obstack.h"
29 #include "safe-ctype.h"
31 static const char *parse_function_args (struct obstack
*, const char *);
32 static const char *parse_type (struct obstack
*, const char *);
34 /* The name of the symbol to use to get the name of the main subprogram. */
35 static const char D_MAIN
[] = "D main";
37 /* Function returning the special symbol name used by D for the main
38 procedure in the main program if it is found in minimal symbol list.
39 This function tries to find minimal symbols so that it finds them even
40 if the program was compiled without debugging information. */
45 struct minimal_symbol
*msym
;
47 msym
= lookup_minimal_symbol (D_MAIN
, NULL
, NULL
);
51 /* No known entry procedure found, the main program is probably not D. */
55 /* Demangle the calling convention from MANGLE and append it to TEMPBUF.
56 Return the remaining string on success or NULL on failure. */
59 parse_call_convention (struct obstack
*tempbuf
, const char *mangle
)
61 if ((mangle
== NULL
) || (*mangle
== '\0'))
71 obstack_grow_str (tempbuf
, "extern(C) ");
73 case 'W': /* (Windows) */
75 obstack_grow_str (tempbuf
, "extern(Windows) ");
77 case 'V': /* (Pascal) */
79 obstack_grow_str (tempbuf
, "extern(Pascal) ");
83 obstack_grow_str (tempbuf
, "extern(C++) ");
92 /* Demangle the D function attributes from MANGLE and append it to TEMPBUF.
93 Return the remaining string on success or NULL on failure. */
96 parse_attributes (struct obstack
*tempbuf
, const char *mangle
)
98 if ((mangle
== NULL
) || (*mangle
== '\0'))
101 while (*mangle
== 'N')
108 obstack_grow_str (tempbuf
, "pure ");
110 case 'b': /* nothrow */
112 obstack_grow_str (tempbuf
, "nothrow ");
116 obstack_grow_str (tempbuf
, "ref ");
118 case 'd': /* @property */
120 obstack_grow_str (tempbuf
, "@property ");
122 case 'e': /* @trusted */
124 obstack_grow_str (tempbuf
, "@trusted ");
126 case 'f': /* @safe */
128 obstack_grow_str (tempbuf
, "@safe ");
132 /* inout parameter is represented as 'Ng'.
133 vector parameter is represented as 'Nh'.
134 If we see this, then we know we're really in the
135 parameter list. Rewind and break. */
143 /* Demangle the function type from MANGLE and append it to TEMPBUF.
144 Return the remaining string on success or NULL on failure. */
147 parse_function_type (struct obstack
*tempbuf
, const char *mangle
)
149 struct obstack obattr
, obargs
, obtype
;
150 char *attr
, *args
, *type
;
151 size_t szattr
, szargs
, sztype
;
153 if ((mangle
== NULL
) || (*mangle
== '\0'))
156 /* The order of the mangled string is:
158 CallConvention FuncAttrs Arguments ArgClose Type
160 The demangled string is re-ordered as:
161 CallConvention Type Arguments FuncAttrs
163 obstack_init (&obattr
);
164 obstack_init (&obargs
);
165 obstack_init (&obtype
);
167 /* Function call convention. */
168 mangle
= parse_call_convention (tempbuf
, mangle
);
170 /* Function attributes. */
171 mangle
= parse_attributes (&obattr
, mangle
);
172 szattr
= obstack_object_size (&obattr
);
173 attr
= obstack_finish (&obattr
);
175 /* Function arguments. */
176 mangle
= parse_function_args (&obargs
, mangle
);
177 szargs
= obstack_object_size (&obargs
);
178 args
= obstack_finish (&obargs
);
180 /* Function return type. */
181 mangle
= parse_type (&obtype
, mangle
);
182 sztype
= obstack_object_size (&obtype
);
183 type
= obstack_finish (&obtype
);
185 /* Append to buffer in order. */
186 obstack_grow (tempbuf
, type
, sztype
);
187 obstack_grow_str (tempbuf
, "(");
188 obstack_grow (tempbuf
, args
, szargs
);
189 obstack_grow_str (tempbuf
, ") ");
190 obstack_grow (tempbuf
, attr
, szattr
);
192 obstack_free (&obattr
, NULL
);
193 obstack_free (&obargs
, NULL
);
194 obstack_free (&obtype
, NULL
);
198 /* Demangle the argument list from MANGLE and append it to TEMPBUF.
199 Return the remaining string on success or NULL on failure. */
202 parse_function_args (struct obstack
*tempbuf
, const char *mangle
)
206 while ((mangle
!= NULL
) && (*mangle
!= '\0'))
210 case 'X': /* (variadic T t...) style. */
212 obstack_grow_str (tempbuf
, "...");
214 case 'Y': /* (variadic T t, ...) style. */
216 obstack_grow_str (tempbuf
, ", ...");
218 case 'Z': /* Normal function. */
224 obstack_grow_str (tempbuf
, ", ");
226 if (*mangle
== 'M') /* scope(T) */
229 obstack_grow_str (tempbuf
, "scope ");
234 case 'J': /* out(T) */
236 obstack_grow_str (tempbuf
, "out ");
238 case 'K': /* ref(T) */
240 obstack_grow_str (tempbuf
, "ref ");
242 case 'L': /* lazy(T) */
244 obstack_grow_str (tempbuf
, "lazy ");
247 mangle
= parse_type (tempbuf
, mangle
);
252 /* Demangle the type from MANGLE and append it to TEMPBUF.
253 Return the remaining string on success or NULL on failure. */
256 parse_type (struct obstack
*tempbuf
, const char *mangle
)
258 if ((mangle
== NULL
) || (*mangle
== '\0'))
263 case 'O': /* shared(T) */
265 obstack_grow_str (tempbuf
, "shared(");
266 mangle
= parse_type (tempbuf
, mangle
);
267 obstack_grow_str (tempbuf
, ")");
269 case 'x': /* const(T) */
271 obstack_grow_str (tempbuf
, "const(");
272 mangle
= parse_type (tempbuf
, mangle
);
273 obstack_grow_str (tempbuf
, ")");
275 case 'y': /* immutable(T) */
277 obstack_grow_str (tempbuf
, "immutable(");
278 mangle
= parse_type (tempbuf
, mangle
);
279 obstack_grow_str (tempbuf
, ")");
283 if (*mangle
== 'g') /* wild(T) */
286 obstack_grow_str (tempbuf
, "inout(");
287 mangle
= parse_type (tempbuf
, mangle
);
288 obstack_grow_str (tempbuf
, ")");
291 else if (*mangle
== 'h') /* vector(T) */
294 /* The basetype for vectors are always static arrays. */
297 obstack_grow_str (tempbuf
, "__vector(");
298 mangle
= parse_type (tempbuf
, mangle
);
299 obstack_grow_str (tempbuf
, ")");
304 case 'A': /* dynamic array (T[]) */
306 mangle
= parse_type (tempbuf
, mangle
);
307 obstack_grow_str (tempbuf
, "[]");
309 case 'G': /* static array (T[N]) */
316 while (ISDIGIT (*mangle
))
321 mangle
= parse_type (tempbuf
, mangle
);
322 obstack_grow_str (tempbuf
, "[");
323 obstack_grow (tempbuf
, numptr
, num
);
324 obstack_grow_str (tempbuf
, "]");
327 case 'H': /* associative array (T[T]) */
329 struct obstack obtype
;
334 obstack_init (&obtype
);
335 mangle
= parse_type (&obtype
, mangle
);
336 sztype
= obstack_object_size (&obtype
);
337 type
= obstack_finish (&obtype
);
339 mangle
= parse_type (tempbuf
, mangle
);
340 obstack_grow_str (tempbuf
, "[");
341 obstack_grow (tempbuf
, type
, sztype
);
342 obstack_grow_str (tempbuf
, "]");
344 obstack_free (&obtype
, NULL
);
347 case 'P': /* pointer (T*) */
349 mangle
= parse_type (tempbuf
, mangle
);
350 obstack_grow_str (tempbuf
, "*");
352 case 'I': /* ident T */
353 case 'C': /* class T */
354 case 'S': /* struct T */
355 case 'E': /* enum T */
356 case 'T': /* typedef T */
358 return d_parse_symbol (tempbuf
, mangle
);
359 case 'D': /* delegate T */
361 mangle
= parse_function_type (tempbuf
, mangle
);
362 obstack_grow_str (tempbuf
, "delegate");
364 case 'B': /* tuple T */
365 /* TODO: Handle this. */
369 case 'F': case 'U': case 'W':
371 mangle
= parse_function_type (tempbuf
, mangle
);
372 obstack_grow_str (tempbuf
, "function");
378 obstack_grow_str (tempbuf
, "none");
382 obstack_grow_str (tempbuf
, "void");
386 obstack_grow_str (tempbuf
, "byte");
390 obstack_grow_str (tempbuf
, "ubyte");
394 obstack_grow_str (tempbuf
, "short");
398 obstack_grow_str (tempbuf
, "ushort");
402 obstack_grow_str (tempbuf
, "int");
406 obstack_grow_str (tempbuf
, "uint");
410 obstack_grow_str (tempbuf
, "long");
414 obstack_grow_str (tempbuf
, "ulong");
418 obstack_grow_str (tempbuf
, "float");
422 obstack_grow_str (tempbuf
, "double");
426 obstack_grow_str (tempbuf
, "real");
429 /* Imaginary and Complex types */
432 obstack_grow_str (tempbuf
, "ifloat");
436 obstack_grow_str (tempbuf
, "idouble");
440 obstack_grow_str (tempbuf
, "ireal");
444 obstack_grow_str (tempbuf
, "cfloat");
448 obstack_grow_str (tempbuf
, "cdouble");
452 obstack_grow_str (tempbuf
, "creal");
458 obstack_grow_str (tempbuf
, "bool");
462 obstack_grow_str (tempbuf
, "char");
466 obstack_grow_str (tempbuf
, "wchar");
470 obstack_grow_str (tempbuf
, "dchar");
473 default: /* unhandled */
478 /* Extract the identifier from MANGLE and append it to TEMPBUF.
479 Return the remaining string on success or NULL on failure. */
482 parse_identifier (struct obstack
*tempbuf
, const char *mangle
)
484 if ((mangle
== NULL
) || (*mangle
== '\0'))
487 if (ISDIGIT (*mangle
))
490 long i
= strtol (mangle
, &endptr
, 10);
492 if (i
<= 0 || strlen (endptr
) < i
)
497 /* No support for demangling templates. */
498 if (i
>= 5 && strncmp (mangle
, "__T", 3) == 0)
501 if (strncmp (mangle
, "__ctor", i
) == 0)
503 /* Constructor symbol for a class/struct. */
504 obstack_grow_str (tempbuf
, "this");
508 else if (strncmp (mangle
, "__dtor", i
) == 0)
510 /* Destructor symbol for a class/struct. */
511 obstack_grow_str (tempbuf
, "~this");
515 else if (strncmp (mangle
, "__postblit", i
) == 0)
517 /* Postblit symbol for a struct. */
518 obstack_grow_str (tempbuf
, "this(this)");
522 else if (strncmp (mangle
, "__initZ", i
+1) == 0)
524 /* The static initialiser for a given symbol. */
525 obstack_grow_str (tempbuf
, "init$");
529 else if (strncmp (mangle
, "__ClassZ", i
+1) == 0)
531 /* The classinfo symbol for a given class. */
532 obstack_grow_str (tempbuf
, "classinfo$");
536 else if (strncmp (mangle
, "__vtblZ", i
+1) == 0)
538 /* The vtable symbol for a given class. */
539 obstack_grow_str (tempbuf
, "vtbl$");
543 else if (strncmp (mangle
, "__InterfaceZ", i
+1) == 0)
545 /* The interface symbol for a given class. */
546 obstack_grow_str (tempbuf
, "interface$");
550 else if (strncmp (mangle
, "__ModuleInfoZ", i
+1) == 0)
552 /* The ModuleInfo symbol for a given module. */
553 obstack_grow_str (tempbuf
, "moduleinfo$");
557 obstack_grow (tempbuf
, mangle
, i
);
566 /* Test whether the current position of MANGLE is pointing to the
567 beginning of a mangled function parameter list, which starts with
568 the calling convention. Returns 1 on success or 0 on failure. */
571 call_convention_p (const char *mangle
)
575 if ((mangle
== NULL
) || (*mangle
== '\0'))
580 case 'F': case 'U': case 'V':
584 case 'M': /* Prefix for functions needing 'this'. */
586 if (mangle
[i
] == 'x')
591 case 'F': case 'U': case 'V':
601 /* Extract and demangle the symbol in MANGLE and append it to TEMPBUF.
602 Return the remaining signature on success or NULL on failure. */
605 d_parse_symbol (struct obstack
*tempbuf
, const char *mangle
)
611 obstack_grow_str (tempbuf
, ".");
613 mangle
= parse_identifier (tempbuf
, mangle
);
615 if (call_convention_p (mangle
))
619 /* Skip over 'this' parameter. */
621 mangle
+= (mangle
[1] == 'x') ? 2 : 1;
623 /* Skip over calling convention and attributes in qualified name. */
624 saved
= obstack_next_free (tempbuf
);
625 mangle
= parse_call_convention (tempbuf
, mangle
);
626 mangle
= parse_attributes (tempbuf
, mangle
);
627 obstack_next_free (tempbuf
) = saved
;
629 obstack_grow_str (tempbuf
, "(");
630 mangle
= parse_function_args (tempbuf
, mangle
);
631 obstack_grow_str (tempbuf
, ")");
633 /* Demangle the function return type as a kind of sanity test. */
634 if ((mangle
!= NULL
) && !ISDIGIT (*mangle
))
636 saved
= obstack_next_free (tempbuf
);
637 mangle
= parse_type (tempbuf
, mangle
);
638 obstack_next_free (tempbuf
) = saved
;
642 while ((mangle
!= NULL
) && ISDIGIT (*mangle
));
647 /* Implements the la_demangle language_defn routine for language D. */
650 d_demangle (const char *symbol
, int options
)
652 struct obstack tempbuf
;
655 if ((symbol
== NULL
) || (*symbol
== '\0'))
657 else if (strcmp (symbol
, "_Dmain") == 0)
658 return xstrdup ("D main");
660 obstack_init (&tempbuf
);
662 if (strncmp (symbol
, "_D", 2) == 0)
666 obstack_free (&tempbuf
, NULL
);
670 if (d_parse_symbol (&tempbuf
, symbol
) != NULL
)
672 obstack_grow_str0 (&tempbuf
, "");
673 result
= xstrdup (obstack_finish (&tempbuf
));
674 obstack_free (&tempbuf
, NULL
);
678 obstack_free (&tempbuf
, NULL
);
685 /* Table mapping opcodes into strings for printing operators
686 and precedences of the operators. */
687 static const struct op_print d_op_print_tab
[] =
689 {",", BINOP_COMMA
, PREC_COMMA
, 0},
690 {"=", BINOP_ASSIGN
, PREC_ASSIGN
, 1},
691 {"||", BINOP_LOGICAL_OR
, PREC_LOGICAL_OR
, 0},
692 {"&&", BINOP_LOGICAL_AND
, PREC_LOGICAL_AND
, 0},
693 {"|", BINOP_BITWISE_IOR
, PREC_BITWISE_IOR
, 0},
694 {"^", BINOP_BITWISE_XOR
, PREC_BITWISE_XOR
, 0},
695 {"&", BINOP_BITWISE_AND
, PREC_BITWISE_AND
, 0},
696 {"==", BINOP_EQUAL
, PREC_EQUAL
, 0},
697 {"!=", BINOP_NOTEQUAL
, PREC_EQUAL
, 0},
698 {"<=", BINOP_LEQ
, PREC_ORDER
, 0},
699 {">=", BINOP_GEQ
, PREC_ORDER
, 0},
700 {">", BINOP_GTR
, PREC_ORDER
, 0},
701 {"<", BINOP_LESS
, PREC_ORDER
, 0},
702 {">>", BINOP_RSH
, PREC_SHIFT
, 0},
703 {"<<", BINOP_LSH
, PREC_SHIFT
, 0},
704 {"+", BINOP_ADD
, PREC_ADD
, 0},
705 {"-", BINOP_SUB
, PREC_ADD
, 0},
706 {"*", BINOP_MUL
, PREC_MUL
, 0},
707 {"/", BINOP_DIV
, PREC_MUL
, 0},
708 {"%", BINOP_REM
, PREC_MUL
, 0},
709 {"@", BINOP_REPEAT
, PREC_REPEAT
, 0},
710 {"-", UNOP_NEG
, PREC_PREFIX
, 0},
711 {"!", UNOP_LOGICAL_NOT
, PREC_PREFIX
, 0},
712 {"~", UNOP_COMPLEMENT
, PREC_PREFIX
, 0},
713 {"*", UNOP_IND
, PREC_PREFIX
, 0},
714 {"&", UNOP_ADDR
, PREC_PREFIX
, 0},
715 {"sizeof ", UNOP_SIZEOF
, PREC_PREFIX
, 0},
716 {"++", UNOP_PREINCREMENT
, PREC_PREFIX
, 0},
717 {"--", UNOP_PREDECREMENT
, PREC_PREFIX
, 0},
721 /* Mapping of all D basic data types into the language vector. */
723 enum d_primitive_types
{
724 d_primitive_type_void
,
725 d_primitive_type_bool
,
726 d_primitive_type_byte
,
727 d_primitive_type_ubyte
,
728 d_primitive_type_short
,
729 d_primitive_type_ushort
,
730 d_primitive_type_int
,
731 d_primitive_type_uint
,
732 d_primitive_type_long
,
733 d_primitive_type_ulong
,
734 d_primitive_type_cent
, /* Signed 128 bit integer. */
735 d_primitive_type_ucent
, /* Unsigned 128 bit integer. */
736 d_primitive_type_float
,
737 d_primitive_type_double
,
738 d_primitive_type_real
,
739 d_primitive_type_ifloat
, /* Imaginary float types. */
740 d_primitive_type_idouble
,
741 d_primitive_type_ireal
,
742 d_primitive_type_cfloat
, /* Complex number of two float values. */
743 d_primitive_type_cdouble
,
744 d_primitive_type_creal
,
745 d_primitive_type_char
, /* Unsigned character types. */
746 d_primitive_type_wchar
,
747 d_primitive_type_dchar
,
751 /* Implements the la_language_arch_info language_defn routine
755 d_language_arch_info (struct gdbarch
*gdbarch
,
756 struct language_arch_info
*lai
)
758 const struct builtin_d_type
*builtin
= builtin_d_type (gdbarch
);
760 lai
->string_char_type
= builtin
->builtin_char
;
761 lai
->primitive_type_vector
762 = GDBARCH_OBSTACK_CALLOC (gdbarch
, nr_d_primitive_types
+ 1,
765 lai
->primitive_type_vector
[d_primitive_type_void
]
766 = builtin
->builtin_void
;
767 lai
->primitive_type_vector
[d_primitive_type_bool
]
768 = builtin
->builtin_bool
;
769 lai
->primitive_type_vector
[d_primitive_type_byte
]
770 = builtin
->builtin_byte
;
771 lai
->primitive_type_vector
[d_primitive_type_ubyte
]
772 = builtin
->builtin_ubyte
;
773 lai
->primitive_type_vector
[d_primitive_type_short
]
774 = builtin
->builtin_short
;
775 lai
->primitive_type_vector
[d_primitive_type_ushort
]
776 = builtin
->builtin_ushort
;
777 lai
->primitive_type_vector
[d_primitive_type_int
]
778 = builtin
->builtin_int
;
779 lai
->primitive_type_vector
[d_primitive_type_uint
]
780 = builtin
->builtin_uint
;
781 lai
->primitive_type_vector
[d_primitive_type_long
]
782 = builtin
->builtin_long
;
783 lai
->primitive_type_vector
[d_primitive_type_ulong
]
784 = builtin
->builtin_ulong
;
785 lai
->primitive_type_vector
[d_primitive_type_cent
]
786 = builtin
->builtin_cent
;
787 lai
->primitive_type_vector
[d_primitive_type_ucent
]
788 = builtin
->builtin_ucent
;
789 lai
->primitive_type_vector
[d_primitive_type_float
]
790 = builtin
->builtin_float
;
791 lai
->primitive_type_vector
[d_primitive_type_double
]
792 = builtin
->builtin_double
;
793 lai
->primitive_type_vector
[d_primitive_type_real
]
794 = builtin
->builtin_real
;
795 lai
->primitive_type_vector
[d_primitive_type_ifloat
]
796 = builtin
->builtin_ifloat
;
797 lai
->primitive_type_vector
[d_primitive_type_idouble
]
798 = builtin
->builtin_idouble
;
799 lai
->primitive_type_vector
[d_primitive_type_ireal
]
800 = builtin
->builtin_ireal
;
801 lai
->primitive_type_vector
[d_primitive_type_cfloat
]
802 = builtin
->builtin_cfloat
;
803 lai
->primitive_type_vector
[d_primitive_type_cdouble
]
804 = builtin
->builtin_cdouble
;
805 lai
->primitive_type_vector
[d_primitive_type_creal
]
806 = builtin
->builtin_creal
;
807 lai
->primitive_type_vector
[d_primitive_type_char
]
808 = builtin
->builtin_char
;
809 lai
->primitive_type_vector
[d_primitive_type_wchar
]
810 = builtin
->builtin_wchar
;
811 lai
->primitive_type_vector
[d_primitive_type_dchar
]
812 = builtin
->builtin_dchar
;
814 lai
->bool_type_symbol
= "bool";
815 lai
->bool_type_default
= builtin
->builtin_bool
;
818 static const struct language_defn d_language_defn
=
831 c_printchar
, /* Print a character constant. */
832 c_printstr
, /* Function to print string constant. */
833 c_emit_char
, /* Print a single char. */
834 c_print_type
, /* Print a type using appropriate syntax. */
835 c_print_typedef
, /* Print a typedef using appropriate
837 d_val_print
, /* Print a value using appropriate syntax. */
838 c_value_print
, /* Print a top-level value. */
839 default_read_var_value
, /* la_read_var_value */
840 NULL
, /* Language specific skip_trampoline. */
842 basic_lookup_symbol_nonlocal
,
843 basic_lookup_transparent_type
,
844 d_demangle
, /* Language specific symbol demangler. */
845 NULL
, /* Language specific
846 class_name_from_physname. */
847 d_op_print_tab
, /* Expression operators for printing. */
848 1, /* C-style arrays. */
849 0, /* String lower bound. */
850 default_word_break_characters
,
851 default_make_symbol_completion_list
,
852 d_language_arch_info
,
853 default_print_array_index
,
854 default_pass_by_reference
,
856 NULL
, /* la_get_symbol_name_cmp */
857 iterate_over_symbols
,
862 /* Build all D language types for the specified architecture. */
865 build_d_types (struct gdbarch
*gdbarch
)
867 struct builtin_d_type
*builtin_d_type
868 = GDBARCH_OBSTACK_ZALLOC (gdbarch
, struct builtin_d_type
);
871 builtin_d_type
->builtin_void
872 = arch_type (gdbarch
, TYPE_CODE_VOID
, 1, "void");
873 builtin_d_type
->builtin_bool
874 = arch_boolean_type (gdbarch
, 8, 1, "bool");
875 builtin_d_type
->builtin_byte
876 = arch_integer_type (gdbarch
, 8, 0, "byte");
877 builtin_d_type
->builtin_ubyte
878 = arch_integer_type (gdbarch
, 8, 1, "ubyte");
879 builtin_d_type
->builtin_short
880 = arch_integer_type (gdbarch
, 16, 0, "short");
881 builtin_d_type
->builtin_ushort
882 = arch_integer_type (gdbarch
, 16, 1, "ushort");
883 builtin_d_type
->builtin_int
884 = arch_integer_type (gdbarch
, 32, 0, "int");
885 builtin_d_type
->builtin_uint
886 = arch_integer_type (gdbarch
, 32, 1, "uint");
887 builtin_d_type
->builtin_long
888 = arch_integer_type (gdbarch
, 64, 0, "long");
889 builtin_d_type
->builtin_ulong
890 = arch_integer_type (gdbarch
, 64, 1, "ulong");
891 builtin_d_type
->builtin_cent
892 = arch_integer_type (gdbarch
, 128, 0, "cent");
893 builtin_d_type
->builtin_ucent
894 = arch_integer_type (gdbarch
, 128, 1, "ucent");
895 builtin_d_type
->builtin_float
896 = arch_float_type (gdbarch
, gdbarch_float_bit (gdbarch
),
898 builtin_d_type
->builtin_double
899 = arch_float_type (gdbarch
, gdbarch_double_bit (gdbarch
),
901 builtin_d_type
->builtin_real
902 = arch_float_type (gdbarch
, gdbarch_long_double_bit (gdbarch
),
905 TYPE_INSTANCE_FLAGS (builtin_d_type
->builtin_byte
)
906 |= TYPE_INSTANCE_FLAG_NOTTEXT
;
907 TYPE_INSTANCE_FLAGS (builtin_d_type
->builtin_ubyte
)
908 |= TYPE_INSTANCE_FLAG_NOTTEXT
;
910 /* Imaginary and complex types. */
911 builtin_d_type
->builtin_ifloat
912 = arch_float_type (gdbarch
, gdbarch_float_bit (gdbarch
),
914 builtin_d_type
->builtin_idouble
915 = arch_float_type (gdbarch
, gdbarch_double_bit (gdbarch
),
917 builtin_d_type
->builtin_ireal
918 = arch_float_type (gdbarch
, gdbarch_long_double_bit (gdbarch
),
920 builtin_d_type
->builtin_cfloat
921 = arch_complex_type (gdbarch
, "cfloat",
922 builtin_d_type
->builtin_float
);
923 builtin_d_type
->builtin_cdouble
924 = arch_complex_type (gdbarch
, "cdouble",
925 builtin_d_type
->builtin_double
);
926 builtin_d_type
->builtin_creal
927 = arch_complex_type (gdbarch
, "creal",
928 builtin_d_type
->builtin_real
);
930 /* Character types. */
931 builtin_d_type
->builtin_char
932 = arch_character_type (gdbarch
, 8, 1, "char");
933 builtin_d_type
->builtin_wchar
934 = arch_character_type (gdbarch
, 16, 1, "wchar");
935 builtin_d_type
->builtin_dchar
936 = arch_character_type (gdbarch
, 32, 1, "dchar");
938 return builtin_d_type
;
941 static struct gdbarch_data
*d_type_data
;
943 /* Return the D type table for the specified architecture. */
945 const struct builtin_d_type
*
946 builtin_d_type (struct gdbarch
*gdbarch
)
948 return gdbarch_data (gdbarch
, d_type_data
);
951 /* Provide a prototype to silence -Wmissing-prototypes. */
952 extern initialize_file_ftype _initialize_d_language
;
955 _initialize_d_language (void)
957 d_type_data
= gdbarch_data_register_post_init (build_d_types
);
959 add_language (&d_language_defn
);