1 /* d-lang.cc -- Language-dependent hooks for D.
2 Copyright (C) 2006-2020 Free Software Foundation, Inc.
4 GCC is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
9 GCC is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with GCC; see the file COPYING3. If not see
16 <http://www.gnu.org/licenses/>. */
20 #include "coretypes.h"
22 #include "dmd/aggregate.h"
24 #include "dmd/declaration.h"
26 #include "dmd/errors.h"
27 #include "dmd/expression.h"
28 #include "dmd/hdrgen.h"
29 #include "dmd/identifier.h"
31 #include "dmd/mangle.h"
33 #include "dmd/module.h"
34 #include "dmd/mtype.h"
35 #include "dmd/target.h"
40 #include "diagnostic.h"
41 #include "fold-const.h"
43 #include "langhooks.h"
44 #include "langhooks-def.h"
47 #include "stringpool.h"
48 #include "stor-layout.h"
51 #include "print-tree.h"
58 /* Array of D frontend type/decl nodes. */
59 tree d_global_trees
[DTI_MAX
];
61 /* True if compilation is currently inside the D frontend semantic passes. */
62 bool doing_semantic_analysis_p
= false;
64 /* Options handled by the compiler that are separate from the frontend. */
67 const char *fonly
; /* -fonly=<arg> */
68 const char *multilib
; /* -imultilib <dir> */
69 const char *prefix
; /* -iprefix <dir> */
72 bool deps_skip_system
; /* -MM */
73 const char *deps_filename
; /* -M[M]D */
74 const char *deps_filename_user
; /* -MF <arg> */
75 vec
<const char *> deps_target
; /* -M[QT] <arg> */
76 bool deps_phony
; /* -MP */
78 bool stdinc
; /* -nostdinc */
82 /* List of modules being compiled. */
83 static Modules builtin_modules
;
85 /* Module where `C main' is defined, compiled in if needed. */
86 static Module
*entrypoint_module
= NULL
;
87 static Module
*entrypoint_root_module
= NULL
;
89 /* The current and global binding level in effect. */
90 struct binding_level
*current_binding_level
;
91 struct binding_level
*global_binding_level
;
93 /* The context to be used for global declarations. */
94 static GTY(()) tree global_context
;
96 /* Array of all global declarations to pass back to the middle-end. */
97 static GTY(()) vec
<tree
, va_gc
> *global_declarations
;
99 /* Support for GCC-style command-line make dependency generation.
100 Adds TARGET to the make dependencies target buffer.
101 QUOTED is true if the string should be quoted. */
104 deps_add_target (const char *target
, bool quoted
)
107 gcc_obstack_init (&buffer
);
111 obstack_grow (&buffer
, target
, strlen (target
));
112 d_option
.deps_target
.safe_push ((const char *) obstack_finish (&buffer
));
116 /* Quote characters in target which are significant to Make. */
117 for (const char *p
= target
; *p
!= '\0'; p
++)
123 for (const char *q
= p
- 1; target
<= q
&& *q
== '\\'; q
--)
124 obstack_1grow (&buffer
, '\\');
125 obstack_1grow (&buffer
, '\\');
129 obstack_1grow (&buffer
, '$');
133 obstack_1grow (&buffer
, '\\');
140 obstack_1grow (&buffer
, *p
);
143 d_option
.deps_target
.safe_push ((const char *) obstack_finish (&buffer
));
146 /* Write STR, with a leading space to BUFFER, updating COLUMN as appropriate.
147 COLMAX is the number of columns to word-wrap at (0 means don't wrap). */
150 deps_write_string (const char *str
, obstack
*buffer
, unsigned &column
,
151 unsigned colmax
= 72)
153 unsigned size
= strlen (str
);
157 if (colmax
&& column
+ size
> colmax
)
159 obstack_grow (buffer
, " \\\n ", 4);
164 obstack_1grow (buffer
, ' ');
170 obstack_grow (buffer
, str
, size
);
173 /* Write out all dependencies of a given MODULE to the specified BUFFER. */
176 deps_write (Module
*module
, obstack
*buffer
)
178 hash_set
<const char *> seen_modules
;
179 vec
<const char *> dependencies
= vNULL
;
182 modlist
.push (module
);
184 vec
<const char *> phonylist
= vNULL
;
187 /* Write out make target module name. */
188 if (d_option
.deps_target
.length ())
190 for (unsigned i
= 0; i
< d_option
.deps_target
.length (); i
++)
191 deps_write_string (d_option
.deps_target
[i
], buffer
, column
);
194 deps_write_string (module
->objfile
->name
->str
, buffer
, column
);
196 obstack_1grow (buffer
, ':');
199 /* Search all modules for file dependencies. */
200 while (modlist
.length
> 0)
202 Module
*depmod
= modlist
.pop ();
204 const char *modstr
= depmod
->srcfile
->name
->str
;
206 /* Skip modules that have already been looked at. */
207 if (seen_modules
.add (modstr
))
210 dependencies
.safe_push (modstr
);
212 /* Add to list of phony targets if is not being compile. */
213 if (d_option
.deps_phony
&& !depmod
->isRoot ())
214 phonylist
.safe_push (modstr
);
216 /* Add imported files to dependency list. */
217 for (size_t i
= 0; i
< depmod
->contentImportedFiles
.length
; i
++)
219 const char *impstr
= depmod
->contentImportedFiles
[i
];
220 dependencies
.safe_push (impstr
);
221 phonylist
.safe_push (impstr
);
224 /* Search all imports of the module. */
225 for (size_t i
= 0; i
< depmod
->aimports
.length
; i
++)
227 Module
*m
= depmod
->aimports
[i
];
229 /* Ignore compiler-generated modules. */
230 if ((m
->ident
== Identifier::idPool ("__entrypoint")
231 || m
->ident
== Identifier::idPool ("__main"))
232 && m
->parent
== NULL
)
235 /* Don't search system installed modules, this includes
236 object, core.*, std.*, and gcc.* packages. */
237 if (d_option
.deps_skip_system
)
239 if (m
->ident
== Identifier::idPool ("object")
240 && m
->parent
== NULL
)
243 if (m
->md
&& m
->md
->packages
)
245 Identifier
*package
= (*m
->md
->packages
)[0];
247 if (package
== Identifier::idPool ("core")
248 || package
== Identifier::idPool ("std")
249 || package
== Identifier::idPool ("gcc"))
258 /* Write out all make dependencies. */
259 for (size_t i
= 0; i
< dependencies
.length (); i
++)
260 deps_write_string (dependencies
[i
], buffer
, column
);
262 obstack_1grow (buffer
, '\n');
264 /* Write out all phony targets. */
265 for (size_t i
= 0; i
< phonylist
.length (); i
++)
267 const char *str
= phonylist
[i
];
268 obstack_1grow (buffer
, '\n');
269 obstack_grow (buffer
, str
, strlen (str
));
270 obstack_grow (buffer
, ":\n", 2);
274 /* Implements the lang_hooks.init_options routine for language D.
275 This initializes the global state for the D frontend before calling
276 the option handlers. */
279 d_init_options (unsigned int, cl_decoded_option
*decoded_options
)
281 /* Set default values. */
284 global
.vendor
= lang_hooks
.name
;
285 global
.params
.argv0
= xstrdup (decoded_options
[0].arg
);
286 global
.params
.link
= true;
287 global
.params
.useAssert
= CHECKENABLEdefault
;
288 global
.params
.useInvariants
= CHECKENABLEdefault
;
289 global
.params
.useIn
= CHECKENABLEdefault
;
290 global
.params
.useOut
= CHECKENABLEdefault
;
291 global
.params
.useArrayBounds
= CHECKENABLEdefault
;
292 global
.params
.useSwitchError
= CHECKENABLEdefault
;
293 global
.params
.checkAction
= CHECKACTION_D
;
294 global
.params
.useModuleInfo
= true;
295 global
.params
.useTypeInfo
= true;
296 global
.params
.useExceptions
= true;
297 global
.params
.useInline
= false;
298 global
.params
.obj
= true;
299 global
.params
.hdrStripPlainFunctions
= true;
300 global
.params
.betterC
= false;
301 global
.params
.allInst
= false;
302 global
.params
.errorLimit
= flag_max_errors
;
304 /* Default extern(C++) mangling to C++14. */
305 global
.params
.cplusplus
= CppStdRevisionCpp14
;
307 /* Warnings and deprecations are disabled by default. */
308 global
.params
.useDeprecated
= DIAGNOSTICinform
;
309 global
.params
.warnings
= DIAGNOSTICoff
;
311 global
.params
.imppath
= new Strings ();
312 global
.params
.fileImppath
= new Strings ();
314 /* Extra GDC-specific options. */
315 d_option
.fonly
= NULL
;
316 d_option
.multilib
= NULL
;
317 d_option
.prefix
= NULL
;
318 d_option
.deps
= false;
319 d_option
.deps_skip_system
= false;
320 d_option
.deps_filename
= NULL
;
321 d_option
.deps_filename_user
= NULL
;
322 d_option
.deps_target
= vNULL
;
323 d_option
.deps_phony
= false;
324 d_option
.stdinc
= true;
327 /* Implements the lang_hooks.init_options_struct routine for language D.
328 Initializes the options structure OPTS. */
331 d_init_options_struct (gcc_options
*opts
)
334 opts
->x_flag_exceptions
= 1;
336 /* Avoid range issues for complex multiply and divide. */
337 opts
->x_flag_complex_method
= 2;
339 /* Unlike C, there is no global `errno' variable. */
340 opts
->x_flag_errno_math
= 0;
341 opts
->frontend_set_flag_errno_math
= true;
343 /* D says that signed overflow is precisely defined. */
344 opts
->x_flag_wrapv
= 1;
347 /* Implements the lang_hooks.lang_mask routine for language D.
348 Returns language mask for option parsing. */
351 d_option_lang_mask (void)
356 /* Implements the lang_hooks.init routine for language D. */
364 Expression::_init ();
368 global_binding_level
= ggc_cleared_alloc
<binding_level
> ();
369 current_binding_level
= global_binding_level
;
371 /* This allows the code in d-builtins.cc to not have to worry about
372 converting (C signed char *) to (D char *) for string arguments of
373 built-in functions. The parameter (signed_char = false) specifies
374 whether char is signed. */
375 build_common_tree_nodes (false);
380 using_eh_for_cleanups ();
382 if (!supports_one_only ())
385 /* This is the C main, not the D main. */
386 main_identifier_node
= get_identifier ("main");
388 target
._init (global
.params
);
391 /* Insert all library-configured identifiers and import paths. */
392 add_import_paths (d_option
.prefix
, d_option
.multilib
, d_option
.stdinc
);
397 /* Implements the lang_hooks.init_ts routine for language D. */
402 MARK_TS_TYPED (FLOAT_MOD_EXPR
);
403 MARK_TS_TYPED (UNSIGNED_RSHIFT_EXPR
);
406 /* Implements the lang_hooks.handle_option routine for language D.
407 Handles D specific options. Return false if we didn't do anything. */
410 d_handle_option (size_t scode
, const char *arg
, HOST_WIDE_INT value
,
411 int kind ATTRIBUTE_UNUSED
,
412 location_t loc ATTRIBUTE_UNUSED
,
413 const cl_option_handlers
*handlers ATTRIBUTE_UNUSED
)
415 opt_code code
= (opt_code
) scode
;
420 case OPT_fall_instantiations
:
421 global
.params
.allInst
= value
;
425 global
.params
.useAssert
= value
? CHECKENABLEon
: CHECKENABLEoff
;
428 case OPT_fbounds_check
:
429 global
.params
.useArrayBounds
= value
? CHECKENABLEon
: CHECKENABLEoff
;
432 case OPT_fbounds_check_
:
433 global
.params
.useArrayBounds
= (value
== 2) ? CHECKENABLEon
434 : (value
== 1) ? CHECKENABLEsafeonly
: CHECKENABLEoff
;
438 global
.params
.debuglevel
= value
? 1 : 0;
442 if (ISDIGIT (arg
[0]))
444 int level
= integral_argument (arg
);
447 global
.params
.debuglevel
= level
;
452 if (Identifier::isValidIdentifier (CONST_CAST (char *, arg
)))
454 if (!global
.params
.debugids
)
455 global
.params
.debugids
= new Strings ();
456 global
.params
.debugids
->push (arg
);
460 error ("bad argument for %<-fdebug%>: %qs", arg
);
464 global
.params
.doDocComments
= value
;
468 global
.params
.doDocComments
= true;
469 global
.params
.docdir
= arg
;
473 global
.params
.doDocComments
= true;
474 global
.params
.docname
= arg
;
478 global
.params
.ddocfiles
.push (arg
);
482 global
.params
.betterC
= !value
;
485 case OPT_fdump_d_original
:
486 global
.params
.vcg_ast
= value
;
489 case OPT_fexceptions
:
490 global
.params
.useExceptions
= value
;
493 case OPT_fignore_unknown_pragmas
:
494 global
.params
.ignoreUnsupportedPragmas
= value
;
497 case OPT_finvariants
:
498 global
.params
.useInvariants
= value
? CHECKENABLEon
: CHECKENABLEoff
;
502 global
.params
.addMain
= value
;
505 case OPT_fmodule_file_
:
506 global
.params
.modFileAliasStrings
.push (arg
);
507 if (!strchr (arg
, '='))
508 error ("bad argument for %<-fmodule-file%>: %qs", arg
);
511 case OPT_fmoduleinfo
:
512 global
.params
.useModuleInfo
= value
;
516 d_option
.fonly
= arg
;
519 case OPT_fpostconditions
:
520 global
.params
.useOut
= value
? CHECKENABLEon
: CHECKENABLEoff
;
523 case OPT_fpreconditions
:
524 global
.params
.useIn
= value
? CHECKENABLEon
: CHECKENABLEoff
;
528 global
.params
.release
= value
;
532 global
.params
.useTypeInfo
= value
;
535 case OPT_fswitch_errors
:
536 global
.params
.useSwitchError
= value
? CHECKENABLEon
: CHECKENABLEoff
;
539 case OPT_ftransition_all
:
540 global
.params
.vtls
= value
;
541 global
.params
.vfield
= value
;
542 global
.params
.vcomplex
= value
;
545 case OPT_ftransition_checkimports
:
546 global
.params
.check10378
= value
;
549 case OPT_ftransition_complex
:
550 global
.params
.vcomplex
= value
;
553 case OPT_ftransition_dip1000
:
554 global
.params
.vsafe
= value
;
555 global
.params
.useDIP25
= value
;
558 case OPT_ftransition_dip25
:
559 global
.params
.useDIP25
= value
;
562 case OPT_ftransition_field
:
563 global
.params
.vfield
= value
;
566 case OPT_ftransition_import
:
567 global
.params
.bug10378
= value
;
570 case OPT_ftransition_nogc
:
571 global
.params
.vgc
= value
;
574 case OPT_ftransition_tls
:
575 global
.params
.vtls
= value
;
579 global
.params
.useUnitTests
= value
;
583 if (ISDIGIT (arg
[0]))
585 int level
= integral_argument (arg
);
588 global
.params
.versionlevel
= level
;
593 if (Identifier::isValidIdentifier (CONST_CAST (char *, arg
)))
595 if (!global
.params
.versionids
)
596 global
.params
.versionids
= new Strings ();
597 global
.params
.versionids
->push (arg
);
601 error ("bad argument for %<-fversion%>: %qs", arg
);
605 global
.params
.doHdrGeneration
= true;
609 global
.params
.doHdrGeneration
= true;
610 global
.params
.hdrdir
= arg
;
614 global
.params
.doHdrGeneration
= true;
615 global
.params
.hdrname
= arg
;
619 d_option
.multilib
= arg
;
623 d_option
.prefix
= arg
;
627 global
.params
.imppath
->push (arg
);
631 global
.params
.fileImppath
->push (arg
);
635 d_option
.deps_skip_system
= true;
639 d_option
.deps
= true;
643 d_option
.deps_skip_system
= true;
647 d_option
.deps
= true;
648 d_option
.deps_filename
= arg
;
652 /* If specified multiple times, last one wins. */
653 d_option
.deps_filename_user
= arg
;
657 d_option
.deps_phony
= true;
661 deps_add_target (arg
, true);
665 deps_add_target (arg
, false);
669 d_option
.stdinc
= false;
673 global
.params
.verbose
= value
;
678 global
.params
.warnings
= DIAGNOSTICinform
;
681 case OPT_Wdeprecated
:
682 global
.params
.useDeprecated
= value
? DIAGNOSTICinform
: DIAGNOSTICoff
;
687 global
.params
.warnings
= DIAGNOSTICerror
;
690 case OPT_Wspeculative
:
692 global
.params
.showGaggedErrors
= 1;
696 global
.params
.jsonfilename
= arg
;
700 global
.params
.doJsonGeneration
= true;
707 D_handle_option_auto (&global_options
, &global_options_set
,
709 d_option_lang_mask (), kind
,
710 loc
, handlers
, global_dc
);
715 /* Implements the lang_hooks.post_options routine for language D.
716 Deal with any options that imply the turning on/off of features.
717 FN is the main input filename passed on the command line. */
720 d_post_options (const char ** fn
)
722 /* Verify the input file name. */
723 const char *filename
= *fn
;
724 if (!filename
|| strcmp (filename
, "-") == 0)
727 /* The front end considers the first input file to be the main one. */
730 /* Release mode doesn't turn off bounds checking for safe functions. */
731 if (global
.params
.useArrayBounds
== CHECKENABLEdefault
)
733 global
.params
.useArrayBounds
= global
.params
.release
734 ? CHECKENABLEsafeonly
: CHECKENABLEon
;
737 /* Assert code is generated if unittests are being compiled also, even if
738 release mode is turned on. */
739 if (global
.params
.useAssert
== CHECKENABLEdefault
)
741 if (global
.params
.useUnitTests
|| !global
.params
.release
)
742 global
.params
.useAssert
= CHECKENABLEon
;
744 global
.params
.useAssert
= CHECKENABLEoff
;
747 /* Checks for switches without a default are turned off in release mode. */
748 if (global
.params
.useSwitchError
== CHECKENABLEdefault
)
750 global
.params
.useSwitchError
= global
.params
.release
751 ? CHECKENABLEoff
: CHECKENABLEon
;
754 /* Contracts are turned off in release mode. */
755 if (global
.params
.useInvariants
== CHECKENABLEdefault
)
757 global
.params
.useInvariants
= global
.params
.release
758 ? CHECKENABLEoff
: CHECKENABLEon
;
761 if (global
.params
.useIn
== CHECKENABLEdefault
)
763 global
.params
.useIn
= global
.params
.release
764 ? CHECKENABLEoff
: CHECKENABLEon
;
767 if (global
.params
.useOut
== CHECKENABLEdefault
)
769 global
.params
.useOut
= global
.params
.release
770 ? CHECKENABLEoff
: CHECKENABLEon
;
773 if (global
.params
.betterC
)
775 if (!global_options_set
.x_flag_moduleinfo
)
776 global
.params
.useModuleInfo
= false;
778 if (!global_options_set
.x_flag_rtti
)
779 global
.params
.useTypeInfo
= false;
781 if (!global_options_set
.x_flag_exceptions
)
782 global
.params
.useExceptions
= false;
784 global
.params
.checkAction
= CHECKACTION_C
;
787 /* Keep in sync with existing -fbounds-check flag. */
788 flag_bounds_check
= (global
.params
.useArrayBounds
== CHECKENABLEon
);
790 /* Turn off partitioning unless it was explicitly requested, as it doesn't
791 work with D exception chaining, where EH handler uses LSDA to determine
792 whether two thrown exception are in the same context. */
793 if (!global_options_set
.x_flag_reorder_blocks_and_partition
)
794 global_options
.x_flag_reorder_blocks_and_partition
= 0;
796 /* Error about use of deprecated features. */
797 if (global
.params
.useDeprecated
== DIAGNOSTICinform
798 && global
.params
.warnings
== DIAGNOSTICerror
)
799 global
.params
.useDeprecated
= DIAGNOSTICerror
;
801 /* Make -fmax-errors visible to frontend's diagnostic machinery. */
802 if (global_options_set
.x_flag_max_errors
)
803 global
.params
.errorLimit
= flag_max_errors
;
805 if (flag_excess_precision
== EXCESS_PRECISION_DEFAULT
)
806 flag_excess_precision
= EXCESS_PRECISION_STANDARD
;
808 global
.params
.symdebug
= write_symbols
!= NO_DEBUG
;
809 global
.params
.useInline
= flag_inline_functions
;
810 global
.params
.showColumns
= flag_show_column
;
812 if (global
.params
.useInline
)
813 global
.params
.hdrStripPlainFunctions
= false;
815 global
.params
.obj
= !flag_syntax_only
;
817 /* Has no effect yet. */
818 global
.params
.pic
= flag_pic
!= 0;
820 /* Add in versions given on the command line. */
821 if (global
.params
.versionids
)
823 for (size_t i
= 0; i
< global
.params
.versionids
->length
; i
++)
825 const char *s
= (*global
.params
.versionids
)[i
];
826 VersionCondition::addGlobalIdent (s
);
830 if (global
.params
.debugids
)
832 for (size_t i
= 0; i
< global
.params
.debugids
->length
; i
++)
834 const char *s
= (*global
.params
.debugids
)[i
];
835 DebugCondition::addGlobalIdent (s
);
839 if (warn_return_type
== -1)
840 warn_return_type
= 0;
845 /* Add the module M to the list of modules that may declare GCC builtins.
846 These are scanned after first semantic and before codegen passes.
847 See d_maybe_set_builtin() for the implementation. */
850 d_add_builtin_module (Module
*m
)
852 builtin_modules
.push (m
);
855 /* Record the entrypoint module ENTRY which will be compiled in the current
856 compilation. ROOT is the module scope where this was requested from. */
859 d_add_entrypoint_module (Module
*entry
, Module
*root
)
861 /* We are emitting this straight to object file. */
862 entrypoint_module
= entry
;
863 entrypoint_root_module
= root
;
866 /* Implements the lang_hooks.parse_file routine for language D. */
871 if (global
.params
.verbose
)
873 message ("binary %s", global
.params
.argv0
.ptr
);
874 message ("version %s", global
.version
.ptr
);
876 if (global
.versionids
)
879 gcc_obstack_init (&buffer
);
880 obstack_grow (&buffer
, "predefs ", 9);
881 for (size_t i
= 0; i
< global
.versionids
->length
; i
++)
883 Identifier
*id
= (*global
.versionids
)[i
];
884 const char *str
= id
->toChars ();
885 obstack_1grow (&buffer
, ' ');
886 obstack_grow (&buffer
, str
, strlen (str
));
889 message ("%s", (char *) obstack_finish (&buffer
));
893 /* Start the main input file, if the debug writer wants it. */
894 if (debug_hooks
->start_end_main_source_file
)
895 debug_hooks
->start_source_file (0, main_input_filename
);
897 /* Create Module's for all sources we will load. */
899 modules
.reserve (num_in_fnames
);
901 /* In this mode, the first file name is supposed to be a duplicate
902 of one of the input files. */
903 if (d_option
.fonly
&& strcmp (d_option
.fonly
, main_input_filename
) != 0)
904 error ("%<-fonly=%> argument is different from first input file name");
906 for (size_t i
= 0; i
< num_in_fnames
; i
++)
908 if (strcmp (in_fnames
[i
], "-") == 0)
910 /* Load the entire contents of stdin into memory. 8 kilobytes should
911 be a good enough initial size, but double on each iteration.
912 16 bytes are added for the final '\n' and 15 bytes of padding. */
913 ssize_t size
= 8 * 1024;
914 uchar
*buffer
= XNEWVEC (uchar
, size
+ 16);
918 while ((count
= read (STDIN_FILENO
, buffer
+ len
, size
- len
)) > 0)
924 buffer
= XRESIZEVEC (uchar
, buffer
, size
+ 16);
930 error (Loc ("stdin", 0, 0), "%s", xstrerror (errno
));
935 /* Handling stdin, generate a unique name for the module. */
936 Module
*m
= Module::create (in_fnames
[i
],
937 Identifier::generateId ("__stdin"),
938 global
.params
.doDocComments
,
939 global
.params
.doHdrGeneration
);
942 /* Overwrite the source file for the module, the one created by
943 Module::create would have a forced a `.d' suffix. */
944 m
->srcfile
= File::create ("<stdin>");
945 m
->srcfile
->len
= len
;
946 m
->srcfile
->buffer
= buffer
;
950 /* Handling a D source file, strip off the path and extension. */
951 const char *basename
= FileName::name (in_fnames
[i
]);
952 const char *name
= FileName::removeExt (basename
);
954 Module
*m
= Module::create (in_fnames
[i
], Identifier::idPool (name
),
955 global
.params
.doDocComments
,
956 global
.params
.doHdrGeneration
);
958 FileName::free (name
);
962 /* Read all D source files. */
963 for (size_t i
= 0; i
< modules
.length
; i
++)
965 Module
*m
= modules
[i
];
969 /* Parse all D source files. */
970 for (size_t i
= 0; i
< modules
.length
; i
++)
972 Module
*m
= modules
[i
];
974 if (global
.params
.verbose
)
975 message ("parse %s", m
->toChars ());
977 if (!Module::rootModule
)
978 Module::rootModule
= m
;
982 Compiler::loadModule (m
);
987 /* Remove M from list of modules. */
993 /* Load the module containing D main. */
994 if (global
.params
.addMain
)
996 unsigned errors
= global
.startGagging ();
997 Module
*m
= Module::load (Loc (), NULL
, Identifier::idPool ("__main"));
999 if (!global
.endGagging (errors
))
1001 m
->importedFrom
= m
;
1009 if (global
.params
.doHdrGeneration
)
1011 /* Generate 'header' import files. Since 'header' import files must be
1012 independent of command line switches and what else is imported, they
1013 are generated before any semantic analysis. */
1014 for (size_t i
= 0; i
< modules
.length
; i
++)
1016 Module
*m
= modules
[i
];
1017 if (d_option
.fonly
&& m
!= Module::rootModule
)
1020 if (global
.params
.verbose
)
1021 message ("import %s", m
->toChars ());
1030 /* Load all unconditional imports for better symbol resolving. */
1031 for (size_t i
= 0; i
< modules
.length
; i
++)
1033 Module
*m
= modules
[i
];
1035 if (global
.params
.verbose
)
1036 message ("importall %s", m
->toChars ());
1038 m
->importAll (NULL
);
1044 /* Do semantic analysis. */
1045 doing_semantic_analysis_p
= true;
1047 for (size_t i
= 0; i
< modules
.length
; i
++)
1049 Module
*m
= modules
[i
];
1051 if (global
.params
.verbose
)
1052 message ("semantic %s", m
->toChars ());
1057 /* Do deferred semantic analysis. */
1058 Module::dprogress
= 1;
1059 Module::runDeferredSemantic ();
1061 if (Module::deferred
.length
)
1063 for (size_t i
= 0; i
< Module::deferred
.length
; i
++)
1065 Dsymbol
*sd
= Module::deferred
[i
];
1066 error_at (make_location_t (sd
->loc
),
1067 "unable to resolve forward reference in definition");
1071 /* Process all built-in modules or functions now for CTFE. */
1072 while (builtin_modules
.length
!= 0)
1074 Module
*m
= builtin_modules
.pop ();
1075 d_maybe_set_builtin (m
);
1078 /* Do pass 2 semantic analysis. */
1079 for (size_t i
= 0; i
< modules
.length
; i
++)
1081 Module
*m
= modules
[i
];
1083 if (global
.params
.verbose
)
1084 message ("semantic2 %s", m
->toChars ());
1086 m
->semantic2 (NULL
);
1089 Module::runDeferredSemantic2 ();
1094 /* Do pass 3 semantic analysis. */
1095 for (size_t i
= 0; i
< modules
.length
; i
++)
1097 Module
*m
= modules
[i
];
1099 if (global
.params
.verbose
)
1100 message ("semantic3 %s", m
->toChars ());
1102 m
->semantic3 (NULL
);
1105 Module::runDeferredSemantic3 ();
1107 /* Check again, incase semantic3 pass loaded any more modules. */
1108 while (builtin_modules
.length
!= 0)
1110 Module
*m
= builtin_modules
.pop ();
1111 d_maybe_set_builtin (m
);
1114 /* Do not attempt to generate output files if errors or warnings occurred. */
1115 if (global
.errors
|| global
.warnings
)
1118 /* Generate output files. */
1119 doing_semantic_analysis_p
= false;
1121 if (Module::rootModule
)
1123 /* Declare the name of the root module as the first global name in order
1124 to make the middle-end fully deterministic. */
1126 mangleToBuffer (Module::rootModule
, &buf
);
1127 first_global_object_name
= buf
.extractChars ();
1130 /* Make dependencies. */
1136 gcc_obstack_init (&buffer
);
1138 for (size_t i
= 0; i
< modules
.length
; i
++)
1139 deps_write (modules
[i
], &buffer
);
1141 /* -MF <arg> overrides -M[M]D. */
1142 if (d_option
.deps_filename_user
)
1143 d_option
.deps_filename
= d_option
.deps_filename_user
;
1145 if (d_option
.deps_filename
)
1147 deps_stream
= fopen (d_option
.deps_filename
, "w");
1150 fatal_error (input_location
, "opening dependency file %s: %m",
1151 d_option
.deps_filename
);
1156 deps_stream
= stdout
;
1158 fprintf (deps_stream
, "%s", (char *) obstack_finish (&buffer
));
1160 if (deps_stream
!= stdout
1161 && (ferror (deps_stream
) || fclose (deps_stream
)))
1163 fatal_error (input_location
, "closing dependency file %s: %m",
1164 d_option
.deps_filename
);
1168 /* Generate JSON files. */
1169 if (global
.params
.doJsonGeneration
)
1172 json_generate (&buf
, &modules
);
1174 const char *name
= global
.params
.jsonfilename
.ptr
;
1177 if (name
&& (name
[0] != '-' || name
[1] != '\0'))
1180 = FileName::defaultExt (name
, global
.json_ext
.ptr
);
1181 json_stream
= fopen (nameext
, "w");
1184 fatal_error (input_location
, "opening json file %s: %m", nameext
);
1189 json_stream
= stdout
;
1191 fprintf (json_stream
, "%s", buf
.peekChars ());
1193 if (json_stream
!= stdout
1194 && (ferror (json_stream
) || fclose (json_stream
)))
1195 fatal_error (input_location
, "closing json file %s: %m", name
);
1198 /* Generate Ddoc files. */
1199 if (global
.params
.doDocComments
&& !global
.errors
&& !errorcount
)
1201 for (size_t i
= 0; i
< modules
.length
; i
++)
1203 Module
*m
= modules
[i
];
1208 /* Handle -fdump-d-original. */
1209 if (global
.params
.vcg_ast
)
1211 for (size_t i
= 0; i
< modules
.length
; i
++)
1213 Module
*m
= modules
[i
];
1217 moduleToBuffer (&buf
, m
);
1218 message ("%s", buf
.peekChars ());
1222 for (size_t i
= 0; i
< modules
.length
; i
++)
1224 Module
*m
= modules
[i
];
1225 if (d_option
.fonly
&& m
!= Module::rootModule
)
1228 if (global
.params
.verbose
)
1229 message ("code %s", m
->toChars ());
1231 if (!flag_syntax_only
)
1233 if ((entrypoint_module
!= NULL
) && (m
== entrypoint_root_module
))
1234 build_decl_tree (entrypoint_module
);
1236 build_decl_tree (m
);
1240 /* And end the main input file, if the debug writer wants it. */
1241 if (debug_hooks
->start_end_main_source_file
)
1242 debug_hooks
->end_source_file (0);
1245 /* Add the D frontend error count to the GCC error count to correctly
1246 exit with an error status. */
1247 errorcount
+= (global
.errors
+ global
.warnings
);
1249 /* Write out globals. */
1250 d_finish_compilation (vec_safe_address (global_declarations
),
1251 vec_safe_length (global_declarations
));
1254 /* Implements the lang_hooks.types.type_for_mode routine for language D. */
1257 d_type_for_mode (machine_mode mode
, int unsignedp
)
1260 return unsignedp
? d_ubyte_type
: d_byte_type
;
1263 return unsignedp
? d_ushort_type
: d_short_type
;
1266 return unsignedp
? d_uint_type
: d_int_type
;
1269 return unsignedp
? d_ulong_type
: d_long_type
;
1271 if (mode
== TYPE_MODE (d_cent_type
))
1272 return unsignedp
? d_ucent_type
: d_cent_type
;
1274 if (mode
== TYPE_MODE (float_type_node
))
1275 return float_type_node
;
1277 if (mode
== TYPE_MODE (double_type_node
))
1278 return double_type_node
;
1280 if (mode
== TYPE_MODE (long_double_type_node
))
1281 return long_double_type_node
;
1283 if (mode
== TYPE_MODE (build_pointer_type (char8_type_node
)))
1284 return build_pointer_type (char8_type_node
);
1286 if (mode
== TYPE_MODE (build_pointer_type (d_int_type
)))
1287 return build_pointer_type (d_int_type
);
1289 for (int i
= 0; i
< NUM_INT_N_ENTS
; i
++)
1291 if (int_n_enabled_p
[i
] && mode
== int_n_data
[i
].m
)
1294 return int_n_trees
[i
].unsigned_type
;
1296 return int_n_trees
[i
].signed_type
;
1300 if (COMPLEX_MODE_P (mode
))
1302 machine_mode inner_mode
;
1305 if (mode
== TYPE_MODE (complex_float_type_node
))
1306 return complex_float_type_node
;
1307 if (mode
== TYPE_MODE (complex_double_type_node
))
1308 return complex_double_type_node
;
1309 if (mode
== TYPE_MODE (complex_long_double_type_node
))
1310 return complex_long_double_type_node
;
1312 inner_mode
= (machine_mode
) GET_MODE_INNER (mode
);
1313 inner_type
= d_type_for_mode (inner_mode
, unsignedp
);
1314 if (inner_type
!= NULL_TREE
)
1315 return build_complex_type (inner_type
);
1317 else if (VECTOR_MODE_P (mode
))
1319 machine_mode inner_mode
= (machine_mode
) GET_MODE_INNER (mode
);
1320 tree inner_type
= d_type_for_mode (inner_mode
, unsignedp
);
1321 if (inner_type
!= NULL_TREE
)
1322 return build_vector_type_for_mode (inner_type
, mode
);
1328 /* Implements the lang_hooks.types.type_for_size routine for language D. */
1331 d_type_for_size (unsigned bits
, int unsignedp
)
1333 if (bits
<= TYPE_PRECISION (d_byte_type
))
1334 return unsignedp
? d_ubyte_type
: d_byte_type
;
1336 if (bits
<= TYPE_PRECISION (d_short_type
))
1337 return unsignedp
? d_ushort_type
: d_short_type
;
1339 if (bits
<= TYPE_PRECISION (d_int_type
))
1340 return unsignedp
? d_uint_type
: d_int_type
;
1342 if (bits
<= TYPE_PRECISION (d_long_type
))
1343 return unsignedp
? d_ulong_type
: d_long_type
;
1345 if (bits
<= TYPE_PRECISION (d_cent_type
))
1346 return unsignedp
? d_ucent_type
: d_cent_type
;
1348 for (int i
= 0; i
< NUM_INT_N_ENTS
; i
++)
1350 if (int_n_enabled_p
[i
] && bits
== int_n_data
[i
].bitsize
)
1353 return int_n_trees
[i
].unsigned_type
;
1355 return int_n_trees
[i
].signed_type
;
1362 /* Implements the lang_hooks.types.type_promotes_to routine for language D. */
1365 d_type_promotes_to (tree type
)
1367 /* Promotions are only applied on unnamed function arguments for declarations
1368 with `extern(C)' or `extern(C++)' linkage. */
1369 if (cfun
&& DECL_LANG_FRONTEND (cfun
->decl
)
1370 && DECL_LANG_FRONTEND (cfun
->decl
)->linkage
!= LINKd
)
1372 /* In [type/integer-promotions], integer promotions are conversions of the
1384 If an enum has as a base type one of the types in the left column, it
1385 is converted to the type in the right column. */
1386 if (TREE_CODE (type
) == ENUMERAL_TYPE
&& ENUM_IS_SCOPED (type
))
1387 type
= TREE_TYPE (type
);
1389 type
= TYPE_MAIN_VARIANT (type
);
1391 /* Check for promotions of target-defined types first. */
1392 tree promoted_type
= targetm
.promoted_type (type
);
1394 return promoted_type
;
1396 if (TREE_CODE (type
) == BOOLEAN_TYPE
)
1399 if (INTEGRAL_TYPE_P (type
))
1401 if (type
== d_byte_type
|| type
== d_ubyte_type
1402 || type
== d_short_type
|| type
== d_ushort_type
1403 || type
== char8_type_node
|| type
== char16_type_node
)
1406 if (type
== char32_type_node
)
1409 if (TYPE_PRECISION (type
) < TYPE_PRECISION (d_int_type
))
1413 /* Float arguments are converted to doubles. */
1414 if (type
== float_type_node
)
1415 return double_type_node
;
1417 if (type
== ifloat_type_node
)
1418 return idouble_type_node
;
1424 /* Implements the lang_hooks.decls.global_bindings_p routine for language D.
1425 Return true if we are in the global binding level. */
1428 d_global_bindings_p (void)
1430 return (current_binding_level
== global_binding_level
);
1433 /* Return global_context, but create it first if need be. */
1436 get_global_context (void)
1438 if (!global_context
)
1440 global_context
= build_translation_unit_decl (NULL_TREE
);
1441 debug_hooks
->register_main_translation_unit (global_context
);
1444 return global_context
;
1447 /* Implements the lang_hooks.decls.pushdecl routine for language D.
1448 Record DECL as belonging to the current lexical scope. */
1451 d_pushdecl (tree decl
)
1453 /* Set the context of the decl. If current_function_decl did not help in
1454 determining the context, use global scope. */
1455 if (!DECL_CONTEXT (decl
))
1457 if (current_function_decl
)
1458 DECL_CONTEXT (decl
) = current_function_decl
;
1460 DECL_CONTEXT (decl
) = get_global_context ();
1463 /* Put decls on list in reverse order. */
1464 if (TREE_STATIC (decl
) || d_global_bindings_p ())
1465 vec_safe_push (global_declarations
, decl
);
1468 TREE_CHAIN (decl
) = current_binding_level
->names
;
1469 current_binding_level
->names
= decl
;
1475 /* Implements the lang_hooks.decls.getdecls routine for language D.
1476 Return the list of declarations of the current level. */
1481 if (current_binding_level
)
1482 return current_binding_level
->names
;
1488 /* Implements the lang_hooks.get_alias_set routine for language D.
1489 Get the alias set corresponding to type or expression T.
1490 Return -1 if we don't do anything special. */
1492 static alias_set_type
1493 d_get_alias_set (tree
)
1495 /* For now in D, assume everything aliases everything else, until we define
1496 some solid rules backed by a specification. There are also some parts
1497 of code generation routines that don't adhere to C alias rules, such as
1498 build_vconvert. In any case, a lot of user code already assumes there
1499 is no strict aliasing and will break if we were to change that. */
1503 /* Implements the lang_hooks.types_compatible_p routine for language D.
1504 Compares two types for equivalence in the D programming language.
1505 This routine should only return 1 if it is sure, even though the frontend
1506 should have already ensured that all types are compatible before handing
1507 over the parsed ASTs to the code generator. */
1510 d_types_compatible_p (tree x
, tree y
)
1512 Type
*tx
= TYPE_LANG_FRONTEND (x
);
1513 Type
*ty
= TYPE_LANG_FRONTEND (y
);
1515 /* Try validating the types in the frontend. */
1516 if (tx
!= NULL
&& ty
!= NULL
)
1518 /* Types are equivalent. */
1519 if (same_type_p (tx
, ty
))
1522 /* Type system allows implicit conversion between. */
1523 if (tx
->implicitConvTo (ty
) || ty
->implicitConvTo (tx
))
1527 /* Fallback on using type flags for comparison. E.g: all dynamic arrays
1528 are distinct types in D, but are VIEW_CONVERT compatible. */
1529 if (TREE_CODE (x
) == RECORD_TYPE
&& TREE_CODE (y
) == RECORD_TYPE
)
1531 if (TYPE_DYNAMIC_ARRAY (x
) && TYPE_DYNAMIC_ARRAY (y
))
1534 if (TYPE_DELEGATE (x
) && TYPE_DELEGATE (y
))
1537 if (TYPE_ASSOCIATIVE_ARRAY (x
) && TYPE_ASSOCIATIVE_ARRAY (y
))
1544 /* Implements the lang_hooks.finish_incomplete_decl routine for language D. */
1547 d_finish_incomplete_decl (tree decl
)
1551 /* D allows zero-length declarations. Such a declaration ends up with
1552 DECL_SIZE (t) == NULL_TREE which is what the back-end function
1553 assembler_variable checks. This could change in later versions, or
1554 maybe all of these variables should be aliased to one symbol. */
1555 if (DECL_SIZE (decl
) == 0)
1557 DECL_SIZE (decl
) = bitsize_zero_node
;
1558 DECL_SIZE_UNIT (decl
) = size_zero_node
;
1563 /* Implements the lang_hooks.types.classify_record routine for language D.
1564 Return the true debug type for TYPE. */
1566 static classify_record
1567 d_classify_record (tree type
)
1569 Type
*t
= TYPE_LANG_FRONTEND (type
);
1570 TypeClass
*tc
= t
? t
->isTypeClass () : NULL
;
1574 /* extern(C++) interfaces get emitted as classes. */
1575 if (tc
->sym
->isInterfaceDeclaration ()
1576 && !tc
->sym
->isCPPinterface ())
1577 return RECORD_IS_INTERFACE
;
1579 return RECORD_IS_CLASS
;
1582 return RECORD_IS_STRUCT
;
1585 /* Implements the lang_hooks.tree_size routine for language D.
1586 Determine the size of our tcc_constant or tcc_exceptional nodes. */
1589 d_tree_size (tree_code code
)
1593 case FUNCFRAME_INFO
:
1594 return sizeof (tree_frame_info
);
1601 /* Implements the lang_hooks.print_xnode routine for language D. */
1604 d_print_xnode (FILE *file
, tree node
, int indent
)
1606 switch (TREE_CODE (node
))
1608 case FUNCFRAME_INFO
:
1609 print_node (file
, "frame_type", FRAMEINFO_TYPE (node
), indent
+ 4);
1617 /* Return which tree structure is used by NODE, or TS_D_GENERIC if NODE
1618 is one of the language-independent trees. */
1620 d_tree_node_structure_enum
1621 d_tree_node_structure (lang_tree_node
*t
)
1623 switch (TREE_CODE (&t
->generic
))
1625 case IDENTIFIER_NODE
:
1626 return TS_D_IDENTIFIER
;
1628 case FUNCFRAME_INFO
:
1629 return TS_D_FRAMEINFO
;
1632 return TS_D_GENERIC
;
1636 /* Allocate and return a lang specific structure for the frontend type. */
1639 build_lang_type (Type
*t
)
1641 struct lang_type
*lt
= ggc_cleared_alloc
<struct lang_type
> ();
1646 /* Allocate and return a lang specific structure for the frontend decl. */
1649 build_lang_decl (Declaration
*d
)
1651 /* For compiler generated run-time typeinfo, a lang_decl is allocated even if
1652 there's no associated frontend symbol to refer to (yet). If the symbol
1653 appears later in the compilation, then the slot will be re-used. */
1655 return ggc_cleared_alloc
<struct lang_decl
> ();
1657 struct lang_decl
*ld
= (d
->csym
) ? DECL_LANG_SPECIFIC (d
->csym
) : NULL
;
1659 ld
= ggc_cleared_alloc
<struct lang_decl
> ();
1661 if (ld
->decl
== NULL
)
1667 /* Implements the lang_hooks.dup_lang_specific_decl routine for language D.
1668 Replace the DECL_LANG_SPECIFIC field of NODE with a copy. */
1671 d_dup_lang_specific_decl (tree node
)
1673 if (!DECL_LANG_SPECIFIC (node
))
1676 struct lang_decl
*ld
= ggc_alloc
<struct lang_decl
> ();
1677 memcpy (ld
, DECL_LANG_SPECIFIC (node
), sizeof (struct lang_decl
));
1678 DECL_LANG_SPECIFIC (node
) = ld
;
1681 /* This preserves trees we create from the garbage collector. */
1683 static GTY(()) tree d_keep_list
= NULL_TREE
;
1688 d_keep_list
= tree_cons (NULL_TREE
, t
, d_keep_list
);
1691 /* Implements the lang_hooks.eh_personality routine for language D.
1692 Return the GDC personality function decl. */
1694 static GTY(()) tree d_eh_personality_decl
;
1697 d_eh_personality (void)
1699 if (!d_eh_personality_decl
)
1700 d_eh_personality_decl
= build_personality_function ("gdc");
1702 return d_eh_personality_decl
;
1705 /* Implements the lang_hooks.eh_runtime_type routine for language D. */
1708 d_build_eh_runtime_type (tree type
)
1710 Type
*t
= TYPE_LANG_FRONTEND (type
);
1711 gcc_assert (t
!= NULL
);
1712 t
= t
->toBasetype ();
1714 ClassDeclaration
*cd
= t
->isTypeClass ()->sym
;
1717 if (cd
->isCPPclass ())
1718 decl
= get_cpp_typeinfo_decl (cd
);
1720 decl
= get_classinfo_decl (cd
);
1722 return convert (ptr_type_node
, build_address (decl
));
1725 /* Definitions for our language-specific hooks. */
1727 #undef LANG_HOOKS_NAME
1728 #undef LANG_HOOKS_INIT
1729 #undef LANG_HOOKS_INIT_TS
1730 #undef LANG_HOOKS_INIT_OPTIONS
1731 #undef LANG_HOOKS_INIT_OPTIONS_STRUCT
1732 #undef LANG_HOOKS_OPTION_LANG_MASK
1733 #undef LANG_HOOKS_HANDLE_OPTION
1734 #undef LANG_HOOKS_POST_OPTIONS
1735 #undef LANG_HOOKS_PARSE_FILE
1736 #undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
1737 #undef LANG_HOOKS_ATTRIBUTE_TABLE
1738 #undef LANG_HOOKS_GET_ALIAS_SET
1739 #undef LANG_HOOKS_TYPES_COMPATIBLE_P
1740 #undef LANG_HOOKS_BUILTIN_FUNCTION
1741 #undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
1742 #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
1743 #undef LANG_HOOKS_GIMPLIFY_EXPR
1744 #undef LANG_HOOKS_CLASSIFY_RECORD
1745 #undef LANG_HOOKS_TREE_SIZE
1746 #undef LANG_HOOKS_PRINT_XNODE
1747 #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
1748 #undef LANG_HOOKS_EH_PERSONALITY
1749 #undef LANG_HOOKS_EH_RUNTIME_TYPE
1750 #undef LANG_HOOKS_PUSHDECL
1751 #undef LANG_HOOKS_GETDECLS
1752 #undef LANG_HOOKS_GLOBAL_BINDINGS_P
1753 #undef LANG_HOOKS_TYPE_FOR_MODE
1754 #undef LANG_HOOKS_TYPE_FOR_SIZE
1755 #undef LANG_HOOKS_TYPE_PROMOTES_TO
1757 #define LANG_HOOKS_NAME "GNU D"
1758 #define LANG_HOOKS_INIT d_init
1759 #define LANG_HOOKS_INIT_TS d_init_ts
1760 #define LANG_HOOKS_INIT_OPTIONS d_init_options
1761 #define LANG_HOOKS_INIT_OPTIONS_STRUCT d_init_options_struct
1762 #define LANG_HOOKS_OPTION_LANG_MASK d_option_lang_mask
1763 #define LANG_HOOKS_HANDLE_OPTION d_handle_option
1764 #define LANG_HOOKS_POST_OPTIONS d_post_options
1765 #define LANG_HOOKS_PARSE_FILE d_parse_file
1766 #define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE d_langhook_common_attribute_table
1767 #define LANG_HOOKS_ATTRIBUTE_TABLE d_langhook_attribute_table
1768 #define LANG_HOOKS_GET_ALIAS_SET d_get_alias_set
1769 #define LANG_HOOKS_TYPES_COMPATIBLE_P d_types_compatible_p
1770 #define LANG_HOOKS_BUILTIN_FUNCTION d_builtin_function
1771 #define LANG_HOOKS_REGISTER_BUILTIN_TYPE d_register_builtin_type
1772 #define LANG_HOOKS_FINISH_INCOMPLETE_DECL d_finish_incomplete_decl
1773 #define LANG_HOOKS_GIMPLIFY_EXPR d_gimplify_expr
1774 #define LANG_HOOKS_CLASSIFY_RECORD d_classify_record
1775 #define LANG_HOOKS_TREE_SIZE d_tree_size
1776 #define LANG_HOOKS_PRINT_XNODE d_print_xnode
1777 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL d_dup_lang_specific_decl
1778 #define LANG_HOOKS_EH_PERSONALITY d_eh_personality
1779 #define LANG_HOOKS_EH_RUNTIME_TYPE d_build_eh_runtime_type
1780 #define LANG_HOOKS_PUSHDECL d_pushdecl
1781 #define LANG_HOOKS_GETDECLS d_getdecls
1782 #define LANG_HOOKS_GLOBAL_BINDINGS_P d_global_bindings_p
1783 #define LANG_HOOKS_TYPE_FOR_MODE d_type_for_mode
1784 #define LANG_HOOKS_TYPE_FOR_SIZE d_type_for_size
1785 #define LANG_HOOKS_TYPE_PROMOTES_TO d_type_promotes_to
1787 struct lang_hooks lang_hooks
= LANG_HOOKS_INITIALIZER
;
1789 #include "gt-d-d-lang.h"
1790 #include "gtype-d.h"