Mercurial > projects > ldc
annotate dmd/mtype.h @ 323:0d52412d5b1a trunk
[svn r344] Fixed some very minor issues with the usage listing when calling llvmdc with no arguments.
Changed the way moduleinfo is registered to use the same approach as DMD, this eliminates the need for correct linking order and should make the way for using a natively compiled runtime library. This should speed up linking tremendously and should now be possible.
Fixed the llvm.used array to only be emitted if really necessary.
author | lindquist |
---|---|
date | Wed, 09 Jul 2008 23:43:51 +0200 |
parents | 0806379a5eca |
children | aaade6ded589 |
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); | |
211
f66219e0d530
[svn r227] Fixed: crash in lifetime.d when resizing array of AAs by .length assignment.
lindquist
parents:
173
diff
changeset
|
363 int isZeroInit(); |
159 | 364 int checkBoolean(); |
365 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
366 int hasPointers(); | |
367 | |
368 // Back end | |
369 Symbol *aaGetSymbol(char *func, int flags); | |
370 | |
371 type *toCtype(); | |
372 }; | |
373 | |
374 struct TypePointer : Type | |
375 { | |
376 TypePointer(Type *t); | |
377 Type *syntaxCopy(); | |
378 Type *semantic(Loc loc, Scope *sc); | |
379 d_uns64 size(Loc loc); | |
380 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
381 MATCH implicitConvTo(Type *to); | |
382 int isscalar(); | |
383 Expression *defaultInit(Loc loc); | |
384 int isZeroInit(); | |
385 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
386 int hasPointers(); | |
387 | |
388 type *toCtype(); | |
389 }; | |
390 | |
391 struct TypeReference : Type | |
392 { | |
393 TypeReference(Type *t); | |
394 Type *syntaxCopy(); | |
395 d_uns64 size(Loc loc); | |
396 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
397 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
398 Expression *defaultInit(Loc loc); | |
399 int isZeroInit(); | |
400 }; | |
401 | |
402 enum RET | |
403 { | |
404 RETregs = 1, // returned in registers | |
405 RETstack = 2, // returned on stack | |
406 }; | |
407 | |
408 struct TypeFunction : Type | |
409 { | |
410 Arguments *parameters; // function parameters | |
411 int varargs; // 1: T t, ...) style for variable number of arguments | |
412 // 2: T t ...) style for variable number of arguments | |
413 enum LINK linkage; // calling convention | |
414 | |
415 int inuse; | |
416 | |
417 TypeFunction(Arguments *parameters, Type *treturn, int varargs, enum LINK linkage); | |
418 Type *syntaxCopy(); | |
419 Type *semantic(Loc loc, Scope *sc); | |
420 void toDecoBuffer(OutBuffer *buf); | |
421 void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
422 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
423 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
424 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
425 Type *reliesOnTident(); | |
426 | |
427 int callMatch(Expressions *toargs); | |
428 type *toCtype(); | |
429 enum RET retStyle(); | |
430 | |
431 unsigned totym(); | |
432 | |
433 bool llvmRetInPtr; | |
434 bool llvmUsesThis; | |
435 }; | |
436 | |
437 struct TypeDelegate : Type | |
438 { | |
439 TypeDelegate(Type *t); | |
440 Type *syntaxCopy(); | |
441 Type *semantic(Loc loc, Scope *sc); | |
442 d_uns64 size(Loc loc); | |
443 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
444 Expression *defaultInit(Loc loc); | |
445 int isZeroInit(); | |
446 int checkBoolean(); | |
447 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
448 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
449 int hasPointers(); | |
450 | |
451 type *toCtype(); | |
452 }; | |
453 | |
454 struct TypeQualified : Type | |
455 { | |
456 Loc loc; | |
457 Array idents; // array of Identifier's representing ident.ident.ident etc. | |
458 | |
459 TypeQualified(TY ty, Loc loc); | |
460 void syntaxCopyHelper(TypeQualified *t); | |
461 void addIdent(Identifier *ident); | |
462 void toCBuffer2Helper(OutBuffer *buf, HdrGenState *hgs); | |
463 d_uns64 size(Loc loc); | |
464 void resolveHelper(Loc loc, Scope *sc, Dsymbol *s, Dsymbol *scopesym, | |
465 Expression **pe, Type **pt, Dsymbol **ps); | |
466 }; | |
467 | |
468 struct TypeIdentifier : TypeQualified | |
469 { | |
470 Identifier *ident; | |
471 | |
472 TypeIdentifier(Loc loc, Identifier *ident); | |
473 Type *syntaxCopy(); | |
474 //char *toChars(); | |
475 void toDecoBuffer(OutBuffer *buf); | |
476 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
477 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
478 Dsymbol *toDsymbol(Scope *sc); | |
479 Type *semantic(Loc loc, Scope *sc); | |
480 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
481 Type *reliesOnTident(); | |
482 Expression *toExpression(); | |
483 }; | |
484 | |
485 /* Similar to TypeIdentifier, but with a TemplateInstance as the root | |
486 */ | |
487 struct TypeInstance : TypeQualified | |
488 { | |
489 TemplateInstance *tempinst; | |
490 | |
491 TypeInstance(Loc loc, TemplateInstance *tempinst); | |
492 Type *syntaxCopy(); | |
493 //char *toChars(); | |
494 //void toDecoBuffer(OutBuffer *buf); | |
495 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
496 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
497 Type *semantic(Loc loc, Scope *sc); | |
498 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
499 }; | |
500 | |
501 struct TypeTypeof : TypeQualified | |
502 { | |
503 Expression *exp; | |
504 | |
505 TypeTypeof(Loc loc, Expression *exp); | |
506 Type *syntaxCopy(); | |
507 Dsymbol *toDsymbol(Scope *sc); | |
508 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
509 Type *semantic(Loc loc, Scope *sc); | |
510 d_uns64 size(Loc loc); | |
511 }; | |
512 | |
513 struct TypeStruct : Type | |
514 { | |
515 StructDeclaration *sym; | |
516 | |
517 TypeStruct(StructDeclaration *sym); | |
518 d_uns64 size(Loc loc); | |
519 unsigned alignsize(); | |
520 char *toChars(); | |
521 Type *syntaxCopy(); | |
522 Type *semantic(Loc loc, Scope *sc); | |
523 Dsymbol *toDsymbol(Scope *sc); | |
524 void toDecoBuffer(OutBuffer *buf); | |
525 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
526 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
527 unsigned memalign(unsigned salign); | |
528 Expression *defaultInit(Loc loc); | |
529 int isZeroInit(); | |
530 int checkBoolean(); | |
531 dt_t **toDt(dt_t **pdt); | |
532 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
533 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
534 int hasPointers(); | |
535 | |
536 type *toCtype(); | |
537 }; | |
538 | |
539 struct TypeEnum : Type | |
540 { | |
541 EnumDeclaration *sym; | |
542 | |
543 TypeEnum(EnumDeclaration *sym); | |
544 d_uns64 size(Loc loc); | |
545 unsigned alignsize(); | |
546 char *toChars(); | |
547 Type *semantic(Loc loc, Scope *sc); | |
548 Dsymbol *toDsymbol(Scope *sc); | |
549 void toDecoBuffer(OutBuffer *buf); | |
550 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
551 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
552 Expression *getProperty(Loc loc, Identifier *ident); | |
553 int isintegral(); | |
554 int isfloating(); | |
555 int isscalar(); | |
556 int isunsigned(); | |
557 MATCH implicitConvTo(Type *to); | |
558 Type *toBasetype(); | |
559 Expression *defaultInit(Loc loc); | |
560 int isZeroInit(); | |
561 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
562 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
563 int hasPointers(); | |
564 | |
565 type *toCtype(); | |
566 }; | |
567 | |
568 struct TypeTypedef : Type | |
569 { | |
570 TypedefDeclaration *sym; | |
571 | |
572 TypeTypedef(TypedefDeclaration *sym); | |
573 Type *syntaxCopy(); | |
574 d_uns64 size(Loc loc); | |
575 unsigned alignsize(); | |
576 char *toChars(); | |
577 Type *semantic(Loc loc, Scope *sc); | |
578 Dsymbol *toDsymbol(Scope *sc); | |
579 void toDecoBuffer(OutBuffer *buf); | |
580 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
581 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
582 Expression *getProperty(Loc loc, Identifier *ident); | |
583 int isbit(); | |
584 int isintegral(); | |
585 int isfloating(); | |
586 int isreal(); | |
587 int isimaginary(); | |
588 int iscomplex(); | |
589 int isscalar(); | |
590 int isunsigned(); | |
591 int checkBoolean(); | |
592 Type *toBasetype(); | |
593 MATCH implicitConvTo(Type *to); | |
594 Expression *defaultInit(Loc loc); | |
595 int isZeroInit(); | |
596 dt_t **toDt(dt_t **pdt); | |
597 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
598 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
599 int hasPointers(); | |
600 | |
601 type *toCtype(); | |
602 type *toCParamtype(); | |
603 }; | |
604 | |
605 struct TypeClass : Type | |
606 { | |
607 ClassDeclaration *sym; | |
608 | |
609 TypeClass(ClassDeclaration *sym); | |
610 d_uns64 size(Loc loc); | |
611 char *toChars(); | |
612 Type *syntaxCopy(); | |
613 Type *semantic(Loc loc, Scope *sc); | |
614 Dsymbol *toDsymbol(Scope *sc); | |
615 void toDecoBuffer(OutBuffer *buf); | |
616 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
617 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
618 ClassDeclaration *isClassHandle(); | |
619 int isBaseOf(Type *t, int *poffset); | |
620 MATCH implicitConvTo(Type *to); | |
621 Expression *defaultInit(Loc loc); | |
622 int isZeroInit(); | |
623 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
624 int isauto(); | |
625 int checkBoolean(); | |
626 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
627 int hasPointers(); | |
628 | |
629 type *toCtype(); | |
630 | |
631 Symbol *toSymbol(); | |
632 }; | |
633 | |
634 struct TypeTuple : Type | |
635 { | |
636 Arguments *arguments; // types making up the tuple | |
637 | |
638 TypeTuple(Arguments *arguments); | |
639 TypeTuple(Expressions *exps); | |
640 Type *syntaxCopy(); | |
641 Type *semantic(Loc loc, Scope *sc); | |
642 int equals(Object *o); | |
643 Type *reliesOnTident(); | |
644 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
645 void toDecoBuffer(OutBuffer *buf); | |
646 Expression *getProperty(Loc loc, Identifier *ident); | |
647 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
648 }; | |
649 | |
650 struct TypeSlice : Type | |
651 { | |
652 Expression *lwr; | |
653 Expression *upr; | |
654 | |
655 TypeSlice(Type *next, Expression *lwr, Expression *upr); | |
656 Type *syntaxCopy(); | |
657 Type *semantic(Loc loc, Scope *sc); | |
658 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
659 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
660 }; | |
661 | |
662 /**************************************************************/ | |
663 | |
664 //enum InOut { None, In, Out, InOut, Lazy }; | |
665 | |
666 struct Argument : Object | |
667 { | |
668 //enum InOut inout; | |
669 unsigned storageClass; | |
670 Type *type; | |
671 Identifier *ident; | |
672 Expression *defaultArg; | |
673 | |
674 Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg); | |
675 Argument *syntaxCopy(); | |
676 Type *isLazyArray(); | |
677 void toDecoBuffer(OutBuffer *buf); | |
678 static Arguments *arraySyntaxCopy(Arguments *args); | |
679 static char *argsTypesToChars(Arguments *args, int varargs); | |
680 static void argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Arguments *arguments, int varargs); | |
681 static void argsToDecoBuffer(OutBuffer *buf, Arguments *arguments); | |
682 static size_t dim(Arguments *arguments); | |
683 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
|
684 |
0806379a5eca
[svn r233] Added: -oq command line option for writing fully qualified object names.
lindquist
parents:
211
diff
changeset
|
685 // LLVMDC |
0806379a5eca
[svn r233] Added: -oq command line option for writing fully qualified object names.
lindquist
parents:
211
diff
changeset
|
686 bool llvmByVal; |
159 | 687 }; |
688 | |
689 extern int PTRSIZE; | |
690 extern int REALSIZE; | |
691 extern int REALPAD; | |
692 extern int Tsize_t; | |
693 extern int Tptrdiff_t; | |
694 | |
695 #endif /* DMD_MTYPE_H */ |