Mercurial > projects > ldc
annotate dmd/declaration.h @ 1192:3251ce06c820
Started seperating type resolution from the rest of codegen again, the merge had too many regressions.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Fri, 03 Apr 2009 16:34:11 +0200 |
parents | 3d1b16dabd25 |
children | e961851fb8be |
rev | line source |
---|---|
159 | 1 |
2 // Compiler implementation of the D programming language | |
3 // Copyright (c) 1999-2008 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_DECLARATION_H | |
12 #define DMD_DECLARATION_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
16 #endif /* __DMC__ */ | |
17 | |
18 #include <set> | |
305
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
159
diff
changeset
|
19 #include <map> |
443
44f08170f4ef
Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
378
diff
changeset
|
20 #include <string> |
159 | 21 |
22 #include "dsymbol.h" | |
23 #include "lexer.h" | |
24 #include "mtype.h" | |
25 | |
26 struct Expression; | |
27 struct Statement; | |
28 struct LabelDsymbol; | |
305
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
159
diff
changeset
|
29 struct LabelStatement; |
159 | 30 struct Initializer; |
31 struct Module; | |
32 struct InlineScanState; | |
33 struct ForeachStatement; | |
34 struct FuncDeclaration; | |
35 struct ExpInitializer; | |
36 struct StructDeclaration; | |
37 struct TupleType; | |
38 struct InterState; | |
39 struct IRState; | |
737
041c1596d217
Removed warnings on ignored aligns. Only do aligment on packed structs, align(1) struct Packed { ... }
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
732
diff
changeset
|
40 struct AnonDeclaration; |
159 | 41 |
42 enum PROT; | |
43 enum LINK; | |
44 enum TOK; | |
45 enum MATCH; | |
46 | |
47 enum STC | |
48 { | |
49 STCundefined = 0, | |
50 STCstatic = 1, | |
51 STCextern = 2, | |
52 STCconst = 4, | |
53 STCfinal = 8, | |
54 STCabstract = 0x10, | |
55 STCparameter = 0x20, | |
56 STCfield = 0x40, | |
57 STCoverride = 0x80, | |
58 STCauto = 0x100, | |
59 STCsynchronized = 0x200, | |
60 STCdeprecated = 0x400, | |
61 STCin = 0x800, // in parameter | |
62 STCout = 0x1000, // out parameter | |
63 STClazy = 0x2000, // lazy parameter | |
64 STCforeach = 0x4000, // variable for foreach loop | |
65 STCcomdat = 0x8000, // should go into COMDAT record | |
66 STCvariadic = 0x10000, // variadic function argument | |
67 STCctorinit = 0x20000, // can only be set inside constructor | |
68 STCtemplateparameter = 0x40000, // template parameter | |
69 STCscope = 0x80000, // template parameter | |
70 STCinvariant = 0x100000, | |
71 STCref = 0x200000, | |
72 STCinit = 0x400000, // has explicit initializer | |
73 STCmanifest = 0x800000, // manifest constant | |
74 STCnodtor = 0x1000000, // don't run destructor | |
75 STCnothrow = 0x2000000, // never throws exceptions | |
76 STCpure = 0x4000000, // pure function | |
77 STCtls = 0x8000000, // thread local | |
336 | 78 STCalias = 0x10000000, // alias parameter |
159 | 79 }; |
80 | |
81 struct Match | |
82 { | |
83 int count; // number of matches found | |
84 MATCH last; // match level of lastf | |
85 FuncDeclaration *lastf; // last matching function we found | |
86 FuncDeclaration *nextf; // current matching function | |
87 FuncDeclaration *anyf; // pick a func, any func, to use for error recovery | |
88 }; | |
89 | |
90 void overloadResolveX(Match *m, FuncDeclaration *f, Expressions *arguments); | |
91 int overloadApply(FuncDeclaration *fstart, | |
92 int (*fp)(void *, FuncDeclaration *), | |
93 void *param); | |
94 | |
95 /**************************************************************/ | |
96 | |
97 struct Declaration : Dsymbol | |
98 { | |
99 Type *type; | |
100 Type *originalType; // before semantic analysis | |
101 unsigned storage_class; | |
102 enum PROT protection; | |
103 enum LINK linkage; | |
104 | |
105 Declaration(Identifier *id); | |
106 void semantic(Scope *sc); | |
336 | 107 const char *kind(); |
159 | 108 unsigned size(Loc loc); |
109 void checkModify(Loc loc, Scope *sc, Type *t); | |
110 | |
111 void emitComment(Scope *sc); | |
112 void toDocBuffer(OutBuffer *buf); | |
113 | |
114 char *mangle(); | |
115 int isStatic() { return storage_class & STCstatic; } | |
116 virtual int isStaticConstructor(); | |
117 virtual int isStaticDestructor(); | |
118 virtual int isDelete(); | |
119 virtual int isDataseg(); | |
120 virtual int isCodeseg(); | |
121 int isCtorinit() { return storage_class & STCctorinit; } | |
122 int isFinal() { return storage_class & STCfinal; } | |
123 int isAbstract() { return storage_class & STCabstract; } | |
124 int isConst() { return storage_class & STCconst; } | |
125 int isInvariant() { return 0; } | |
126 int isAuto() { return storage_class & STCauto; } | |
127 int isScope() { return storage_class & (STCscope | STCauto); } | |
128 int isSynchronized() { return storage_class & STCsynchronized; } | |
129 int isParameter() { return storage_class & STCparameter; } | |
130 int isDeprecated() { return storage_class & STCdeprecated; } | |
131 int isOverride() { return storage_class & STCoverride; } | |
132 | |
133 int isIn() { return storage_class & STCin; } | |
134 int isOut() { return storage_class & STCout; } | |
135 int isRef() { return storage_class & STCref; } | |
136 | |
137 enum PROT prot(); | |
138 | |
139 Declaration *isDeclaration() { return this; } | |
140 | |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
141 #if IN_LLVM |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
142 /// Codegen traversal |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
143 virtual void codegen(Ir* ir); |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
144 #endif |
159 | 145 }; |
146 | |
147 /**************************************************************/ | |
148 | |
149 struct TupleDeclaration : Declaration | |
150 { | |
151 Objects *objects; | |
152 int isexp; // 1: expression tuple | |
153 | |
154 TypeTuple *tupletype; // !=NULL if this is a type tuple | |
155 | |
156 TupleDeclaration(Loc loc, Identifier *ident, Objects *objects); | |
157 Dsymbol *syntaxCopy(Dsymbol *); | |
336 | 158 const char *kind(); |
159 | 159 Type *getType(); |
160 int needThis(); | |
161 | |
162 TupleDeclaration *isTupleDeclaration() { return this; } | |
732
6aeaef263289
Fixed tuple fields, thanx downs
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
703
diff
changeset
|
163 |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
164 #if IN_LLVM |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
165 /// Codegen traversal |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
166 void codegen(Ir* ir); |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
167 #endif |
159 | 168 }; |
169 | |
170 /**************************************************************/ | |
171 | |
172 struct TypedefDeclaration : Declaration | |
173 { | |
174 Type *basetype; | |
175 Initializer *init; | |
176 int sem; // 0: semantic() has not been run | |
177 // 1: semantic() is in progress | |
178 // 2: semantic() has been run | |
179 // 3: semantic2() has been run | |
180 int inuse; // used to detect typedef cycles | |
181 | |
182 TypedefDeclaration(Loc loc, Identifier *ident, Type *basetype, Initializer *init); | |
183 Dsymbol *syntaxCopy(Dsymbol *); | |
184 void semantic(Scope *sc); | |
185 void semantic2(Scope *sc); | |
186 char *mangle(); | |
336 | 187 const char *kind(); |
159 | 188 Type *getType(); |
189 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
190 #ifdef _DH | |
191 Type *htype; | |
192 Type *hbasetype; | |
193 #endif | |
194 | |
195 void toDocBuffer(OutBuffer *buf); | |
196 | |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
197 #if IN_DMD |
336 | 198 void toObjFile(int multiobj); // compile to .obj file |
159 | 199 void toDebug(); |
200 int cvMember(unsigned char *p); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
201 #endif |
159 | 202 |
203 TypedefDeclaration *isTypedefDeclaration() { return this; } | |
204 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
205 #if IN_DMD |
159 | 206 Symbol *sinit; |
207 Symbol *toInitializer(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
208 #endif |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
209 |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
210 #if IN_LLVM |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
211 /// Codegen traversal |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
212 void codegen(Ir* ir); |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
213 #endif |
159 | 214 }; |
215 | |
216 /**************************************************************/ | |
217 | |
218 struct AliasDeclaration : Declaration | |
219 { | |
220 Dsymbol *aliassym; | |
221 Dsymbol *overnext; // next in overload list | |
222 int inSemantic; | |
223 | |
224 AliasDeclaration(Loc loc, Identifier *ident, Type *type); | |
225 AliasDeclaration(Loc loc, Identifier *ident, Dsymbol *s); | |
226 Dsymbol *syntaxCopy(Dsymbol *); | |
227 void semantic(Scope *sc); | |
228 int overloadInsert(Dsymbol *s); | |
336 | 229 const char *kind(); |
159 | 230 Type *getType(); |
231 Dsymbol *toAlias(); | |
232 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
233 #ifdef _DH | |
234 Type *htype; | |
235 Dsymbol *haliassym; | |
236 #endif | |
237 | |
238 void toDocBuffer(OutBuffer *buf); | |
239 | |
240 AliasDeclaration *isAliasDeclaration() { return this; } | |
241 }; | |
242 | |
243 /**************************************************************/ | |
244 | |
245 struct VarDeclaration : Declaration | |
246 { | |
247 Initializer *init; | |
248 unsigned offset; | |
249 int noauto; // no auto semantics | |
250 int nestedref; // referenced by a lexically nested function | |
251 int inuse; | |
252 int ctorinit; // it has been initialized in a ctor | |
253 int onstack; // 1: it has been allocated on the stack | |
254 // 2: on stack, run destructor anyway | |
255 int canassign; // it can be assigned to | |
256 Dsymbol *aliassym; // if redone as alias to another symbol | |
257 Expression *value; // when interpreting, this is the value | |
258 // (NULL if value not determinable) | |
259 | |
260 VarDeclaration(Loc loc, Type *t, Identifier *id, Initializer *init); | |
261 Dsymbol *syntaxCopy(Dsymbol *); | |
262 void semantic(Scope *sc); | |
263 void semantic2(Scope *sc); | |
336 | 264 const char *kind(); |
159 | 265 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
266 #ifdef _DH | |
267 Type *htype; | |
268 Initializer *hinit; | |
269 #endif | |
270 int needThis(); | |
271 int isImportedSymbol(); | |
272 int isDataseg(); | |
273 int hasPointers(); | |
274 Expression *callAutoDtor(); | |
275 ExpInitializer *getExpInitializer(); | |
276 void checkCtorConstInit(); | |
277 void checkNestedReference(Scope *sc, Loc loc); | |
278 Dsymbol *toAlias(); | |
279 | |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
280 #if IN_DMD |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
281 void toObjFile(int multiobj); // compile to .obj file |
159 | 282 Symbol *toSymbol(); |
283 int cvMember(unsigned char *p); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
284 #endif |
159 | 285 |
286 // Eliminate need for dynamic_cast | |
287 VarDeclaration *isVarDeclaration() { return (VarDeclaration *)this; } | |
737
041c1596d217
Removed warnings on ignored aligns. Only do aligment on packed structs, align(1) struct Packed { ... }
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
732
diff
changeset
|
288 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
289 #if IN_LLVM |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
290 /// Codegen traversal |
1148
3d1b16dabd25
Eliminated the need for resolve, declare, const-init and define lists to drive code generation.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1147
diff
changeset
|
291 virtual void codegen(Ir* ir); |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
292 |
737
041c1596d217
Removed warnings on ignored aligns. Only do aligment on packed structs, align(1) struct Packed { ... }
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
732
diff
changeset
|
293 // LDC |
041c1596d217
Removed warnings on ignored aligns. Only do aligment on packed structs, align(1) struct Packed { ... }
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
732
diff
changeset
|
294 AnonDeclaration* anonDecl; |
797
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
751
diff
changeset
|
295 unsigned offset2; |
920
545f54041d91
Implemented proper support for naked asm using llvm module level asm. Still not 100% complete, but already 1000 times better that what we had before. Don's BignumX86 implementation from Tango (when turned into a standalone unittest) seems to fully work with no changes, and great performance :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
913
diff
changeset
|
296 bool nakedUse; |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
297 #endif |
159 | 298 }; |
299 | |
300 /**************************************************************/ | |
301 | |
913
29c0d1194033
Fix #198 and #199 by making CTFE on static struct initializers work.
Christian Kamm <kamm incasoftware de>
parents:
846
diff
changeset
|
302 // LDC uses this to denote static struct initializers |
159 | 303 |
913
29c0d1194033
Fix #198 and #199 by making CTFE on static struct initializers work.
Christian Kamm <kamm incasoftware de>
parents:
846
diff
changeset
|
304 struct StaticStructInitDeclaration : Declaration |
159 | 305 { |
306 StructDeclaration *dsym; | |
307 | |
913
29c0d1194033
Fix #198 and #199 by making CTFE on static struct initializers work.
Christian Kamm <kamm incasoftware de>
parents:
846
diff
changeset
|
308 StaticStructInitDeclaration(Loc loc, StructDeclaration *dsym); |
159 | 309 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
310 #if IN_DMD |
159 | 311 Symbol *toSymbol(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
312 #endif |
159 | 313 |
314 // Eliminate need for dynamic_cast | |
913
29c0d1194033
Fix #198 and #199 by making CTFE on static struct initializers work.
Christian Kamm <kamm incasoftware de>
parents:
846
diff
changeset
|
315 StaticStructInitDeclaration *isStaticStructInitDeclaration() { return (StaticStructInitDeclaration *)this; } |
159 | 316 }; |
317 | |
318 struct ClassInfoDeclaration : VarDeclaration | |
319 { | |
320 ClassDeclaration *cd; | |
321 | |
322 ClassInfoDeclaration(ClassDeclaration *cd); | |
323 Dsymbol *syntaxCopy(Dsymbol *); | |
324 void semantic(Scope *sc); | |
325 | |
326 void emitComment(Scope *sc); | |
327 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
328 #if IN_DMD |
159 | 329 Symbol *toSymbol(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
330 #endif |
159 | 331 |
332 ClassInfoDeclaration* isClassInfoDeclaration() { return this; } | |
333 }; | |
334 | |
335 struct ModuleInfoDeclaration : VarDeclaration | |
336 { | |
337 Module *mod; | |
338 | |
339 ModuleInfoDeclaration(Module *mod); | |
340 Dsymbol *syntaxCopy(Dsymbol *); | |
341 void semantic(Scope *sc); | |
342 | |
343 void emitComment(Scope *sc); | |
344 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
345 #if IN_DMD |
159 | 346 Symbol *toSymbol(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
347 #endif |
159 | 348 }; |
349 | |
350 struct TypeInfoDeclaration : VarDeclaration | |
351 { | |
352 Type *tinfo; | |
353 | |
354 TypeInfoDeclaration(Type *tinfo, int internal); | |
355 Dsymbol *syntaxCopy(Dsymbol *); | |
356 void semantic(Scope *sc); | |
357 | |
358 void emitComment(Scope *sc); | |
359 | |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
360 #if IN_DMD |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
361 void toObjFile(int multiobj); // compile to .obj file |
159 | 362 Symbol *toSymbol(); |
363 virtual void toDt(dt_t **pdt); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
364 #endif |
159 | 365 |
366 virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return this; } | |
367 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
368 #if IN_LLVM |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
369 /// Codegen traversal |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
370 void codegen(Ir* ir); |
159 | 371 virtual void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
372 #endif |
159 | 373 }; |
374 | |
375 struct TypeInfoStructDeclaration : TypeInfoDeclaration | |
376 { | |
377 TypeInfoStructDeclaration(Type *tinfo); | |
378 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
379 #if IN_DMD |
159 | 380 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
381 #endif |
159 | 382 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
383 #if IN_LLVM |
159 | 384 void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
385 #endif |
159 | 386 }; |
387 | |
388 struct TypeInfoClassDeclaration : TypeInfoDeclaration | |
389 { | |
390 TypeInfoClassDeclaration(Type *tinfo); | |
391 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
392 #if IN_DMD |
159 | 393 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
394 #endif |
159 | 395 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
396 #if IN_LLVM |
159 | 397 void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
398 #endif |
159 | 399 }; |
400 | |
401 struct TypeInfoInterfaceDeclaration : TypeInfoDeclaration | |
402 { | |
403 TypeInfoInterfaceDeclaration(Type *tinfo); | |
404 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
405 #if IN_DMD |
159 | 406 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
407 #endif |
159 | 408 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
409 #if IN_LLVM |
159 | 410 void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
411 #endif |
159 | 412 }; |
413 | |
414 struct TypeInfoTypedefDeclaration : TypeInfoDeclaration | |
415 { | |
416 TypeInfoTypedefDeclaration(Type *tinfo); | |
417 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
418 #if IN_DMD |
159 | 419 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
420 #endif |
159 | 421 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
422 #if IN_LLVM |
159 | 423 void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
424 #endif |
159 | 425 }; |
426 | |
427 struct TypeInfoPointerDeclaration : TypeInfoDeclaration | |
428 { | |
429 TypeInfoPointerDeclaration(Type *tinfo); | |
430 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
431 #if IN_DMD |
159 | 432 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
433 #endif |
159 | 434 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
435 #if IN_LLVM |
159 | 436 void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
437 #endif |
159 | 438 }; |
439 | |
440 struct TypeInfoArrayDeclaration : TypeInfoDeclaration | |
441 { | |
442 TypeInfoArrayDeclaration(Type *tinfo); | |
443 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
444 #if IN_DMD |
159 | 445 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
446 #endif |
159 | 447 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
448 #if IN_LLVM |
159 | 449 void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
450 #endif |
159 | 451 }; |
452 | |
453 struct TypeInfoStaticArrayDeclaration : TypeInfoDeclaration | |
454 { | |
455 TypeInfoStaticArrayDeclaration(Type *tinfo); | |
456 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
457 #if IN_DMD |
159 | 458 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
459 #endif |
159 | 460 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
461 #if IN_LLVM |
159 | 462 void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
463 #endif |
159 | 464 }; |
465 | |
466 struct TypeInfoAssociativeArrayDeclaration : TypeInfoDeclaration | |
467 { | |
468 TypeInfoAssociativeArrayDeclaration(Type *tinfo); | |
469 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
470 #if IN_DMD |
159 | 471 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
472 #endif |
159 | 473 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
474 #if IN_LLVM |
159 | 475 void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
476 #endif |
159 | 477 }; |
478 | |
479 struct TypeInfoEnumDeclaration : TypeInfoDeclaration | |
480 { | |
481 TypeInfoEnumDeclaration(Type *tinfo); | |
482 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
483 #if IN_DMD |
159 | 484 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
485 #endif |
159 | 486 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
487 #if IN_LLVM |
159 | 488 void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
489 #endif |
159 | 490 }; |
491 | |
492 struct TypeInfoFunctionDeclaration : TypeInfoDeclaration | |
493 { | |
494 TypeInfoFunctionDeclaration(Type *tinfo); | |
495 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
496 #if IN_DMD |
159 | 497 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
498 #endif |
159 | 499 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
500 #if IN_LLVM |
159 | 501 void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
502 #endif |
159 | 503 }; |
504 | |
505 struct TypeInfoDelegateDeclaration : TypeInfoDeclaration | |
506 { | |
507 TypeInfoDelegateDeclaration(Type *tinfo); | |
508 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
509 #if IN_DMD |
159 | 510 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
511 #endif |
159 | 512 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
513 #if IN_LLVM |
159 | 514 void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
515 #endif |
159 | 516 }; |
517 | |
518 struct TypeInfoTupleDeclaration : TypeInfoDeclaration | |
519 { | |
520 TypeInfoTupleDeclaration(Type *tinfo); | |
521 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
522 #if IN_DMD |
159 | 523 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
524 #endif |
159 | 525 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
526 #if IN_LLVM |
159 | 527 void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
528 #endif |
159 | 529 }; |
530 | |
336 | 531 #if DMDV2 |
532 struct TypeInfoConstDeclaration : TypeInfoDeclaration | |
533 { | |
534 TypeInfoConstDeclaration(Type *tinfo); | |
535 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
536 #if IN_DMD |
336 | 537 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
538 #endif |
336 | 539 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
540 #if IN_LLVM |
336 | 541 void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
542 #endif |
336 | 543 }; |
544 | |
545 struct TypeInfoInvariantDeclaration : TypeInfoDeclaration | |
546 { | |
547 TypeInfoInvariantDeclaration(Type *tinfo); | |
548 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
549 #if IN_DMD |
336 | 550 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
551 #endif |
336 | 552 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
553 #if IN_LLVM |
336 | 554 void llvmDefine(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
555 #endif |
336 | 556 }; |
557 #endif | |
558 | |
559 /**************************************************************/ | |
560 | |
159 | 561 struct ThisDeclaration : VarDeclaration |
562 { | |
563 ThisDeclaration(Type *t); | |
564 Dsymbol *syntaxCopy(Dsymbol *); | |
565 }; | |
566 | |
567 enum ILS | |
568 { | |
569 ILSuninitialized, // not computed yet | |
570 ILSno, // cannot inline | |
571 ILSyes, // can inline | |
572 }; | |
573 | |
574 /**************************************************************/ | |
336 | 575 #if DMDV2 |
159 | 576 |
577 enum BUILTIN | |
578 { | |
579 BUILTINunknown = -1, // not known if this is a builtin | |
580 BUILTINnot, // this is not a builtin | |
581 BUILTINsin, // std.math.sin | |
582 BUILTINcos, // std.math.cos | |
583 BUILTINtan, // std.math.tan | |
584 BUILTINsqrt, // std.math.sqrt | |
585 BUILTINfabs, // std.math.fabs | |
586 }; | |
587 | |
588 Expression *eval_builtin(enum BUILTIN builtin, Expressions *arguments); | |
589 | |
590 #endif | |
591 | |
592 struct FuncDeclaration : Declaration | |
593 { | |
594 Array *fthrows; // Array of Type's of exceptions (not used) | |
595 Statement *frequire; | |
596 Statement *fensure; | |
597 Statement *fbody; | |
598 | |
599 Identifier *outId; // identifier for out statement | |
600 VarDeclaration *vresult; // variable corresponding to outId | |
601 LabelDsymbol *returnLabel; // where the return goes | |
602 | |
603 DsymbolTable *localsymtab; // used to prevent symbols in different | |
604 // scopes from having the same name | |
605 VarDeclaration *vthis; // 'this' parameter (member and nested) | |
606 VarDeclaration *v_arguments; // '_arguments' parameter | |
607 #if IN_GCC | |
608 VarDeclaration *v_argptr; // '_argptr' variable | |
609 #endif | |
610 Dsymbols *parameters; // Array of VarDeclaration's for parameters | |
611 DsymbolTable *labtab; // statement label symbol table | |
612 Declaration *overnext; // next in overload list | |
613 Loc endloc; // location of closing curly bracket | |
614 int vtblIndex; // for member functions, index into vtbl[] | |
615 int naked; // !=0 if naked | |
616 int inlineAsm; // !=0 if has inline assembler | |
617 ILS inlineStatus; | |
618 int inlineNest; // !=0 if nested inline | |
619 int cantInterpret; // !=0 if cannot interpret function | |
620 int semanticRun; // !=0 if semantic3() had been run | |
621 // this function's frame ptr | |
622 ForeachStatement *fes; // if foreach body, this is the foreach | |
623 int introducing; // !=0 if 'introducing' function | |
624 Type *tintro; // if !=NULL, then this is the type | |
625 // of the 'introducing' function | |
626 // this one is overriding | |
627 int inferRetType; // !=0 if return type is to be inferred | |
628 Scope *scope; // !=NULL means context to use | |
629 | |
630 // Things that should really go into Scope | |
631 int hasReturnExp; // 1 if there's a return exp; statement | |
632 // 2 if there's a throw statement | |
633 // 4 if there's an assert(0) | |
634 // 8 if there's inline asm | |
635 | |
636 // Support for NRVO (named return value optimization) | |
637 int nrvo_can; // !=0 means we can do it | |
638 VarDeclaration *nrvo_var; // variable to replace with shidden | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
639 #if IN_DMD |
159 | 640 Symbol *shidden; // hidden pointer passed to function |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
641 #endif |
159 | 642 |
336 | 643 #if DMDV2 |
159 | 644 enum BUILTIN builtin; // set if this is a known, builtin |
645 // function we can evaluate at compile | |
646 // time | |
647 | |
648 int tookAddressOf; // set if someone took the address of | |
649 // this function | |
650 Dsymbols closureVars; // local variables in this function | |
651 // which are referenced by nested | |
652 // functions | |
653 #else | |
654 int nestedFrameRef; // !=0 if nested variables referenced | |
655 #endif | |
656 | |
657 FuncDeclaration(Loc loc, Loc endloc, Identifier *id, enum STC storage_class, Type *type); | |
658 Dsymbol *syntaxCopy(Dsymbol *); | |
659 void semantic(Scope *sc); | |
660 void semantic2(Scope *sc); | |
661 void semantic3(Scope *sc); | |
662 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
663 void bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
664 int overrides(FuncDeclaration *fd); | |
665 int findVtblIndex(Array *vtbl, int dim); | |
666 int overloadInsert(Dsymbol *s); | |
667 FuncDeclaration *overloadExactMatch(Type *t); | |
668 FuncDeclaration *overloadResolve(Loc loc, Expressions *arguments); | |
669 LabelDsymbol *searchLabel(Identifier *ident); | |
670 AggregateDeclaration *isThis(); | |
671 AggregateDeclaration *isMember2(); | |
672 int getLevel(Loc loc, FuncDeclaration *fd); // lexical nesting level difference | |
673 void appendExp(Expression *e); | |
674 void appendState(Statement *s); | |
675 char *mangle(); | |
676 int isMain(); | |
677 int isWinMain(); | |
678 int isDllMain(); | |
679 int isExport(); | |
680 int isImportedSymbol(); | |
681 int isAbstract(); | |
682 int isCodeseg(); | |
683 virtual int isNested(); | |
684 int needThis(); | |
685 virtual int isVirtual(); | |
846
bc982f1ad106
Merged DMD 1.037 frontend
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
797
diff
changeset
|
686 virtual int isFinal(); |
159 | 687 virtual int addPreInvariant(); |
688 virtual int addPostInvariant(); | |
689 Expression *interpret(InterState *istate, Expressions *arguments); | |
690 void inlineScan(); | |
691 int canInline(int hasthis, int hdrscan = 0); | |
692 Expression *doInline(InlineScanState *iss, Expression *ethis, Array *arguments); | |
336 | 693 const char *kind(); |
159 | 694 void toDocBuffer(OutBuffer *buf); |
695 | |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
696 // LDC: give argument types to runtime functions |
1133
eeb8b95ea92e
Cleanup DMD 1.041 merge.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
945
diff
changeset
|
697 static FuncDeclaration *genCfunc(Arguments *args, Type *treturn, const char *name); |
378
d8234836b40f
Get rid of runTimeHack and instead add proper argument info to the frontend
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
698 static FuncDeclaration *genCfunc(Arguments *args, Type *treturn, Identifier *id); |
159 | 699 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
700 #if IN_DMD |
159 | 701 Symbol *toSymbol(); |
702 Symbol *toThunkSymbol(int offset); // thunk version | |
336 | 703 void toObjFile(int multiobj); // compile to .obj file |
159 | 704 int cvMember(unsigned char *p); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
705 #endif |
159 | 706 |
707 FuncDeclaration *isFuncDeclaration() { return this; } | |
708 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
709 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
710 // LDC stuff |
639
8aebdf56c455
Move check for access of context for nested class from backend into frontend.
Christian Kamm <kamm incasoftware de>
parents:
468
diff
changeset
|
711 |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
712 /// Codegen traversal |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
713 void codegen(Ir* ir); |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
714 |
639
8aebdf56c455
Move check for access of context for nested class from backend into frontend.
Christian Kamm <kamm incasoftware de>
parents:
468
diff
changeset
|
715 // vars declared in this function that nested funcs reference |
8aebdf56c455
Move check for access of context for nested class from backend into frontend.
Christian Kamm <kamm incasoftware de>
parents:
468
diff
changeset
|
716 // is this is not empty, nestedFrameRef is set and these VarDecls |
8aebdf56c455
Move check for access of context for nested class from backend into frontend.
Christian Kamm <kamm incasoftware de>
parents:
468
diff
changeset
|
717 // probably have nestedref set too, see VarDeclaration::checkNestedReference |
159 | 718 std::set<VarDeclaration*> nestedVars; |
639
8aebdf56c455
Move check for access of context for nested class from backend into frontend.
Christian Kamm <kamm incasoftware de>
parents:
468
diff
changeset
|
719 |
443
44f08170f4ef
Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
378
diff
changeset
|
720 std::string intrinsicName; |
305
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
159
diff
changeset
|
721 |
445
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
443
diff
changeset
|
722 bool isIntrinsic(); |
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
443
diff
changeset
|
723 bool isVaIntrinsic(); |
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
443
diff
changeset
|
724 |
305
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
159
diff
changeset
|
725 // we keep our own table of label statements as LabelDsymbolS |
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
159
diff
changeset
|
726 // don't always carry their corresponding statement along ... |
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
159
diff
changeset
|
727 typedef std::map<const char*, LabelStatement*> LabelMap; |
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
159
diff
changeset
|
728 LabelMap labmap; |
703
06576ece1a1b
Changed premake.lua to work with mingw.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
729 |
06576ece1a1b
Changed premake.lua to work with mingw.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
730 // if this is an array operation it gets a little special attention |
06576ece1a1b
Changed premake.lua to work with mingw.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
731 bool isArrayOp; |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
920
diff
changeset
|
732 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
920
diff
changeset
|
733 // true if overridden with the pragma(allow_inline); stmt |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
920
diff
changeset
|
734 bool allowInlining; |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
735 #endif |
159 | 736 }; |
737 | |
738 struct FuncAliasDeclaration : FuncDeclaration | |
739 { | |
740 FuncDeclaration *funcalias; | |
741 | |
742 FuncAliasDeclaration(FuncDeclaration *funcalias); | |
743 | |
744 FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } | |
336 | 745 const char *kind(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
746 #if IN_DMD |
159 | 747 Symbol *toSymbol(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
748 #endif |
159 | 749 }; |
750 | |
751 struct FuncLiteralDeclaration : FuncDeclaration | |
752 { | |
753 enum TOK tok; // TOKfunction or TOKdelegate | |
754 | |
755 FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, enum TOK tok, | |
756 ForeachStatement *fes); | |
757 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
758 Dsymbol *syntaxCopy(Dsymbol *); | |
759 int isNested(); | |
336 | 760 int isVirtual(); |
159 | 761 |
762 FuncLiteralDeclaration *isFuncLiteralDeclaration() { return this; } | |
336 | 763 const char *kind(); |
159 | 764 }; |
765 | |
766 struct CtorDeclaration : FuncDeclaration | |
767 { Arguments *arguments; | |
768 int varargs; | |
769 | |
770 CtorDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
771 Dsymbol *syntaxCopy(Dsymbol *); | |
772 void semantic(Scope *sc); | |
773 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
336 | 774 const char *kind(); |
159 | 775 char *toChars(); |
776 int isVirtual(); | |
777 int addPreInvariant(); | |
778 int addPostInvariant(); | |
779 void toDocBuffer(OutBuffer *buf); | |
780 | |
781 CtorDeclaration *isCtorDeclaration() { return this; } | |
782 }; | |
783 | |
336 | 784 #if DMDV2 |
785 struct PostBlitDeclaration : FuncDeclaration | |
786 { | |
787 PostBlitDeclaration(Loc loc, Loc endloc); | |
788 PostBlitDeclaration(Loc loc, Loc endloc, Identifier *id); | |
789 Dsymbol *syntaxCopy(Dsymbol *); | |
790 void semantic(Scope *sc); | |
791 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
792 int isVirtual(); | |
793 int addPreInvariant(); | |
794 int addPostInvariant(); | |
795 int overloadInsert(Dsymbol *s); | |
796 void emitComment(Scope *sc); | |
797 | |
798 PostBlitDeclaration *isPostBlitDeclaration() { return this; } | |
799 }; | |
800 #endif | |
801 | |
159 | 802 struct DtorDeclaration : FuncDeclaration |
803 { | |
804 DtorDeclaration(Loc loc, Loc endloc); | |
805 DtorDeclaration(Loc loc, Loc endloc, Identifier *id); | |
806 Dsymbol *syntaxCopy(Dsymbol *); | |
807 void semantic(Scope *sc); | |
808 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
809 int isVirtual(); | |
810 int addPreInvariant(); | |
811 int addPostInvariant(); | |
812 int overloadInsert(Dsymbol *s); | |
813 void emitComment(Scope *sc); | |
814 | |
815 DtorDeclaration *isDtorDeclaration() { return this; } | |
816 }; | |
817 | |
818 struct StaticCtorDeclaration : FuncDeclaration | |
819 { | |
820 StaticCtorDeclaration(Loc loc, Loc endloc); | |
821 Dsymbol *syntaxCopy(Dsymbol *); | |
822 void semantic(Scope *sc); | |
823 AggregateDeclaration *isThis(); | |
824 int isStaticConstructor(); | |
825 int isVirtual(); | |
826 int addPreInvariant(); | |
827 int addPostInvariant(); | |
828 void emitComment(Scope *sc); | |
829 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
830 | |
831 StaticCtorDeclaration *isStaticCtorDeclaration() { return this; } | |
832 }; | |
833 | |
834 struct StaticDtorDeclaration : FuncDeclaration | |
336 | 835 { VarDeclaration *vgate; // 'gate' variable |
836 | |
159 | 837 StaticDtorDeclaration(Loc loc, Loc endloc); |
838 Dsymbol *syntaxCopy(Dsymbol *); | |
839 void semantic(Scope *sc); | |
840 AggregateDeclaration *isThis(); | |
841 int isStaticDestructor(); | |
842 int isVirtual(); | |
843 int addPreInvariant(); | |
844 int addPostInvariant(); | |
845 void emitComment(Scope *sc); | |
846 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
847 | |
848 StaticDtorDeclaration *isStaticDtorDeclaration() { return this; } | |
849 }; | |
850 | |
851 struct InvariantDeclaration : FuncDeclaration | |
852 { | |
853 InvariantDeclaration(Loc loc, Loc endloc); | |
854 Dsymbol *syntaxCopy(Dsymbol *); | |
855 void semantic(Scope *sc); | |
856 int isVirtual(); | |
857 int addPreInvariant(); | |
858 int addPostInvariant(); | |
859 void emitComment(Scope *sc); | |
860 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
861 | |
862 InvariantDeclaration *isInvariantDeclaration() { return this; } | |
863 }; | |
864 | |
865 | |
866 struct UnitTestDeclaration : FuncDeclaration | |
867 { | |
868 UnitTestDeclaration(Loc loc, Loc endloc); | |
869 Dsymbol *syntaxCopy(Dsymbol *); | |
870 void semantic(Scope *sc); | |
871 AggregateDeclaration *isThis(); | |
872 int isVirtual(); | |
873 int addPreInvariant(); | |
874 int addPostInvariant(); | |
875 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
876 | |
877 UnitTestDeclaration *isUnitTestDeclaration() { return this; } | |
878 }; | |
879 | |
880 struct NewDeclaration : FuncDeclaration | |
881 { Arguments *arguments; | |
882 int varargs; | |
883 | |
884 NewDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
885 Dsymbol *syntaxCopy(Dsymbol *); | |
886 void semantic(Scope *sc); | |
887 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
336 | 888 const char *kind(); |
159 | 889 int isVirtual(); |
890 int addPreInvariant(); | |
891 int addPostInvariant(); | |
892 | |
893 NewDeclaration *isNewDeclaration() { return this; } | |
894 }; | |
895 | |
896 | |
897 struct DeleteDeclaration : FuncDeclaration | |
898 { Arguments *arguments; | |
899 | |
900 DeleteDeclaration(Loc loc, Loc endloc, Arguments *arguments); | |
901 Dsymbol *syntaxCopy(Dsymbol *); | |
902 void semantic(Scope *sc); | |
903 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
336 | 904 const char *kind(); |
159 | 905 int isDelete(); |
906 int isVirtual(); | |
907 int addPreInvariant(); | |
908 int addPostInvariant(); | |
909 #ifdef _DH | |
910 DeleteDeclaration *isDeleteDeclaration() { return this; } | |
911 #endif | |
912 }; | |
913 | |
914 #endif /* DMD_DECLARATION_H */ |