Mercurial > projects > ldc
annotate dmd/mtype.h @ 157:5c17f81fc1c1 trunk
[svn r173] moved IR state previously stored in Type into IrType and a Type->IrType map; fixes #7
author | ChristianK |
---|---|
date | Thu, 01 May 2008 13:32:08 +0200 |
parents | 0ab29b838084 |
children | 5acec6b2eef8 |
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_MTYPE_H | |
12 #define DMD_MTYPE_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
16 #endif /* __DMC__ */ | |
17 | |
18 #include "root.h" | |
19 #include "stringtable.h" | |
20 | |
21 #include "arraytypes.h" | |
22 #include "expression.h" | |
23 | |
24 struct Scope; | |
25 struct Identifier; | |
26 struct Expression; | |
27 struct StructDeclaration; | |
28 struct ClassDeclaration; | |
29 struct VarDeclaration; | |
30 struct EnumDeclaration; | |
31 struct TypedefDeclaration; | |
32 struct TypeInfoDeclaration; | |
33 struct Dsymbol; | |
34 struct TemplateInstance; | |
35 enum LINK; | |
36 | |
37 struct TypeBasic; | |
38 struct HdrGenState; | |
39 | |
40 // Back end | |
41 #if IN_GCC | |
42 union tree_node; typedef union tree_node TYPE; | |
43 typedef TYPE type; | |
44 #else | |
45 typedef struct TYPE type; | |
46 #endif | |
47 struct Symbol; | |
48 | |
49 enum TY | |
50 { | |
51 Tarray, // dynamic array | |
52 Tsarray, // static array | |
53 Taarray, // associative array | |
54 Tpointer, | |
55 Treference, | |
56 Tfunction, | |
57 Tident, | |
58 Tclass, | |
59 Tstruct, | |
60 Tenum, | |
61 Ttypedef, | |
62 Tdelegate, | |
63 | |
64 Tnone, | |
65 Tvoid, | |
66 Tint8, | |
67 Tuns8, | |
68 Tint16, | |
69 Tuns16, | |
70 Tint32, | |
71 Tuns32, | |
72 Tint64, | |
73 Tuns64, | |
74 Tfloat32, | |
75 Tfloat64, | |
76 Tfloat80, | |
77 | |
78 Timaginary32, | |
79 Timaginary64, | |
80 Timaginary80, | |
81 | |
82 Tcomplex32, | |
83 Tcomplex64, | |
84 Tcomplex80, | |
85 | |
86 Tbit, | |
87 Tbool, | |
88 Tchar, | |
89 Twchar, | |
90 Tdchar, | |
91 | |
92 Terror, | |
93 Tinstance, | |
94 Ttypeof, | |
95 Ttuple, | |
96 Tslice, | |
97 TMAX | |
98 }; | |
99 | |
100 #define Tascii Tchar | |
101 | |
102 extern int Tsize_t; | |
103 extern int Tptrdiff_t; | |
104 | |
105 struct Type : Object | |
106 { | |
107 TY ty; | |
108 Type *next; | |
109 char *deco; | |
110 Type *pto; // merged pointer to this type | |
111 Type *rto; // reference to this type | |
112 Type *arrayof; // array of this type | |
113 TypeInfoDeclaration *vtinfo; // TypeInfo object for this Type | |
114 | |
115 type *ctype; // for back end | |
116 | |
117 #define tvoid basic[Tvoid] | |
118 #define tint8 basic[Tint8] | |
119 #define tuns8 basic[Tuns8] | |
120 #define tint16 basic[Tint16] | |
121 #define tuns16 basic[Tuns16] | |
122 #define tint32 basic[Tint32] | |
123 #define tuns32 basic[Tuns32] | |
124 #define tint64 basic[Tint64] | |
125 #define tuns64 basic[Tuns64] | |
126 #define tfloat32 basic[Tfloat32] | |
127 #define tfloat64 basic[Tfloat64] | |
128 #define tfloat80 basic[Tfloat80] | |
129 | |
130 #define timaginary32 basic[Timaginary32] | |
131 #define timaginary64 basic[Timaginary64] | |
132 #define timaginary80 basic[Timaginary80] | |
133 | |
134 #define tcomplex32 basic[Tcomplex32] | |
135 #define tcomplex64 basic[Tcomplex64] | |
136 #define tcomplex80 basic[Tcomplex80] | |
137 | |
138 #define tbit basic[Tbit] | |
139 #define tbool basic[Tbool] | |
140 #define tchar basic[Tchar] | |
141 #define twchar basic[Twchar] | |
142 #define tdchar basic[Tdchar] | |
143 | |
144 // Some special types | |
145 #define tshiftcnt tint32 // right side of shift expression | |
146 // #define tboolean tint32 // result of boolean expression | |
147 #define tboolean tbool // result of boolean expression | |
148 #define tindex tint32 // array/ptr index | |
149 static Type *tvoidptr; // void* | |
150 #define terror basic[Terror] // for error recovery | |
151 | |
152 #define tsize_t basic[Tsize_t] // matches size_t alias | |
153 #define tptrdiff_t basic[Tptrdiff_t] // matches ptrdiff_t alias | |
154 #define thash_t tsize_t // matches hash_t alias | |
155 | |
156 static ClassDeclaration *typeinfo; | |
157 static ClassDeclaration *typeinfoclass; | |
158 static ClassDeclaration *typeinfointerface; | |
159 static ClassDeclaration *typeinfostruct; | |
160 static ClassDeclaration *typeinfotypedef; | |
161 static ClassDeclaration *typeinfopointer; | |
162 static ClassDeclaration *typeinfoarray; | |
163 static ClassDeclaration *typeinfostaticarray; | |
164 static ClassDeclaration *typeinfoassociativearray; | |
165 static ClassDeclaration *typeinfoenum; | |
166 static ClassDeclaration *typeinfofunction; | |
167 static ClassDeclaration *typeinfodelegate; | |
168 static ClassDeclaration *typeinfotypelist; | |
169 | |
170 static Type *basic[TMAX]; | |
171 static unsigned char mangleChar[TMAX]; | |
172 static StringTable stringtable; | |
173 | |
174 // These tables are for implicit conversion of binary ops; | |
175 // the indices are the type of operand one, followed by operand two. | |
176 static unsigned char impcnvResult[TMAX][TMAX]; | |
177 static unsigned char impcnvType1[TMAX][TMAX]; | |
178 static unsigned char impcnvType2[TMAX][TMAX]; | |
179 | |
180 // If !=0, give warning on implicit conversion | |
181 static unsigned char impcnvWarn[TMAX][TMAX]; | |
182 | |
183 Type(TY ty, Type *next); | |
184 virtual Type *syntaxCopy(); | |
185 int equals(Object *o); | |
186 int dyncast() { return DYNCAST_TYPE; } // kludge for template.isType() | |
187 int covariant(Type *t); | |
188 char *toChars(); | |
189 static char needThisPrefix(); | |
190 static void init(); | |
191 d_uns64 size(); | |
192 virtual d_uns64 size(Loc loc); | |
193 virtual unsigned alignsize(); | |
194 virtual Type *semantic(Loc loc, Scope *sc); | |
195 virtual void toDecoBuffer(OutBuffer *buf); | |
196 virtual void toTypeInfoBuffer(OutBuffer *buf); | |
197 Type *merge(); | |
198 void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
199 virtual void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
200 virtual int isbit(); | |
201 virtual int isintegral(); | |
202 virtual int isfloating(); // real, imaginary, or complex | |
203 virtual int isreal(); | |
204 virtual int isimaginary(); | |
205 virtual int iscomplex(); | |
206 virtual int isscalar(); | |
207 virtual int isunsigned(); | |
208 virtual int isauto(); | |
209 virtual int isString(); | |
210 virtual int checkBoolean(); // if can be converted to boolean value | |
211 void checkDeprecated(Loc loc, Scope *sc); | |
212 Type *pointerTo(); | |
213 Type *referenceTo(); | |
214 Type *arrayOf(); | |
215 virtual Dsymbol *toDsymbol(Scope *sc); | |
216 virtual Type *toBasetype(); | |
217 virtual int isBaseOf(Type *t, int *poffset); | |
218 virtual MATCH implicitConvTo(Type *to); | |
219 virtual ClassDeclaration *isClassHandle(); | |
220 virtual Expression *getProperty(Loc loc, Identifier *ident); | |
221 virtual Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
222 virtual unsigned memalign(unsigned salign); | |
92 | 223 virtual Expression *defaultInit(Loc loc = 0); |
1 | 224 virtual int isZeroInit(); // if initializer is 0 |
225 virtual dt_t **toDt(dt_t **pdt); | |
226 Identifier *getTypeInfoIdent(int internal); | |
227 virtual MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
228 virtual void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
229 Expression *getInternalTypeInfo(Scope *sc); | |
230 Expression *getTypeInfo(Scope *sc); | |
231 virtual TypeInfoDeclaration *getTypeInfoDeclaration(); | |
232 virtual int builtinTypeInfo(); | |
233 virtual Type *reliesOnTident(); | |
234 virtual Expression *toExpression(); | |
235 virtual int hasPointers(); | |
236 Type *nextOf() { return next; } | |
237 | |
238 static void error(Loc loc, const char *format, ...); | |
239 | |
240 // For backend | |
241 virtual unsigned totym(); | |
242 virtual type *toCtype(); | |
243 virtual type *toCParamtype(); | |
244 virtual Symbol *toSymbol(); | |
245 | |
246 // For eliminating dynamic_cast | |
247 virtual TypeBasic *isTypeBasic(); | |
248 }; | |
249 | |
250 struct TypeBasic : Type | |
251 { | |
252 char *dstring; | |
253 char *cstring; | |
254 unsigned flags; | |
255 | |
256 TypeBasic(TY ty); | |
257 Type *syntaxCopy(); | |
258 d_uns64 size(Loc loc); | |
259 unsigned alignsize(); | |
260 Expression *getProperty(Loc loc, Identifier *ident); | |
261 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
262 char *toChars(); | |
263 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
264 int isintegral(); | |
265 int isbit(); | |
266 int isfloating(); | |
267 int isreal(); | |
268 int isimaginary(); | |
269 int iscomplex(); | |
270 int isscalar(); | |
271 int isunsigned(); | |
272 MATCH implicitConvTo(Type *to); | |
92 | 273 Expression *defaultInit(Loc loc); |
1 | 274 int isZeroInit(); |
275 int builtinTypeInfo(); | |
276 | |
277 // For eliminating dynamic_cast | |
278 TypeBasic *isTypeBasic(); | |
279 }; | |
280 | |
281 struct TypeArray : Type | |
282 { | |
283 TypeArray(TY ty, Type *next); | |
284 virtual void toPrettyBracket(OutBuffer *buf, HdrGenState *hgs) = 0; | |
285 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
286 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
287 }; | |
288 | |
289 // Static array, one with a fixed dimension | |
290 struct TypeSArray : TypeArray | |
291 { | |
292 Expression *dim; | |
293 | |
294 TypeSArray(Type *t, Expression *dim); | |
295 Type *syntaxCopy(); | |
296 d_uns64 size(Loc loc); | |
297 unsigned alignsize(); | |
298 Type *semantic(Loc loc, Scope *sc); | |
299 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
300 void toDecoBuffer(OutBuffer *buf); | |
301 void toTypeInfoBuffer(OutBuffer *buf); | |
302 void toPrettyBracket(OutBuffer *buf, HdrGenState *hgs); | |
303 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
304 int isString(); | |
305 int isZeroInit(); | |
306 unsigned memalign(unsigned salign); | |
307 MATCH implicitConvTo(Type *to); | |
92 | 308 Expression *defaultInit(Loc loc); |
1 | 309 dt_t **toDt(dt_t **pdt); |
310 dt_t **toDtElem(dt_t **pdt, Expression *e); | |
311 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
312 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
313 Expression *toExpression(); | |
314 int hasPointers(); | |
315 | |
316 type *toCtype(); | |
317 type *toCParamtype(); | |
318 }; | |
319 | |
320 // Dynamic array, no dimension | |
321 struct TypeDArray : TypeArray | |
322 { | |
323 TypeDArray(Type *t); | |
324 Type *syntaxCopy(); | |
325 d_uns64 size(Loc loc); | |
326 unsigned alignsize(); | |
327 Type *semantic(Loc loc, Scope *sc); | |
328 void toDecoBuffer(OutBuffer *buf); | |
329 void toTypeInfoBuffer(OutBuffer *buf); | |
330 void toPrettyBracket(OutBuffer *buf, HdrGenState *hgs); | |
331 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
332 int isString(); | |
333 int isZeroInit(); | |
334 int checkBoolean(); | |
335 MATCH implicitConvTo(Type *to); | |
92 | 336 Expression *defaultInit(Loc loc); |
1 | 337 int builtinTypeInfo(); |
338 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
339 int hasPointers(); | |
340 | |
341 type *toCtype(); | |
342 }; | |
343 | |
344 struct TypeAArray : TypeArray | |
345 { | |
346 Type *index; // key type for type checking | |
347 Type *key; // actual key type | |
348 | |
349 TypeAArray(Type *t, Type *index); | |
350 Type *syntaxCopy(); | |
351 d_uns64 size(Loc loc); | |
352 Type *semantic(Loc loc, Scope *sc); | |
353 void toDecoBuffer(OutBuffer *buf); | |
354 void toPrettyBracket(OutBuffer *buf, HdrGenState *hgs); | |
355 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
92 | 356 Expression *defaultInit(Loc loc); |
1 | 357 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); |
358 int checkBoolean(); | |
359 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
360 int hasPointers(); | |
361 | |
362 // Back end | |
363 Symbol *aaGetSymbol(char *func, int flags); | |
364 | |
365 type *toCtype(); | |
366 }; | |
367 | |
368 struct TypePointer : Type | |
369 { | |
370 TypePointer(Type *t); | |
371 Type *syntaxCopy(); | |
372 Type *semantic(Loc loc, Scope *sc); | |
373 d_uns64 size(Loc loc); | |
374 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
375 MATCH implicitConvTo(Type *to); | |
376 int isscalar(); | |
92 | 377 Expression *defaultInit(Loc loc); |
1 | 378 int isZeroInit(); |
379 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
380 int hasPointers(); | |
381 | |
382 type *toCtype(); | |
383 }; | |
384 | |
385 struct TypeReference : Type | |
386 { | |
387 TypeReference(Type *t); | |
388 Type *syntaxCopy(); | |
389 d_uns64 size(Loc loc); | |
390 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
391 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
92 | 392 Expression *defaultInit(Loc loc); |
1 | 393 int isZeroInit(); |
394 }; | |
395 | |
396 enum RET | |
397 { | |
398 RETregs = 1, // returned in registers | |
399 RETstack = 2, // returned on stack | |
400 }; | |
401 | |
402 struct TypeFunction : Type | |
403 { | |
404 Arguments *parameters; // function parameters | |
405 int varargs; // 1: T t, ...) style for variable number of arguments | |
406 // 2: T t ...) style for variable number of arguments | |
407 enum LINK linkage; // calling convention | |
408 | |
409 int inuse; | |
410 | |
411 TypeFunction(Arguments *parameters, Type *treturn, int varargs, enum LINK linkage); | |
412 Type *syntaxCopy(); | |
413 Type *semantic(Loc loc, Scope *sc); | |
414 void toDecoBuffer(OutBuffer *buf); | |
415 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
416 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
417 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
418 Type *reliesOnTident(); | |
419 | |
420 int callMatch(Expressions *toargs); | |
421 type *toCtype(); | |
422 enum RET retStyle(); | |
423 | |
424 unsigned totym(); | |
425 | |
426 bool llvmRetInPtr; | |
9 | 427 bool llvmUsesThis; |
1 | 428 }; |
429 | |
430 struct TypeDelegate : Type | |
431 { | |
432 TypeDelegate(Type *t); | |
433 Type *syntaxCopy(); | |
434 Type *semantic(Loc loc, Scope *sc); | |
435 d_uns64 size(Loc loc); | |
436 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
92 | 437 Expression *defaultInit(Loc loc); |
1 | 438 int isZeroInit(); |
439 int checkBoolean(); | |
440 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
441 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
442 int hasPointers(); | |
443 | |
444 type *toCtype(); | |
445 }; | |
446 | |
447 struct TypeQualified : Type | |
448 { | |
449 Loc loc; | |
450 Array idents; // array of Identifier's representing ident.ident.ident etc. | |
451 | |
452 TypeQualified(TY ty, Loc loc); | |
453 void syntaxCopyHelper(TypeQualified *t); | |
454 void addIdent(Identifier *ident); | |
455 void toCBuffer2Helper(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
456 d_uns64 size(Loc loc); | |
457 void resolveHelper(Loc loc, Scope *sc, Dsymbol *s, Dsymbol *scopesym, | |
458 Expression **pe, Type **pt, Dsymbol **ps); | |
459 }; | |
460 | |
461 struct TypeIdentifier : TypeQualified | |
462 { | |
463 Identifier *ident; | |
464 | |
465 TypeIdentifier(Loc loc, Identifier *ident); | |
466 Type *syntaxCopy(); | |
467 //char *toChars(); | |
468 void toDecoBuffer(OutBuffer *buf); | |
469 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
470 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
471 Dsymbol *toDsymbol(Scope *sc); | |
472 Type *semantic(Loc loc, Scope *sc); | |
473 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
474 Type *reliesOnTident(); | |
475 Expression *toExpression(); | |
476 }; | |
477 | |
478 /* Similar to TypeIdentifier, but with a TemplateInstance as the root | |
479 */ | |
480 struct TypeInstance : TypeQualified | |
481 { | |
482 TemplateInstance *tempinst; | |
483 | |
484 TypeInstance(Loc loc, TemplateInstance *tempinst); | |
485 Type *syntaxCopy(); | |
486 //char *toChars(); | |
487 //void toDecoBuffer(OutBuffer *buf); | |
488 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
489 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
490 Type *semantic(Loc loc, Scope *sc); | |
491 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
492 }; | |
493 | |
494 struct TypeTypeof : TypeQualified | |
495 { | |
496 Expression *exp; | |
497 | |
498 TypeTypeof(Loc loc, Expression *exp); | |
499 Type *syntaxCopy(); | |
500 Dsymbol *toDsymbol(Scope *sc); | |
501 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
502 Type *semantic(Loc loc, Scope *sc); | |
503 d_uns64 size(Loc loc); | |
504 }; | |
505 | |
506 struct TypeStruct : Type | |
507 { | |
508 StructDeclaration *sym; | |
509 | |
510 TypeStruct(StructDeclaration *sym); | |
511 d_uns64 size(Loc loc); | |
512 unsigned alignsize(); | |
513 char *toChars(); | |
514 Type *syntaxCopy(); | |
515 Type *semantic(Loc loc, Scope *sc); | |
516 Dsymbol *toDsymbol(Scope *sc); | |
517 void toDecoBuffer(OutBuffer *buf); | |
518 void toTypeInfoBuffer(OutBuffer *buf); | |
519 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
520 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
521 unsigned memalign(unsigned salign); | |
92 | 522 Expression *defaultInit(Loc loc); |
1 | 523 int isZeroInit(); |
524 int checkBoolean(); | |
525 dt_t **toDt(dt_t **pdt); | |
526 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
527 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
528 int hasPointers(); | |
529 | |
530 type *toCtype(); | |
531 }; | |
532 | |
533 struct TypeEnum : Type | |
534 { | |
535 EnumDeclaration *sym; | |
536 | |
537 TypeEnum(EnumDeclaration *sym); | |
538 d_uns64 size(Loc loc); | |
539 unsigned alignsize(); | |
540 char *toChars(); | |
541 Type *semantic(Loc loc, Scope *sc); | |
542 Dsymbol *toDsymbol(Scope *sc); | |
543 void toDecoBuffer(OutBuffer *buf); | |
544 void toTypeInfoBuffer(OutBuffer *buf); | |
545 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
546 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
547 Expression *getProperty(Loc loc, Identifier *ident); | |
548 int isintegral(); | |
549 int isfloating(); | |
550 int isscalar(); | |
551 int isunsigned(); | |
552 MATCH implicitConvTo(Type *to); | |
553 Type *toBasetype(); | |
92 | 554 Expression *defaultInit(Loc loc); |
1 | 555 int isZeroInit(); |
556 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
557 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
558 int hasPointers(); | |
559 | |
560 type *toCtype(); | |
561 }; | |
562 | |
563 struct TypeTypedef : Type | |
564 { | |
565 TypedefDeclaration *sym; | |
566 | |
567 TypeTypedef(TypedefDeclaration *sym); | |
568 Type *syntaxCopy(); | |
569 d_uns64 size(Loc loc); | |
570 unsigned alignsize(); | |
571 char *toChars(); | |
572 Type *semantic(Loc loc, Scope *sc); | |
573 Dsymbol *toDsymbol(Scope *sc); | |
574 void toDecoBuffer(OutBuffer *buf); | |
575 void toTypeInfoBuffer(OutBuffer *buf); | |
576 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
577 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
139
0ab29b838084
[svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents:
131
diff
changeset
|
578 Expression *getProperty(Loc loc, Identifier *ident); |
1 | 579 int isbit(); |
580 int isintegral(); | |
581 int isfloating(); | |
582 int isreal(); | |
583 int isimaginary(); | |
584 int iscomplex(); | |
585 int isscalar(); | |
586 int isunsigned(); | |
587 int checkBoolean(); | |
588 Type *toBasetype(); | |
589 MATCH implicitConvTo(Type *to); | |
92 | 590 Expression *defaultInit(Loc loc); |
1 | 591 int isZeroInit(); |
592 dt_t **toDt(dt_t **pdt); | |
593 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
594 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
595 int hasPointers(); | |
596 | |
597 type *toCtype(); | |
598 type *toCParamtype(); | |
599 }; | |
600 | |
601 struct TypeClass : Type | |
602 { | |
603 ClassDeclaration *sym; | |
604 | |
605 TypeClass(ClassDeclaration *sym); | |
606 d_uns64 size(Loc loc); | |
607 char *toChars(); | |
608 Type *syntaxCopy(); | |
609 Type *semantic(Loc loc, Scope *sc); | |
610 Dsymbol *toDsymbol(Scope *sc); | |
611 void toDecoBuffer(OutBuffer *buf); | |
612 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
613 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
614 ClassDeclaration *isClassHandle(); | |
615 int isBaseOf(Type *t, int *poffset); | |
616 MATCH implicitConvTo(Type *to); | |
92 | 617 Expression *defaultInit(Loc loc); |
1 | 618 int isZeroInit(); |
619 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
620 int isauto(); | |
621 int checkBoolean(); | |
622 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
623 int hasPointers(); | |
624 | |
625 type *toCtype(); | |
626 | |
627 Symbol *toSymbol(); | |
628 }; | |
629 | |
630 struct TypeTuple : Type | |
631 { | |
632 Arguments *arguments; // types making up the tuple | |
633 | |
634 TypeTuple(Arguments *arguments); | |
635 TypeTuple(Expressions *exps); | |
636 Type *syntaxCopy(); | |
637 Type *semantic(Loc loc, Scope *sc); | |
638 int equals(Object *o); | |
639 Type *reliesOnTident(); | |
640 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
641 void toDecoBuffer(OutBuffer *buf); | |
642 Expression *getProperty(Loc loc, Identifier *ident); | |
643 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
644 }; | |
645 | |
646 struct TypeSlice : Type | |
647 { | |
648 Expression *lwr; | |
649 Expression *upr; | |
650 | |
651 TypeSlice(Type *next, Expression *lwr, Expression *upr); | |
652 Type *syntaxCopy(); | |
653 Type *semantic(Loc loc, Scope *sc); | |
654 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
655 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
656 }; | |
657 | |
658 /**************************************************************/ | |
659 | |
660 //enum InOut { None, In, Out, InOut, Lazy }; | |
661 | |
662 struct Argument : Object | |
663 { | |
664 //enum InOut inout; | |
665 unsigned storageClass; | |
666 Type *type; | |
667 Identifier *ident; | |
668 Expression *defaultArg; | |
669 | |
670 Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg); | |
671 Argument *syntaxCopy(); | |
672 Type *isLazyArray(); | |
673 void toDecoBuffer(OutBuffer *buf); | |
674 static Arguments *arraySyntaxCopy(Arguments *args); | |
675 static char *argsTypesToChars(Arguments *args, int varargs); | |
676 static void argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Arguments *arguments, int varargs); | |
677 static void argsToDecoBuffer(OutBuffer *buf, Arguments *arguments); | |
678 static size_t dim(Arguments *arguments); | |
679 static Argument *getNth(Arguments *arguments, size_t nth, size_t *pn = NULL); | |
680 | |
681 // backend | |
682 VarDeclaration* vardecl; | |
683 }; | |
684 | |
685 extern int PTRSIZE; | |
686 extern int REALSIZE; | |
687 extern int REALPAD; | |
688 extern int Tsize_t; | |
689 extern int Tptrdiff_t; | |
690 | |
691 #endif /* DMD_MTYPE_H */ |