Debian Codegraph @

gcc/d/dmd/compiler.d

raw
1 /**
2 * Describes a back-end compiler and implements compiler-specific actions.
3 *
4 * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved
5 * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
6 * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
7 * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/compiler.d, _compiler.d)
8 * Documentation: https://dlang.org/phobos/dmd_compiler.html
9 * Coverage: https://codecov.io/gh/dlang/dmd/src/master/compiler/src/dmd/compiler.d
10 */
11
12 module dmd.compiler;
13
14 import dmd.arraytypes;
15 import dmd.ctfeexpr;
16 import dmd.dmodule;
17 import dmd.expression;
18 import dmd.mtype;
19 import dmd.typesem;
20 import dmd.root.array;
21
22 extern (C++) __gshared
23 {
24 bool includeImports = false;
25 // array of module patterns used to include/exclude imported modules
26 Array!(const(char)*) includeModulePatterns;
27 Modules compiledImports;
28 }
29
30
31 /**
32 * A data structure that describes a back-end compiler and implements
33 * compiler-specific actions.
34 */
35 extern (C++) struct Compiler
36 {
37 /******************************
38 * Encode the given expression, which is assumed to be an rvalue literal
39 * as another type for use in CTFE.
40 * This corresponds roughly to the idiom *(Type *)&e.
41 */
42 extern (C++) static Expression paintAsType(UnionExp* pue, Expression e, Type type);
43
44 /******************************
45 * For the given module, perform any post parsing analysis.
46 * Certain compiler backends (ie: GDC) have special placeholder
47 * modules whose source are empty, but code gets injected
48 * immediately after loading.
49 */
50 extern (C++) static void onParseModule(Module m);
51
52 /**
53 * A callback function that is called once an imported module is
54 * parsed. If the callback returns true, then it tells the
55 * frontend that the driver intends on compiling the import.
56 */
57 extern (C++) static bool onImport(Module m);
58 }