Mercurial > projects > ldc
annotate dmd/mtype.h @ 379:d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
and aa args and returns. There are still some bugs with aas.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Tue, 22 Jul 2008 23:06:46 +0200 |
parents | aaade6ded589 |
children | 3545f9eddbfc |
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, | |
379
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
100 |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
101 // LLVMDC |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
102 Topaque, |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
103 |
159 | 104 TMAX |
105 }; | |
106 | |
107 #define Tascii Tchar | |
108 | |
109 extern int Tsize_t; | |
110 extern int Tptrdiff_t; | |
111 | |
112 struct Type : Object | |
113 { | |
114 TY ty; | |
115 unsigned char mod; // modifiers (MODconst, MODinvariant) | |
116 #define MODconst 1 // type is const | |
117 #define MODinvariant 2 // type is invariant | |
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 | |
379
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
180 // LLVMDC, for runtime function signatures that contain |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
181 // AAs or arrays of unknown type |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
182 static Type* topaque; |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
183 |
159 | 184 static Type *basic[TMAX]; |
185 static unsigned char mangleChar[TMAX]; | |
186 static StringTable stringtable; | |
187 | |
188 // These tables are for implicit conversion of binary ops; | |
189 // the indices are the type of operand one, followed by operand two. | |
190 static unsigned char impcnvResult[TMAX][TMAX]; | |
191 static unsigned char impcnvType1[TMAX][TMAX]; | |
192 static unsigned char impcnvType2[TMAX][TMAX]; | |
193 | |
194 // If !=0, give warning on implicit conversion | |
195 static unsigned char impcnvWarn[TMAX][TMAX]; | |
196 | |
197 Type(TY ty, Type *next); | |
198 virtual Type *syntaxCopy(); | |
199 int equals(Object *o); | |
200 int dyncast() { return DYNCAST_TYPE; } // kludge for template.isType() | |
201 int covariant(Type *t); | |
202 char *toChars(); | |
203 static char needThisPrefix(); | |
204 static void init(); | |
205 d_uns64 size(); | |
206 virtual d_uns64 size(Loc loc); | |
207 virtual unsigned alignsize(); | |
208 virtual Type *semantic(Loc loc, Scope *sc); | |
209 virtual void toDecoBuffer(OutBuffer *buf); | |
210 Type *merge(); | |
211 virtual void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
212 virtual void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
213 void toCBuffer3(OutBuffer *buf, HdrGenState *hgs, int mod); | |
214 virtual int isbit(); | |
215 virtual int isintegral(); | |
216 virtual int isfloating(); // real, imaginary, or complex | |
217 virtual int isreal(); | |
218 virtual int isimaginary(); | |
219 virtual int iscomplex(); | |
220 virtual int isscalar(); | |
221 virtual int isunsigned(); | |
222 virtual int isauto(); | |
223 virtual int isString(); | |
224 virtual int checkBoolean(); // if can be converted to boolean value | |
225 void checkDeprecated(Loc loc, Scope *sc); | |
226 Type *pointerTo(); | |
227 Type *referenceTo(); | |
228 Type *arrayOf(); | |
229 virtual Dsymbol *toDsymbol(Scope *sc); | |
230 virtual Type *toBasetype(); | |
231 virtual int isBaseOf(Type *t, int *poffset); | |
232 virtual MATCH implicitConvTo(Type *to); | |
233 virtual ClassDeclaration *isClassHandle(); | |
234 virtual Expression *getProperty(Loc loc, Identifier *ident); | |
235 virtual Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
236 virtual unsigned memalign(unsigned salign); | |
237 virtual Expression *defaultInit(Loc loc = 0); | |
238 virtual int isZeroInit(); // if initializer is 0 | |
239 virtual dt_t **toDt(dt_t **pdt); | |
240 Identifier *getTypeInfoIdent(int internal); | |
241 virtual MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
242 virtual void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
243 Expression *getInternalTypeInfo(Scope *sc); | |
244 Expression *getTypeInfo(Scope *sc); | |
245 virtual TypeInfoDeclaration *getTypeInfoDeclaration(); | |
246 virtual int builtinTypeInfo(); | |
247 virtual Type *reliesOnTident(); | |
248 virtual Expression *toExpression(); | |
249 virtual int hasPointers(); | |
250 Type *nextOf() { return next; } | |
251 | |
252 static void error(Loc loc, const char *format, ...); | |
253 | |
254 // For backend | |
255 virtual unsigned totym(); | |
256 virtual type *toCtype(); | |
257 virtual type *toCParamtype(); | |
258 virtual Symbol *toSymbol(); | |
259 | |
260 // For eliminating dynamic_cast | |
261 virtual TypeBasic *isTypeBasic(); | |
173
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
262 |
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
263 // llvmdc |
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
264 IrType ir; |
159 | 265 }; |
266 | |
267 struct TypeBasic : Type | |
268 { | |
269 char *dstring; | |
270 char *cstring; | |
271 unsigned flags; | |
272 | |
273 TypeBasic(TY ty); | |
274 Type *syntaxCopy(); | |
275 d_uns64 size(Loc loc); | |
276 unsigned alignsize(); | |
277 Expression *getProperty(Loc loc, Identifier *ident); | |
278 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
279 char *toChars(); | |
280 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
281 int isintegral(); | |
282 int isbit(); | |
283 int isfloating(); | |
284 int isreal(); | |
285 int isimaginary(); | |
286 int iscomplex(); | |
287 int isscalar(); | |
288 int isunsigned(); | |
289 MATCH implicitConvTo(Type *to); | |
290 Expression *defaultInit(Loc loc); | |
291 int isZeroInit(); | |
292 int builtinTypeInfo(); | |
293 | |
294 // For eliminating dynamic_cast | |
295 TypeBasic *isTypeBasic(); | |
296 }; | |
297 | |
298 struct TypeArray : Type | |
299 { | |
300 TypeArray(TY ty, Type *next); | |
301 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
302 }; | |
303 | |
304 // Static array, one with a fixed dimension | |
305 struct TypeSArray : TypeArray | |
306 { | |
307 Expression *dim; | |
308 | |
309 TypeSArray(Type *t, Expression *dim); | |
310 Type *syntaxCopy(); | |
311 d_uns64 size(Loc loc); | |
312 unsigned alignsize(); | |
313 Type *semantic(Loc loc, Scope *sc); | |
314 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
315 void toDecoBuffer(OutBuffer *buf); | |
316 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
317 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
318 int isString(); | |
319 int isZeroInit(); | |
320 unsigned memalign(unsigned salign); | |
321 MATCH implicitConvTo(Type *to); | |
322 Expression *defaultInit(Loc loc); | |
323 dt_t **toDt(dt_t **pdt); | |
324 dt_t **toDtElem(dt_t **pdt, Expression *e); | |
325 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
326 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
327 Expression *toExpression(); | |
328 int hasPointers(); | |
329 | |
330 type *toCtype(); | |
331 type *toCParamtype(); | |
332 }; | |
333 | |
334 // Dynamic array, no dimension | |
335 struct TypeDArray : TypeArray | |
336 { | |
337 TypeDArray(Type *t); | |
338 Type *syntaxCopy(); | |
339 d_uns64 size(Loc loc); | |
340 unsigned alignsize(); | |
341 Type *semantic(Loc loc, Scope *sc); | |
342 void toDecoBuffer(OutBuffer *buf); | |
343 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
344 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
345 int isString(); | |
346 int isZeroInit(); | |
347 int checkBoolean(); | |
348 MATCH implicitConvTo(Type *to); | |
349 Expression *defaultInit(Loc loc); | |
350 int builtinTypeInfo(); | |
351 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
352 int hasPointers(); | |
353 | |
354 type *toCtype(); | |
355 }; | |
356 | |
357 struct TypeAArray : TypeArray | |
358 { | |
359 Type *index; // key type for type checking | |
360 Type *key; // actual key type | |
361 | |
362 TypeAArray(Type *t, Type *index); | |
363 Type *syntaxCopy(); | |
364 d_uns64 size(Loc loc); | |
365 Type *semantic(Loc loc, Scope *sc); | |
336 | 366 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); |
159 | 367 void toDecoBuffer(OutBuffer *buf); |
368 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
369 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
370 Expression *defaultInit(Loc loc); | |
371 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
211
f66219e0d530
[svn r227] Fixed: crash in lifetime.d when resizing array of AAs by .length assignment.
lindquist
parents:
173
diff
changeset
|
372 int isZeroInit(); |
159 | 373 int checkBoolean(); |
374 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
375 int hasPointers(); | |
376 | |
377 // Back end | |
378 Symbol *aaGetSymbol(char *func, int flags); | |
379 | |
380 type *toCtype(); | |
381 }; | |
382 | |
383 struct TypePointer : Type | |
384 { | |
385 TypePointer(Type *t); | |
386 Type *syntaxCopy(); | |
387 Type *semantic(Loc loc, Scope *sc); | |
388 d_uns64 size(Loc loc); | |
389 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
390 MATCH implicitConvTo(Type *to); | |
391 int isscalar(); | |
392 Expression *defaultInit(Loc loc); | |
393 int isZeroInit(); | |
394 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
395 int hasPointers(); | |
396 | |
397 type *toCtype(); | |
398 }; | |
399 | |
400 struct TypeReference : Type | |
401 { | |
402 TypeReference(Type *t); | |
403 Type *syntaxCopy(); | |
404 d_uns64 size(Loc loc); | |
405 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
406 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
407 Expression *defaultInit(Loc loc); | |
408 int isZeroInit(); | |
409 }; | |
410 | |
411 enum RET | |
412 { | |
413 RETregs = 1, // returned in registers | |
414 RETstack = 2, // returned on stack | |
415 }; | |
416 | |
417 struct TypeFunction : Type | |
418 { | |
419 Arguments *parameters; // function parameters | |
420 int varargs; // 1: T t, ...) style for variable number of arguments | |
421 // 2: T t ...) style for variable number of arguments | |
422 enum LINK linkage; // calling convention | |
423 | |
424 int inuse; | |
425 | |
426 TypeFunction(Arguments *parameters, Type *treturn, int varargs, enum LINK linkage); | |
427 Type *syntaxCopy(); | |
428 Type *semantic(Loc loc, Scope *sc); | |
429 void toDecoBuffer(OutBuffer *buf); | |
430 void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
431 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
432 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
433 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
434 Type *reliesOnTident(); | |
435 | |
436 int callMatch(Expressions *toargs); | |
437 type *toCtype(); | |
438 enum RET retStyle(); | |
439 | |
440 unsigned totym(); | |
441 | |
442 bool llvmRetInPtr; | |
443 bool llvmUsesThis; | |
444 }; | |
445 | |
446 struct TypeDelegate : Type | |
447 { | |
448 TypeDelegate(Type *t); | |
449 Type *syntaxCopy(); | |
450 Type *semantic(Loc loc, Scope *sc); | |
451 d_uns64 size(Loc loc); | |
452 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
453 Expression *defaultInit(Loc loc); | |
454 int isZeroInit(); | |
455 int checkBoolean(); | |
456 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
457 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
458 int hasPointers(); | |
459 | |
460 type *toCtype(); | |
461 }; | |
462 | |
463 struct TypeQualified : Type | |
464 { | |
465 Loc loc; | |
466 Array idents; // array of Identifier's representing ident.ident.ident etc. | |
467 | |
468 TypeQualified(TY ty, Loc loc); | |
469 void syntaxCopyHelper(TypeQualified *t); | |
470 void addIdent(Identifier *ident); | |
471 void toCBuffer2Helper(OutBuffer *buf, HdrGenState *hgs); | |
472 d_uns64 size(Loc loc); | |
473 void resolveHelper(Loc loc, Scope *sc, Dsymbol *s, Dsymbol *scopesym, | |
474 Expression **pe, Type **pt, Dsymbol **ps); | |
475 }; | |
476 | |
477 struct TypeIdentifier : TypeQualified | |
478 { | |
479 Identifier *ident; | |
480 | |
481 TypeIdentifier(Loc loc, Identifier *ident); | |
482 Type *syntaxCopy(); | |
483 //char *toChars(); | |
484 void toDecoBuffer(OutBuffer *buf); | |
485 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
486 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
487 Dsymbol *toDsymbol(Scope *sc); | |
488 Type *semantic(Loc loc, Scope *sc); | |
489 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
490 Type *reliesOnTident(); | |
491 Expression *toExpression(); | |
492 }; | |
493 | |
494 /* Similar to TypeIdentifier, but with a TemplateInstance as the root | |
495 */ | |
496 struct TypeInstance : TypeQualified | |
497 { | |
498 TemplateInstance *tempinst; | |
499 | |
500 TypeInstance(Loc loc, TemplateInstance *tempinst); | |
501 Type *syntaxCopy(); | |
502 //char *toChars(); | |
503 //void toDecoBuffer(OutBuffer *buf); | |
504 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
505 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
506 Type *semantic(Loc loc, Scope *sc); | |
507 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
508 }; | |
509 | |
510 struct TypeTypeof : TypeQualified | |
511 { | |
512 Expression *exp; | |
513 | |
514 TypeTypeof(Loc loc, Expression *exp); | |
515 Type *syntaxCopy(); | |
516 Dsymbol *toDsymbol(Scope *sc); | |
517 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
518 Type *semantic(Loc loc, Scope *sc); | |
519 d_uns64 size(Loc loc); | |
520 }; | |
521 | |
522 struct TypeStruct : Type | |
523 { | |
524 StructDeclaration *sym; | |
525 | |
526 TypeStruct(StructDeclaration *sym); | |
527 d_uns64 size(Loc loc); | |
528 unsigned alignsize(); | |
529 char *toChars(); | |
530 Type *syntaxCopy(); | |
531 Type *semantic(Loc loc, Scope *sc); | |
532 Dsymbol *toDsymbol(Scope *sc); | |
533 void toDecoBuffer(OutBuffer *buf); | |
534 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
535 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
536 unsigned memalign(unsigned salign); | |
537 Expression *defaultInit(Loc loc); | |
538 int isZeroInit(); | |
539 int checkBoolean(); | |
540 dt_t **toDt(dt_t **pdt); | |
541 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
542 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
543 int hasPointers(); | |
544 | |
545 type *toCtype(); | |
546 }; | |
547 | |
548 struct TypeEnum : Type | |
549 { | |
550 EnumDeclaration *sym; | |
551 | |
552 TypeEnum(EnumDeclaration *sym); | |
553 d_uns64 size(Loc loc); | |
554 unsigned alignsize(); | |
555 char *toChars(); | |
556 Type *semantic(Loc loc, Scope *sc); | |
557 Dsymbol *toDsymbol(Scope *sc); | |
558 void toDecoBuffer(OutBuffer *buf); | |
559 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
560 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
561 Expression *getProperty(Loc loc, Identifier *ident); | |
562 int isintegral(); | |
563 int isfloating(); | |
564 int isscalar(); | |
565 int isunsigned(); | |
566 MATCH implicitConvTo(Type *to); | |
567 Type *toBasetype(); | |
568 Expression *defaultInit(Loc loc); | |
569 int isZeroInit(); | |
570 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
571 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
572 int hasPointers(); | |
573 | |
574 type *toCtype(); | |
575 }; | |
576 | |
577 struct TypeTypedef : Type | |
578 { | |
579 TypedefDeclaration *sym; | |
580 | |
581 TypeTypedef(TypedefDeclaration *sym); | |
582 Type *syntaxCopy(); | |
583 d_uns64 size(Loc loc); | |
584 unsigned alignsize(); | |
585 char *toChars(); | |
586 Type *semantic(Loc loc, Scope *sc); | |
587 Dsymbol *toDsymbol(Scope *sc); | |
588 void toDecoBuffer(OutBuffer *buf); | |
589 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
590 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
591 Expression *getProperty(Loc loc, Identifier *ident); | |
592 int isbit(); | |
593 int isintegral(); | |
594 int isfloating(); | |
595 int isreal(); | |
596 int isimaginary(); | |
597 int iscomplex(); | |
598 int isscalar(); | |
599 int isunsigned(); | |
600 int checkBoolean(); | |
601 Type *toBasetype(); | |
602 MATCH implicitConvTo(Type *to); | |
603 Expression *defaultInit(Loc loc); | |
604 int isZeroInit(); | |
605 dt_t **toDt(dt_t **pdt); | |
606 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
607 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
608 int hasPointers(); | |
609 | |
610 type *toCtype(); | |
611 type *toCParamtype(); | |
612 }; | |
613 | |
614 struct TypeClass : Type | |
615 { | |
616 ClassDeclaration *sym; | |
617 | |
618 TypeClass(ClassDeclaration *sym); | |
619 d_uns64 size(Loc loc); | |
620 char *toChars(); | |
621 Type *syntaxCopy(); | |
622 Type *semantic(Loc loc, Scope *sc); | |
623 Dsymbol *toDsymbol(Scope *sc); | |
624 void toDecoBuffer(OutBuffer *buf); | |
625 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
626 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
627 ClassDeclaration *isClassHandle(); | |
628 int isBaseOf(Type *t, int *poffset); | |
629 MATCH implicitConvTo(Type *to); | |
630 Expression *defaultInit(Loc loc); | |
631 int isZeroInit(); | |
632 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
633 int isauto(); | |
634 int checkBoolean(); | |
635 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
636 int hasPointers(); | |
637 | |
638 type *toCtype(); | |
639 | |
640 Symbol *toSymbol(); | |
641 }; | |
642 | |
643 struct TypeTuple : Type | |
644 { | |
645 Arguments *arguments; // types making up the tuple | |
646 | |
647 TypeTuple(Arguments *arguments); | |
648 TypeTuple(Expressions *exps); | |
649 Type *syntaxCopy(); | |
650 Type *semantic(Loc loc, Scope *sc); | |
651 int equals(Object *o); | |
652 Type *reliesOnTident(); | |
653 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
654 void toDecoBuffer(OutBuffer *buf); | |
655 Expression *getProperty(Loc loc, Identifier *ident); | |
656 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
657 }; | |
658 | |
659 struct TypeSlice : Type | |
660 { | |
661 Expression *lwr; | |
662 Expression *upr; | |
663 | |
664 TypeSlice(Type *next, Expression *lwr, Expression *upr); | |
665 Type *syntaxCopy(); | |
666 Type *semantic(Loc loc, Scope *sc); | |
667 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
668 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
669 }; | |
670 | |
379
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
671 //LLVMDC |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
672 struct TypeOpaque : Type |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
673 { |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
674 TypeOpaque() : Type(Topaque, NULL) {} |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
675 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
676 }; |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
677 |
159 | 678 /**************************************************************/ |
679 | |
680 //enum InOut { None, In, Out, InOut, Lazy }; | |
681 | |
682 struct Argument : Object | |
683 { | |
684 //enum InOut inout; | |
685 unsigned storageClass; | |
686 Type *type; | |
687 Identifier *ident; | |
688 Expression *defaultArg; | |
689 | |
690 Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg); | |
691 Argument *syntaxCopy(); | |
692 Type *isLazyArray(); | |
693 void toDecoBuffer(OutBuffer *buf); | |
694 static Arguments *arraySyntaxCopy(Arguments *args); | |
695 static char *argsTypesToChars(Arguments *args, int varargs); | |
696 static void argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Arguments *arguments, int varargs); | |
697 static void argsToDecoBuffer(OutBuffer *buf, Arguments *arguments); | |
698 static size_t dim(Arguments *arguments); | |
699 static Argument *getNth(Arguments *arguments, size_t nth, size_t *pn = NULL); | |
217
0806379a5eca
[svn r233] Added: -oq command line option for writing fully qualified object names.
lindquist
parents:
211
diff
changeset
|
700 |
0806379a5eca
[svn r233] Added: -oq command line option for writing fully qualified object names.
lindquist
parents:
211
diff
changeset
|
701 // LLVMDC |
0806379a5eca
[svn r233] Added: -oq command line option for writing fully qualified object names.
lindquist
parents:
211
diff
changeset
|
702 bool llvmByVal; |
159 | 703 }; |
704 | |
705 extern int PTRSIZE; | |
706 extern int REALSIZE; | |
707 extern int REALPAD; | |
708 extern int Tsize_t; | |
709 extern int Tptrdiff_t; | |
710 | |
711 #endif /* DMD_MTYPE_H */ |