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