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