Mercurial > projects > ldc
annotate dmd/module.h @ 209:c4c9b4ac021b trunk
[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
author | lindquist |
---|---|
date | Wed, 14 May 2008 01:22:40 +0200 |
parents | ccd07d9f2ce9 |
children | aaade6ded589 |
rev | line source |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | |
3 // Copyright (c) 1999-2005 by Digital Mars | |
4 // All Rights Reserved | |
5 // written by Walter Bright | |
6 // http://www.digitalmars.com | |
7 // License for redistribution is by either the Artistic License | |
8 // in artistic.txt, or the GNU General Public License in gnu.txt. | |
9 // See the included readme.txt for details. | |
10 | |
11 #ifndef DMD_MODULE_H | |
12 #define DMD_MODULE_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
16 #endif /* __DMC__ */ | |
17 | |
18 #include "root.h" | |
19 #include "dsymbol.h" | |
20 | |
21 struct ModuleInfoDeclaration; | |
22 struct ClassDeclaration; | |
23 struct ModuleDeclaration; | |
24 struct Macro; | |
25 struct Escape; | |
26 struct VarDeclaration; | |
27 | |
28 // Back end | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
29 #if IN_LLVM |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
30 struct DValue; |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
31 typedef DValue elem; |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
32 #else |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
33 #ifdef IN_GCC |
1 | 34 union tree_node; typedef union tree_node elem; |
35 #else | |
36 struct elem; | |
37 #endif | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
38 #endif |
1 | 39 |
40 struct Package : ScopeDsymbol | |
41 { | |
42 Package(Identifier *ident); | |
43 char *kind(); | |
44 | |
45 static DsymbolTable *resolve(Array *packages, Dsymbol **pparent, Package **ppkg); | |
46 | |
47 Package *isPackage() { return this; } | |
48 | |
49 virtual void semantic(Scope *sc) { } | |
50 }; | |
51 | |
52 struct Module : Package | |
53 { | |
54 static Module *rootModule; | |
55 static DsymbolTable *modules; // symbol table of all modules | |
56 static Array amodules; // array of all modules | |
57 static Array deferred; // deferred Dsymbol's needing semantic() run on them | |
58 static unsigned dprogress; // progress resolving the deferred list | |
59 static void init(); | |
60 | |
61 static ClassDeclaration *moduleinfo; | |
62 | |
63 | |
64 const char *arg; // original argument name | |
65 ModuleDeclaration *md; // if !NULL, the contents of the ModuleDeclaration declaration | |
66 File *srcfile; // input source file | |
67 File *objfile; // output .obj file | |
68 File *bcfile; // output .bc file | |
52 | 69 File *llfile; // output .ll file |
1 | 70 File *hdrfile; // 'header' file |
71 File *symfile; // output symbol file | |
72 File *docfile; // output documentation file | |
73 unsigned errors; // if any errors in file | |
74 unsigned numlines; // number of lines in source file | |
75 int isHtml; // if it is an HTML file | |
76 int isDocFile; // if it is a documentation input file, not D source | |
77 int needmoduleinfo; | |
78 #ifdef IN_GCC | |
79 int strictlyneedmoduleinfo; | |
80 #endif | |
81 | |
82 int insearch; | |
83 Identifier *searchCacheIdent; | |
84 Dsymbol *searchCacheSymbol; // cached value of search | |
85 int searchCacheFlags; // cached flags | |
86 | |
87 int semanticstarted; // has semantic() been started? | |
88 int semanticdone; // has semantic() been done? | |
89 int root; // != 0 if this is a 'root' module, | |
90 // i.e. a module that will be taken all the | |
91 // way to an object file | |
92 Module *importedFrom; // module from command line we're imported from, | |
93 // i.e. a module that will be taken all the | |
94 // way to an object file | |
95 | |
96 Array *decldefs; // top level declarations for this Module | |
97 | |
98 Array aimports; // all imported modules | |
99 | |
100 ModuleInfoDeclaration *vmoduleinfo; | |
101 | |
102 unsigned debuglevel; // debug level | |
103 Array *debugids; // debug identifiers | |
104 Array *debugidsNot; // forward referenced debug identifiers | |
105 | |
106 unsigned versionlevel; // version level | |
107 Array *versionids; // version identifiers | |
108 Array *versionidsNot; // forward referenced version identifiers | |
109 | |
110 Macro *macrotable; // document comment macros | |
111 Escape *escapetable; // document comment escapes | |
112 | |
113 Module(char *arg, Identifier *ident, int doDocComment, int doHdrGen); | |
114 ~Module(); | |
115 | |
116 static Module *load(Loc loc, Array *packages, Identifier *ident); | |
117 | |
118 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
119 char *kind(); | |
120 void setDocfile(); // set docfile member | |
121 void read(Loc loc); // read file | |
122 #if IN_GCC | |
123 void parse(bool dump_source = false); // syntactic parse | |
124 #else | |
125 void parse(); // syntactic parse | |
126 #endif | |
127 void semantic(); // semantic analysis | |
128 void semantic2(); // pass 2 semantic analysis | |
129 void semantic3(); // pass 3 semantic analysis | |
130 void inlineScan(); // scan for functions to inline | |
131 void setHdrfile(); // set hdrfile member | |
132 #ifdef _DH | |
133 void genhdrfile(); // generate D import file | |
134 #endif | |
135 void genobjfile(); | |
136 void gensymfile(); | |
137 void gendocfile(); | |
138 int needModuleInfo(); | |
139 Dsymbol *search(Loc loc, Identifier *ident, int flags); | |
140 void deleteObjFile(); | |
141 void addDeferredSemantic(Dsymbol *s); | |
142 void runDeferredSemantic(); | |
143 | |
144 // Back end | |
145 | |
146 Symbol *cov; // private uint[] __coverage; | |
147 unsigned *covb; // bit array of valid code line numbers | |
148 | |
130 | 149 Symbol *sictor; // module order independent constructor |
1 | 150 Symbol *sctor; // module constructor |
151 Symbol *sdtor; // module destructor | |
152 Symbol *stest; // module unit test | |
153 | |
154 Symbol *sfilename; // symbol for filename | |
155 | |
156 Symbol *massert; // module assert function | |
157 Symbol *toModuleAssert(); // get module assert function | |
158 | |
159 Symbol *marray; // module array bounds function | |
160 Symbol *toModuleArray(); // get module array bounds function | |
161 | |
162 | |
163 static Symbol *gencritsec(); | |
164 elem *toEfilename(); | |
165 elem *toEmodulename(); | |
166 | |
167 Symbol *toSymbol(); | |
168 void genmoduleinfo(); | |
169 | |
94
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
86
diff
changeset
|
170 // LLVMDC |
1 | 171 Module *isModule() { return this; } |
172 }; | |
173 | |
174 | |
175 struct ModuleDeclaration | |
176 { | |
177 Identifier *id; | |
178 Array *packages; // array of Identifier's representing packages | |
179 | |
180 ModuleDeclaration(Array *packages, Identifier *id); | |
181 | |
182 char *toChars(); | |
183 }; | |
184 | |
185 #endif /* DMD_MODULE_H */ |