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