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