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