Mercurial > projects > ldc
annotate dmd/module.h @ 145:8f704cb9969b trunk
[svn r150] fixes #16 and #17, implements GotoCaseStatement
author | ChristianK |
---|---|
date | Sat, 08 Mar 2008 15:22:07 +0100 |
parents | 0ab29b838084 |
children | ccd07d9f2ce9 |
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; |
139
0ab29b838084
[svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents:
130
diff
changeset
|
32 struct IrModule; |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
33 #else |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
34 #ifdef IN_GCC |
1 | 35 union tree_node; typedef union tree_node elem; |
36 #else | |
37 struct elem; | |
38 #endif | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
39 #endif |
1 | 40 |
41 struct Package : ScopeDsymbol | |
42 { | |
43 Package(Identifier *ident); | |
44 char *kind(); | |
45 | |
46 static DsymbolTable *resolve(Array *packages, Dsymbol **pparent, Package **ppkg); | |
47 | |
48 Package *isPackage() { return this; } | |
49 | |
50 virtual void semantic(Scope *sc) { } | |
51 }; | |
52 | |
53 struct Module : Package | |
54 { | |
55 static Module *rootModule; | |
56 static DsymbolTable *modules; // symbol table of all modules | |
57 static Array amodules; // array of all modules | |
58 static Array deferred; // deferred Dsymbol's needing semantic() run on them | |
59 static unsigned dprogress; // progress resolving the deferred list | |
60 static void init(); | |
61 | |
62 static ClassDeclaration *moduleinfo; | |
63 | |
64 | |
65 const char *arg; // original argument name | |
66 ModuleDeclaration *md; // if !NULL, the contents of the ModuleDeclaration declaration | |
67 File *srcfile; // input source file | |
68 File *objfile; // output .obj file | |
69 File *bcfile; // output .bc file | |
52 | 70 File *llfile; // output .ll file |
1 | 71 File *hdrfile; // 'header' file |
72 File *symfile; // output symbol file | |
73 File *docfile; // output documentation file | |
74 unsigned errors; // if any errors in file | |
75 unsigned numlines; // number of lines in source file | |
76 int isHtml; // if it is an HTML file | |
77 int isDocFile; // if it is a documentation input file, not D source | |
78 int needmoduleinfo; | |
79 #ifdef IN_GCC | |
80 int strictlyneedmoduleinfo; | |
81 #endif | |
82 | |
83 int insearch; | |
84 Identifier *searchCacheIdent; | |
85 Dsymbol *searchCacheSymbol; // cached value of search | |
86 int searchCacheFlags; // cached flags | |
87 | |
88 int semanticstarted; // has semantic() been started? | |
89 int semanticdone; // has semantic() been done? | |
90 int root; // != 0 if this is a 'root' module, | |
91 // i.e. a module that will be taken all the | |
92 // way to an object file | |
93 Module *importedFrom; // module from command line we're imported from, | |
94 // i.e. a module that will be taken all the | |
95 // way to an object file | |
96 | |
97 Array *decldefs; // top level declarations for this Module | |
98 | |
99 Array aimports; // all imported modules | |
100 | |
101 ModuleInfoDeclaration *vmoduleinfo; | |
102 | |
103 unsigned debuglevel; // debug level | |
104 Array *debugids; // debug identifiers | |
105 Array *debugidsNot; // forward referenced debug identifiers | |
106 | |
107 unsigned versionlevel; // version level | |
108 Array *versionids; // version identifiers | |
109 Array *versionidsNot; // forward referenced version identifiers | |
110 | |
111 Macro *macrotable; // document comment macros | |
112 Escape *escapetable; // document comment escapes | |
113 | |
114 Module(char *arg, Identifier *ident, int doDocComment, int doHdrGen); | |
115 ~Module(); | |
116 | |
117 static Module *load(Loc loc, Array *packages, Identifier *ident); | |
118 | |
119 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
120 char *kind(); | |
121 void setDocfile(); // set docfile member | |
122 void read(Loc loc); // read file | |
123 #if IN_GCC | |
124 void parse(bool dump_source = false); // syntactic parse | |
125 #else | |
126 void parse(); // syntactic parse | |
127 #endif | |
128 void semantic(); // semantic analysis | |
129 void semantic2(); // pass 2 semantic analysis | |
130 void semantic3(); // pass 3 semantic analysis | |
131 void inlineScan(); // scan for functions to inline | |
132 void setHdrfile(); // set hdrfile member | |
133 #ifdef _DH | |
134 void genhdrfile(); // generate D import file | |
135 #endif | |
136 void genobjfile(); | |
137 void gensymfile(); | |
138 void gendocfile(); | |
139 int needModuleInfo(); | |
140 Dsymbol *search(Loc loc, Identifier *ident, int flags); | |
141 void deleteObjFile(); | |
142 void addDeferredSemantic(Dsymbol *s); | |
143 void runDeferredSemantic(); | |
144 | |
145 // Back end | |
146 | |
147 Symbol *cov; // private uint[] __coverage; | |
148 unsigned *covb; // bit array of valid code line numbers | |
149 | |
130 | 150 Symbol *sictor; // module order independent constructor |
1 | 151 Symbol *sctor; // module constructor |
152 Symbol *sdtor; // module destructor | |
153 Symbol *stest; // module unit test | |
154 | |
155 Symbol *sfilename; // symbol for filename | |
156 | |
157 Symbol *massert; // module assert function | |
158 Symbol *toModuleAssert(); // get module assert function | |
159 | |
160 Symbol *marray; // module array bounds function | |
161 Symbol *toModuleArray(); // get module array bounds function | |
162 | |
163 | |
164 static Symbol *gencritsec(); | |
165 elem *toEfilename(); | |
166 elem *toEmodulename(); | |
167 | |
168 Symbol *toSymbol(); | |
169 void genmoduleinfo(); | |
170 | |
94
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
86
diff
changeset
|
171 // LLVMDC |
139
0ab29b838084
[svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents:
130
diff
changeset
|
172 IrModule* irModule; |
94
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
86
diff
changeset
|
173 |
1 | 174 Module *isModule() { return this; } |
175 }; | |
176 | |
177 | |
178 struct ModuleDeclaration | |
179 { | |
180 Identifier *id; | |
181 Array *packages; // array of Identifier's representing packages | |
182 | |
183 ModuleDeclaration(Array *packages, Identifier *id); | |
184 | |
185 char *toChars(); | |
186 }; | |
187 | |
188 #endif /* DMD_MODULE_H */ |