Mercurial > projects > ldc
annotate dmd/declaration.h @ 100:5071469303d4 trunk
[svn r104] TONS OF FIXES.
Split up declaration, constant initializer gen and definition for globals, structs, classes and functions.
Improved ClassInfo support (not complete), not in vtable yet.
Fixed a bunch of forward reference problems.
Much more. Major commit! :)
author | lindquist |
---|---|
date | Fri, 16 Nov 2007 08:21:47 +0100 |
parents | 70d6113eeb8c |
children | 5b5194b25f33 |
rev | line source |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | |
3 // Copyright (c) 1999-2007 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 | |
50
6fcc08a4d406
[svn r54] Added support for nested delegates referencing parent's stack variables.
lindquist
parents:
40
diff
changeset
|
18 #include <set> |
6fcc08a4d406
[svn r54] Added support for nested delegates referencing parent's stack variables.
lindquist
parents:
40
diff
changeset
|
19 |
1 | 20 #include "dsymbol.h" |
21 #include "lexer.h" | |
22 #include "mtype.h" | |
23 | |
24 namespace llvm { | |
25 class Value; | |
26 } | |
100 | 27 struct IRFunction; |
28 struct IRGlobal; | |
1 | 29 |
30 struct Expression; | |
31 struct Statement; | |
32 struct LabelDsymbol; | |
33 struct Initializer; | |
34 struct Module; | |
35 struct InlineScanState; | |
36 struct ForeachStatement; | |
37 struct FuncDeclaration; | |
38 struct ExpInitializer; | |
39 struct StructDeclaration; | |
40 struct TupleType; | |
41 struct InterState; | |
42 | |
43 enum PROT; | |
44 enum LINK; | |
45 enum TOK; | |
46 enum MATCH; | |
47 | |
48 enum STC | |
49 { | |
50 STCundefined = 0, | |
51 STCstatic = 1, | |
52 STCextern = 2, | |
53 STCconst = 4, | |
54 STCfinal = 8, | |
55 STCabstract = 0x10, | |
56 STCparameter = 0x20, | |
57 STCfield = 0x40, | |
58 STCoverride = 0x80, | |
59 STCauto = 0x100, | |
60 STCsynchronized = 0x200, | |
61 STCdeprecated = 0x400, | |
62 STCin = 0x800, // in parameter | |
63 STCout = 0x1000, // out parameter | |
64 STClazy = 0x2000, // lazy parameter | |
65 STCforeach = 0x4000, // variable for foreach loop | |
66 STCcomdat = 0x8000, // should go into COMDAT record | |
67 STCvariadic = 0x10000, // variadic function argument | |
68 STCctorinit = 0x20000, // can only be set inside constructor | |
69 STCtemplateparameter = 0x40000, // template parameter | |
70 STCscope = 0x80000, // template parameter | |
71 STCinvariant = 0x100000, | |
72 STCref = 0x200000, | |
73 }; | |
74 | |
75 struct Match | |
76 { | |
77 int count; // number of matches found | |
78 MATCH last; // match level of lastf | |
79 FuncDeclaration *lastf; // last matching function we found | |
80 FuncDeclaration *nextf; // current matching function | |
81 FuncDeclaration *anyf; // pick a func, any func, to use for error recovery | |
82 }; | |
83 | |
84 void overloadResolveX(Match *m, FuncDeclaration *f, Expressions *arguments); | |
85 int overloadApply(FuncDeclaration *fstart, | |
86 int (*fp)(void *, FuncDeclaration *), | |
87 void *param); | |
88 | |
89 /**************************************************************/ | |
90 | |
91 struct Declaration : Dsymbol | |
92 { | |
93 Type *type; | |
94 unsigned storage_class; | |
95 enum PROT protection; | |
96 enum LINK linkage; | |
97 | |
98 Declaration(Identifier *id); | |
99 void semantic(Scope *sc); | |
100 char *kind(); | |
101 unsigned size(Loc loc); | |
102 | |
103 void emitComment(Scope *sc); | |
104 void toDocBuffer(OutBuffer *buf); | |
105 | |
106 char *mangle(); | |
107 int isStatic() { return storage_class & STCstatic; } | |
108 virtual int isStaticConstructor(); | |
109 virtual int isStaticDestructor(); | |
110 virtual int isDelete(); | |
111 virtual int isDataseg(); | |
112 virtual int isCodeseg(); | |
113 int isCtorinit() { return storage_class & STCctorinit; } | |
114 int isFinal() { return storage_class & STCfinal; } | |
115 int isAbstract() { return storage_class & STCabstract; } | |
116 int isConst() { return storage_class & STCconst; } | |
117 int isAuto() { return storage_class & STCauto; } | |
118 int isScope() { return storage_class & (STCscope | STCauto); } | |
119 int isSynchronized() { return storage_class & STCsynchronized; } | |
120 int isParameter() { return storage_class & STCparameter; } | |
121 int isDeprecated() { return storage_class & STCdeprecated; } | |
122 int isOverride() { return storage_class & STCoverride; } | |
123 | |
124 int isIn() { return storage_class & STCin; } | |
125 int isOut() { return storage_class & STCout; } | |
126 int isRef() { return storage_class & STCref; } | |
127 | |
128 enum PROT prot(); | |
129 | |
130 Declaration *isDeclaration() { return this; } | |
131 | |
50
6fcc08a4d406
[svn r54] Added support for nested delegates referencing parent's stack variables.
lindquist
parents:
40
diff
changeset
|
132 virtual void toObjFile(); // compile to .obj file |
1 | 133 }; |
134 | |
135 /**************************************************************/ | |
136 | |
137 struct TupleDeclaration : Declaration | |
138 { | |
139 Objects *objects; | |
140 int isexp; // 1: expression tuple | |
141 | |
142 TypeTuple *tupletype; // !=NULL if this is a type tuple | |
143 | |
144 TupleDeclaration(Loc loc, Identifier *ident, Objects *objects); | |
145 Dsymbol *syntaxCopy(Dsymbol *); | |
146 char *kind(); | |
147 Type *getType(); | |
148 int needThis(); | |
149 | |
150 TupleDeclaration *isTupleDeclaration() { return this; } | |
151 }; | |
152 | |
153 /**************************************************************/ | |
154 | |
155 struct TypedefDeclaration : Declaration | |
156 { | |
157 Type *basetype; | |
158 Initializer *init; | |
159 int sem; // 0: semantic() has not been run | |
160 // 1: semantic() is in progress | |
161 // 2: semantic() has been run | |
162 // 3: semantic2() has been run | |
163 int inuse; // used to detect typedef cycles | |
164 | |
165 TypedefDeclaration(Loc loc, Identifier *ident, Type *basetype, Initializer *init); | |
166 Dsymbol *syntaxCopy(Dsymbol *); | |
167 void semantic(Scope *sc); | |
168 void semantic2(Scope *sc); | |
169 char *mangle(); | |
170 char *kind(); | |
171 Type *getType(); | |
172 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
173 #ifdef _DH | |
174 Type *htype; | |
175 Type *hbasetype; | |
176 #endif | |
177 | |
178 void toDocBuffer(OutBuffer *buf); | |
179 | |
180 void toObjFile(); // compile to .obj file | |
181 void toDebug(); | |
182 int cvMember(unsigned char *p); | |
183 | |
184 TypedefDeclaration *isTypedefDeclaration() { return this; } | |
185 | |
186 Symbol *sinit; | |
187 Symbol *toInitializer(); | |
188 }; | |
189 | |
190 /**************************************************************/ | |
191 | |
192 struct AliasDeclaration : Declaration | |
193 { | |
194 Dsymbol *aliassym; | |
195 Dsymbol *overnext; // next in overload list | |
196 int inSemantic; | |
197 | |
198 AliasDeclaration(Loc loc, Identifier *ident, Type *type); | |
199 AliasDeclaration(Loc loc, Identifier *ident, Dsymbol *s); | |
200 Dsymbol *syntaxCopy(Dsymbol *); | |
201 void semantic(Scope *sc); | |
202 int overloadInsert(Dsymbol *s); | |
203 char *kind(); | |
204 Type *getType(); | |
205 Dsymbol *toAlias(); | |
206 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
207 #ifdef _DH | |
208 Type *htype; | |
209 Dsymbol *haliassym; | |
210 #endif | |
211 | |
212 void toDocBuffer(OutBuffer *buf); | |
213 | |
214 AliasDeclaration *isAliasDeclaration() { return this; } | |
215 }; | |
216 | |
217 /**************************************************************/ | |
218 | |
219 struct VarDeclaration : Declaration | |
220 { | |
221 Initializer *init; | |
222 unsigned offset; | |
223 int noauto; // no auto semantics | |
224 int nestedref; // referenced by a lexically nested function | |
225 int inuse; | |
226 int ctorinit; // it has been initialized in a ctor | |
227 int onstack; // 1: it has been allocated on the stack | |
228 // 2: on stack, run destructor anyway | |
229 int canassign; // it can be assigned to | |
230 Dsymbol *aliassym; // if redone as alias to another symbol | |
231 Expression *value; // when interpreting, this is the value | |
232 // (NULL if value not determinable) | |
233 | |
234 VarDeclaration(Loc loc, Type *t, Identifier *id, Initializer *init); | |
235 Dsymbol *syntaxCopy(Dsymbol *); | |
236 void semantic(Scope *sc); | |
237 void semantic2(Scope *sc); | |
238 char *kind(); | |
239 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
240 #ifdef _DH | |
241 Type *htype; | |
242 Initializer *hinit; | |
243 #endif | |
244 int needThis(); | |
245 int isImportedSymbol(); | |
246 int isDataseg(); | |
247 int hasPointers(); | |
248 Expression *callAutoDtor(); | |
249 ExpInitializer *getExpInitializer(); | |
250 void checkCtorConstInit(); | |
251 void checkNestedReference(Scope *sc, Loc loc); | |
252 Dsymbol *toAlias(); | |
253 | |
254 Symbol *toSymbol(); | |
255 void toObjFile(); // compile to .obj file | |
256 int cvMember(unsigned char *p); | |
257 | |
258 // Eliminate need for dynamic_cast | |
259 VarDeclaration *isVarDeclaration() { return (VarDeclaration *)this; } | |
50
6fcc08a4d406
[svn r54] Added support for nested delegates referencing parent's stack variables.
lindquist
parents:
40
diff
changeset
|
260 |
6fcc08a4d406
[svn r54] Added support for nested delegates referencing parent's stack variables.
lindquist
parents:
40
diff
changeset
|
261 // LLVMDC |
6fcc08a4d406
[svn r54] Added support for nested delegates referencing parent's stack variables.
lindquist
parents:
40
diff
changeset
|
262 int llvmNestedIndex; |
73 | 263 int llvmFieldIndex; |
264 size_t llvmFieldIndexOffset; | |
82
d8dd47ef3973
[svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
73
diff
changeset
|
265 bool llvmNeedsStorage; |
100 | 266 llvm::Constant* llvmConstInit; |
267 IRGlobal* llvmIRGlobal; | |
1 | 268 }; |
269 | |
270 /**************************************************************/ | |
271 | |
272 // This is a shell around a back end symbol | |
273 | |
274 struct SymbolDeclaration : Declaration | |
275 { | |
276 Symbol *sym; | |
277 StructDeclaration *dsym; | |
278 | |
279 SymbolDeclaration(Loc loc, Symbol *s, StructDeclaration *dsym); | |
280 | |
281 Symbol *toSymbol(); | |
282 | |
283 // Eliminate need for dynamic_cast | |
284 SymbolDeclaration *isSymbolDeclaration() { return (SymbolDeclaration *)this; } | |
285 }; | |
286 | |
287 struct ClassInfoDeclaration : VarDeclaration | |
288 { | |
289 ClassDeclaration *cd; | |
290 | |
291 ClassInfoDeclaration(ClassDeclaration *cd); | |
292 Dsymbol *syntaxCopy(Dsymbol *); | |
293 void semantic(Scope *sc); | |
294 | |
295 void emitComment(Scope *sc); | |
296 | |
297 Symbol *toSymbol(); | |
100 | 298 |
299 ClassInfoDeclaration* isClassInfoDeclaration() { return this; } | |
1 | 300 }; |
301 | |
302 struct ModuleInfoDeclaration : VarDeclaration | |
303 { | |
304 Module *mod; | |
305 | |
306 ModuleInfoDeclaration(Module *mod); | |
307 Dsymbol *syntaxCopy(Dsymbol *); | |
308 void semantic(Scope *sc); | |
309 | |
310 void emitComment(Scope *sc); | |
311 | |
312 Symbol *toSymbol(); | |
313 }; | |
314 | |
315 struct TypeInfoDeclaration : VarDeclaration | |
316 { | |
317 Type *tinfo; | |
318 | |
319 TypeInfoDeclaration(Type *tinfo, int internal); | |
320 Dsymbol *syntaxCopy(Dsymbol *); | |
321 void semantic(Scope *sc); | |
322 | |
323 void emitComment(Scope *sc); | |
324 | |
325 Symbol *toSymbol(); | |
326 void toObjFile(); // compile to .obj file | |
327 virtual void toDt(dt_t **pdt); | |
328 | |
329 virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return this; } | |
330 }; | |
331 | |
332 struct TypeInfoStructDeclaration : TypeInfoDeclaration | |
333 { | |
334 TypeInfoStructDeclaration(Type *tinfo); | |
335 | |
336 void toDt(dt_t **pdt); | |
337 }; | |
338 | |
339 struct TypeInfoClassDeclaration : TypeInfoDeclaration | |
340 { | |
341 TypeInfoClassDeclaration(Type *tinfo); | |
342 | |
343 void toDt(dt_t **pdt); | |
344 }; | |
345 | |
346 struct TypeInfoInterfaceDeclaration : TypeInfoDeclaration | |
347 { | |
348 TypeInfoInterfaceDeclaration(Type *tinfo); | |
349 | |
350 void toDt(dt_t **pdt); | |
351 }; | |
352 | |
353 struct TypeInfoTypedefDeclaration : TypeInfoDeclaration | |
354 { | |
355 TypeInfoTypedefDeclaration(Type *tinfo); | |
356 | |
357 void toDt(dt_t **pdt); | |
358 }; | |
359 | |
360 struct TypeInfoPointerDeclaration : TypeInfoDeclaration | |
361 { | |
362 TypeInfoPointerDeclaration(Type *tinfo); | |
363 | |
364 void toDt(dt_t **pdt); | |
365 }; | |
366 | |
367 struct TypeInfoArrayDeclaration : TypeInfoDeclaration | |
368 { | |
369 TypeInfoArrayDeclaration(Type *tinfo); | |
370 | |
371 void toDt(dt_t **pdt); | |
372 }; | |
373 | |
374 struct TypeInfoStaticArrayDeclaration : TypeInfoDeclaration | |
375 { | |
376 TypeInfoStaticArrayDeclaration(Type *tinfo); | |
377 | |
378 void toDt(dt_t **pdt); | |
379 }; | |
380 | |
381 struct TypeInfoAssociativeArrayDeclaration : TypeInfoDeclaration | |
382 { | |
383 TypeInfoAssociativeArrayDeclaration(Type *tinfo); | |
384 | |
385 void toDt(dt_t **pdt); | |
386 }; | |
387 | |
388 struct TypeInfoEnumDeclaration : TypeInfoDeclaration | |
389 { | |
390 TypeInfoEnumDeclaration(Type *tinfo); | |
391 | |
392 void toDt(dt_t **pdt); | |
393 }; | |
394 | |
395 struct TypeInfoFunctionDeclaration : TypeInfoDeclaration | |
396 { | |
397 TypeInfoFunctionDeclaration(Type *tinfo); | |
398 | |
399 void toDt(dt_t **pdt); | |
400 }; | |
401 | |
402 struct TypeInfoDelegateDeclaration : TypeInfoDeclaration | |
403 { | |
404 TypeInfoDelegateDeclaration(Type *tinfo); | |
405 | |
406 void toDt(dt_t **pdt); | |
407 }; | |
408 | |
409 struct TypeInfoTupleDeclaration : TypeInfoDeclaration | |
410 { | |
411 TypeInfoTupleDeclaration(Type *tinfo); | |
412 | |
413 void toDt(dt_t **pdt); | |
414 }; | |
415 | |
416 struct ThisDeclaration : VarDeclaration | |
417 { | |
418 ThisDeclaration(Type *t); | |
419 Dsymbol *syntaxCopy(Dsymbol *); | |
420 }; | |
421 | |
422 enum ILS | |
423 { | |
424 ILSuninitialized, // not computed yet | |
425 ILSno, // cannot inline | |
426 ILSyes, // can inline | |
427 }; | |
428 | |
429 /**************************************************************/ | |
430 | |
92 | 431 #if V2 |
432 | |
433 enum BUILTIN | |
434 { | |
435 BUILTINunknown = -1, // not known if this is a builtin | |
436 BUILTINnot, // this is not a builtin | |
437 BUILTINsin, // std.math.sin | |
438 BUILTINcos, // std.math.cos | |
439 BUILTINtan, // std.math.tan | |
440 BUILTINsqrt, // std.math.sqrt | |
441 BUILTINfabs, // std.math.fabs | |
442 }; | |
443 | |
444 Expression *eval_builtin(enum BUILTIN builtin, Expressions *arguments); | |
445 | |
446 #endif | |
447 | |
1 | 448 struct FuncDeclaration : Declaration |
449 { | |
450 Array *fthrows; // Array of Type's of exceptions (not used) | |
451 Statement *frequire; | |
452 Statement *fensure; | |
453 Statement *fbody; | |
454 | |
455 Identifier *outId; // identifier for out statement | |
456 VarDeclaration *vresult; // variable corresponding to outId | |
457 LabelDsymbol *returnLabel; // where the return goes | |
458 | |
459 DsymbolTable *localsymtab; // used to prevent symbols in different | |
460 // scopes from having the same name | |
461 VarDeclaration *vthis; // 'this' parameter (member and nested) | |
462 VarDeclaration *v_arguments; // '_arguments' parameter | |
463 #if IN_GCC | |
464 VarDeclaration *v_argptr; // '_argptr' variable | |
465 #endif | |
466 Dsymbols *parameters; // Array of VarDeclaration's for parameters | |
467 DsymbolTable *labtab; // statement label symbol table | |
468 Declaration *overnext; // next in overload list | |
469 Loc endloc; // location of closing curly bracket | |
470 int vtblIndex; // for member functions, index into vtbl[] | |
471 int naked; // !=0 if naked | |
472 int inlineAsm; // !=0 if has inline assembler | |
473 ILS inlineStatus; | |
474 int inlineNest; // !=0 if nested inline | |
475 int cantInterpret; // !=0 if cannot interpret function | |
476 int semanticRun; // !=0 if semantic3() had been run | |
477 ForeachStatement *fes; // if foreach body, this is the foreach | |
478 int introducing; // !=0 if 'introducing' function | |
479 Type *tintro; // if !=NULL, then this is the type | |
480 // of the 'introducing' function | |
481 // this one is overriding | |
482 int inferRetType; // !=0 if return type is to be inferred | |
483 Scope *scope; // !=NULL means context to use | |
484 | |
485 // Things that should really go into Scope | |
486 int hasReturnExp; // 1 if there's a return exp; statement | |
487 // 2 if there's a throw statement | |
488 // 4 if there's an assert(0) | |
489 // 8 if there's inline asm | |
490 | |
491 // Support for NRVO (named return value optimization) | |
492 int nrvo_can; // !=0 means we can do it | |
493 VarDeclaration *nrvo_var; // variable to replace with shidden | |
494 Symbol *shidden; // hidden pointer passed to function | |
495 | |
92 | 496 #if V2 |
497 enum BUILTIN builtin; // set if this is a known, builtin | |
498 // function we can evaluate at compile | |
499 // time | |
500 | |
501 int tookAddressOf; // set if someone took the address of | |
502 // this function | |
503 Dsymbols closureVars; // local variables in this function | |
504 // which are referenced by nested | |
505 // functions | |
506 #else | |
507 int nestedFrameRef; // !=0 if nested variables referenced | |
508 #endif | |
509 | |
1 | 510 FuncDeclaration(Loc loc, Loc endloc, Identifier *id, enum STC storage_class, Type *type); |
511 Dsymbol *syntaxCopy(Dsymbol *); | |
512 void semantic(Scope *sc); | |
513 void semantic2(Scope *sc); | |
514 void semantic3(Scope *sc); | |
515 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
516 void bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
517 int overrides(FuncDeclaration *fd); | |
518 int overloadInsert(Dsymbol *s); | |
519 FuncDeclaration *overloadExactMatch(Type *t); | |
520 FuncDeclaration *overloadResolve(Loc loc, Expressions *arguments); | |
521 LabelDsymbol *searchLabel(Identifier *ident); | |
522 AggregateDeclaration *isThis(); | |
523 AggregateDeclaration *isMember2(); | |
524 int getLevel(Loc loc, FuncDeclaration *fd); // lexical nesting level difference | |
525 void appendExp(Expression *e); | |
526 void appendState(Statement *s); | |
527 char *mangle(); | |
528 int isMain(); | |
529 int isWinMain(); | |
530 int isDllMain(); | |
531 int isExport(); | |
532 int isImportedSymbol(); | |
533 int isAbstract(); | |
534 int isCodeseg(); | |
535 virtual int isNested(); | |
536 int needThis(); | |
537 virtual int isVirtual(); | |
538 virtual int addPreInvariant(); | |
539 virtual int addPostInvariant(); | |
540 Expression *interpret(InterState *istate, Expressions *arguments); | |
541 void inlineScan(); | |
542 int canInline(int hasthis, int hdrscan = 0); | |
543 Expression *doInline(InlineScanState *iss, Expression *ethis, Array *arguments); | |
544 char *kind(); | |
545 void toDocBuffer(OutBuffer *buf); | |
546 | |
547 static FuncDeclaration *genCfunc(Type *treturn, char *name); | |
548 static FuncDeclaration *genCfunc(Type *treturn, Identifier *id); | |
549 | |
550 Symbol *toSymbol(); | |
551 Symbol *toThunkSymbol(int offset); // thunk version | |
552 void toObjFile(); // compile to .obj file | |
553 int cvMember(unsigned char *p); | |
554 | |
555 FuncDeclaration *isFuncDeclaration() { return this; } | |
11
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
9
diff
changeset
|
556 |
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
9
diff
changeset
|
557 bool llvmQueued; |
15
37a4fdab33fc
[svn r19] * Added support for reassigning 'this' inside class constructors.
lindquist
parents:
11
diff
changeset
|
558 llvm::Value* llvmThisVar; |
50
6fcc08a4d406
[svn r54] Added support for nested delegates referencing parent's stack variables.
lindquist
parents:
40
diff
changeset
|
559 std::set<VarDeclaration*> llvmNestedVars; |
6fcc08a4d406
[svn r54] Added support for nested delegates referencing parent's stack variables.
lindquist
parents:
40
diff
changeset
|
560 llvm::Value* llvmNested; |
57
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
50
diff
changeset
|
561 llvm::Value* llvmArguments; |
a9d29e9f1fed
[svn r61] Added support for D-style variadic functions :)
lindquist
parents:
50
diff
changeset
|
562 llvm::Value* llvmArgPtr; |
82
d8dd47ef3973
[svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
73
diff
changeset
|
563 llvm::Constant* llvmDwarfSubProgram; |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
82
diff
changeset
|
564 bool llvmRunTimeHack; |
100 | 565 IRFunction* llvmIRFunc; |
1 | 566 }; |
567 | |
568 struct FuncAliasDeclaration : FuncDeclaration | |
569 { | |
570 FuncDeclaration *funcalias; | |
571 | |
572 FuncAliasDeclaration(FuncDeclaration *funcalias); | |
573 | |
574 FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } | |
575 char *kind(); | |
576 Symbol *toSymbol(); | |
577 }; | |
578 | |
579 struct FuncLiteralDeclaration : FuncDeclaration | |
580 { | |
581 enum TOK tok; // TOKfunction or TOKdelegate | |
582 | |
583 FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, enum TOK tok, | |
584 ForeachStatement *fes); | |
585 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
586 Dsymbol *syntaxCopy(Dsymbol *); | |
587 int isNested(); | |
588 | |
589 FuncLiteralDeclaration *isFuncLiteralDeclaration() { return this; } | |
590 char *kind(); | |
591 }; | |
592 | |
593 struct CtorDeclaration : FuncDeclaration | |
594 { Arguments *arguments; | |
595 int varargs; | |
596 | |
597 CtorDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
598 Dsymbol *syntaxCopy(Dsymbol *); | |
599 void semantic(Scope *sc); | |
600 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
601 char *kind(); | |
602 char *toChars(); | |
603 int isVirtual(); | |
604 int addPreInvariant(); | |
605 int addPostInvariant(); | |
606 void toDocBuffer(OutBuffer *buf); | |
607 | |
608 CtorDeclaration *isCtorDeclaration() { return this; } | |
609 }; | |
610 | |
611 struct DtorDeclaration : FuncDeclaration | |
612 { | |
613 DtorDeclaration(Loc loc, Loc endloc); | |
614 Dsymbol *syntaxCopy(Dsymbol *); | |
615 void semantic(Scope *sc); | |
616 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
617 int isVirtual(); | |
618 int addPreInvariant(); | |
619 int addPostInvariant(); | |
620 int overloadInsert(Dsymbol *s); | |
621 void emitComment(Scope *sc); | |
622 | |
623 DtorDeclaration *isDtorDeclaration() { return this; } | |
624 }; | |
625 | |
626 struct StaticCtorDeclaration : FuncDeclaration | |
627 { | |
628 StaticCtorDeclaration(Loc loc, Loc endloc); | |
629 Dsymbol *syntaxCopy(Dsymbol *); | |
630 void semantic(Scope *sc); | |
631 AggregateDeclaration *isThis(); | |
632 int isStaticConstructor(); | |
633 int isVirtual(); | |
634 int addPreInvariant(); | |
635 int addPostInvariant(); | |
636 void emitComment(Scope *sc); | |
637 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
638 | |
639 StaticCtorDeclaration *isStaticCtorDeclaration() { return this; } | |
640 }; | |
641 | |
642 struct StaticDtorDeclaration : FuncDeclaration | |
643 { | |
644 StaticDtorDeclaration(Loc loc, Loc endloc); | |
645 Dsymbol *syntaxCopy(Dsymbol *); | |
646 void semantic(Scope *sc); | |
647 AggregateDeclaration *isThis(); | |
648 int isStaticDestructor(); | |
649 int isVirtual(); | |
650 int addPreInvariant(); | |
651 int addPostInvariant(); | |
652 void emitComment(Scope *sc); | |
653 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
654 | |
655 StaticDtorDeclaration *isStaticDtorDeclaration() { return this; } | |
656 }; | |
657 | |
658 struct InvariantDeclaration : FuncDeclaration | |
659 { | |
660 InvariantDeclaration(Loc loc, Loc endloc); | |
661 Dsymbol *syntaxCopy(Dsymbol *); | |
662 void semantic(Scope *sc); | |
663 int isVirtual(); | |
664 int addPreInvariant(); | |
665 int addPostInvariant(); | |
666 void emitComment(Scope *sc); | |
667 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
668 | |
669 InvariantDeclaration *isInvariantDeclaration() { return this; } | |
670 }; | |
671 | |
672 | |
673 struct UnitTestDeclaration : FuncDeclaration | |
674 { | |
675 UnitTestDeclaration(Loc loc, Loc endloc); | |
676 Dsymbol *syntaxCopy(Dsymbol *); | |
677 void semantic(Scope *sc); | |
678 AggregateDeclaration *isThis(); | |
679 int isVirtual(); | |
680 int addPreInvariant(); | |
681 int addPostInvariant(); | |
682 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
683 | |
684 UnitTestDeclaration *isUnitTestDeclaration() { return this; } | |
685 }; | |
686 | |
687 struct NewDeclaration : FuncDeclaration | |
688 { Arguments *arguments; | |
689 int varargs; | |
690 | |
691 NewDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
692 Dsymbol *syntaxCopy(Dsymbol *); | |
693 void semantic(Scope *sc); | |
694 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
695 char *kind(); | |
696 int isVirtual(); | |
697 int addPreInvariant(); | |
698 int addPostInvariant(); | |
699 | |
700 NewDeclaration *isNewDeclaration() { return this; } | |
701 }; | |
702 | |
703 | |
704 struct DeleteDeclaration : FuncDeclaration | |
705 { Arguments *arguments; | |
706 | |
707 DeleteDeclaration(Loc loc, Loc endloc, Arguments *arguments); | |
708 Dsymbol *syntaxCopy(Dsymbol *); | |
709 void semantic(Scope *sc); | |
710 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
711 char *kind(); | |
712 int isDelete(); | |
713 int isVirtual(); | |
714 int addPreInvariant(); | |
715 int addPostInvariant(); | |
716 #ifdef _DH | |
717 DeleteDeclaration *isDeleteDeclaration() { return this; } | |
718 #endif | |
719 }; | |
720 | |
721 #endif /* DMD_DECLARATION_H */ |