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