comparison dmd/mtype.h @ 1:c53b6e3fe49a trunk

[svn r5] Initial commit. Most things are very rough.
author lindquist
date Sat, 01 Sep 2007 21:43:27 +0200
parents
children dafae18f9c08
comparison
equal deleted inserted replaced
0:a9e71648e74d 1:c53b6e3fe49a
1
2 // Compiler implementation of the D programming language
3 // Copyright (c) 1999-2007 by Digital Mars
4 // All Rights Reserved
5 // written by Walter Bright
6 // http://www.digitalmars.com
7 // License for redistribution is by either the Artistic License
8 // in artistic.txt, or the GNU General Public License in gnu.txt.
9 // See the included readme.txt for details.
10
11 #ifndef DMD_MTYPE_H
12 #define DMD_MTYPE_H
13
14 #ifdef __DMC__
15 #pragma once
16 #endif /* __DMC__ */
17
18 #include "root.h"
19 #include "stringtable.h"
20
21 #include "arraytypes.h"
22 #include "expression.h"
23
24 namespace llvm
25 {
26 class Value;
27 class Type;
28 class Instruction;
29 }
30
31 struct Scope;
32 struct Identifier;
33 struct Expression;
34 struct StructDeclaration;
35 struct ClassDeclaration;
36 struct VarDeclaration;
37 struct EnumDeclaration;
38 struct TypedefDeclaration;
39 struct TypeInfoDeclaration;
40 struct Dsymbol;
41 struct TemplateInstance;
42 enum LINK;
43
44 struct TypeBasic;
45 struct HdrGenState;
46
47 // Back end
48 #if IN_GCC
49 union tree_node; typedef union tree_node TYPE;
50 typedef TYPE type;
51 #else
52 typedef struct TYPE type;
53 #endif
54 struct Symbol;
55
56 enum TY
57 {
58 Tarray, // dynamic array
59 Tsarray, // static array
60 Taarray, // associative array
61 Tpointer,
62 Treference,
63 Tfunction,
64 Tident,
65 Tclass,
66 Tstruct,
67 Tenum,
68 Ttypedef,
69 Tdelegate,
70
71 Tnone,
72 Tvoid,
73 Tint8,
74 Tuns8,
75 Tint16,
76 Tuns16,
77 Tint32,
78 Tuns32,
79 Tint64,
80 Tuns64,
81 Tfloat32,
82 Tfloat64,
83 Tfloat80,
84
85 Timaginary32,
86 Timaginary64,
87 Timaginary80,
88
89 Tcomplex32,
90 Tcomplex64,
91 Tcomplex80,
92
93 Tbit,
94 Tbool,
95 Tchar,
96 Twchar,
97 Tdchar,
98
99 Terror,
100 Tinstance,
101 Ttypeof,
102 Ttuple,
103 Tslice,
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 Type *next;
116 char *deco;
117 Type *pto; // merged pointer to this type
118 Type *rto; // reference to this type
119 Type *arrayof; // array of this type
120 TypeInfoDeclaration *vtinfo; // TypeInfo object for this Type
121
122 type *ctype; // for back end
123
124 #define tvoid basic[Tvoid]
125 #define tint8 basic[Tint8]
126 #define tuns8 basic[Tuns8]
127 #define tint16 basic[Tint16]
128 #define tuns16 basic[Tuns16]
129 #define tint32 basic[Tint32]
130 #define tuns32 basic[Tuns32]
131 #define tint64 basic[Tint64]
132 #define tuns64 basic[Tuns64]
133 #define tfloat32 basic[Tfloat32]
134 #define tfloat64 basic[Tfloat64]
135 #define tfloat80 basic[Tfloat80]
136
137 #define timaginary32 basic[Timaginary32]
138 #define timaginary64 basic[Timaginary64]
139 #define timaginary80 basic[Timaginary80]
140
141 #define tcomplex32 basic[Tcomplex32]
142 #define tcomplex64 basic[Tcomplex64]
143 #define tcomplex80 basic[Tcomplex80]
144
145 #define tbit basic[Tbit]
146 #define tbool basic[Tbool]
147 #define tchar basic[Tchar]
148 #define twchar basic[Twchar]
149 #define tdchar basic[Tdchar]
150
151 // Some special types
152 #define tshiftcnt tint32 // right side of shift expression
153 // #define tboolean tint32 // result of boolean expression
154 #define tboolean tbool // result of boolean expression
155 #define tindex tint32 // array/ptr index
156 static Type *tvoidptr; // void*
157 #define terror basic[Terror] // for error recovery
158
159 #define tsize_t basic[Tsize_t] // matches size_t alias
160 #define tptrdiff_t basic[Tptrdiff_t] // matches ptrdiff_t alias
161 #define thash_t tsize_t // matches hash_t alias
162
163 static ClassDeclaration *typeinfo;
164 static ClassDeclaration *typeinfoclass;
165 static ClassDeclaration *typeinfointerface;
166 static ClassDeclaration *typeinfostruct;
167 static ClassDeclaration *typeinfotypedef;
168 static ClassDeclaration *typeinfopointer;
169 static ClassDeclaration *typeinfoarray;
170 static ClassDeclaration *typeinfostaticarray;
171 static ClassDeclaration *typeinfoassociativearray;
172 static ClassDeclaration *typeinfoenum;
173 static ClassDeclaration *typeinfofunction;
174 static ClassDeclaration *typeinfodelegate;
175 static ClassDeclaration *typeinfotypelist;
176
177 static Type *basic[TMAX];
178 static unsigned char mangleChar[TMAX];
179 static StringTable stringtable;
180
181 // These tables are for implicit conversion of binary ops;
182 // the indices are the type of operand one, followed by operand two.
183 static unsigned char impcnvResult[TMAX][TMAX];
184 static unsigned char impcnvType1[TMAX][TMAX];
185 static unsigned char impcnvType2[TMAX][TMAX];
186
187 // If !=0, give warning on implicit conversion
188 static unsigned char impcnvWarn[TMAX][TMAX];
189
190 Type(TY ty, Type *next);
191 virtual Type *syntaxCopy();
192 int equals(Object *o);
193 int dyncast() { return DYNCAST_TYPE; } // kludge for template.isType()
194 int covariant(Type *t);
195 char *toChars();
196 static char needThisPrefix();
197 static void init();
198 d_uns64 size();
199 virtual d_uns64 size(Loc loc);
200 virtual unsigned alignsize();
201 virtual Type *semantic(Loc loc, Scope *sc);
202 virtual void toDecoBuffer(OutBuffer *buf);
203 virtual void toTypeInfoBuffer(OutBuffer *buf);
204 Type *merge();
205 void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
206 virtual void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
207 virtual int isbit();
208 virtual int isintegral();
209 virtual int isfloating(); // real, imaginary, or complex
210 virtual int isreal();
211 virtual int isimaginary();
212 virtual int iscomplex();
213 virtual int isscalar();
214 virtual int isunsigned();
215 virtual int isauto();
216 virtual int isString();
217 virtual int checkBoolean(); // if can be converted to boolean value
218 void checkDeprecated(Loc loc, Scope *sc);
219 Type *pointerTo();
220 Type *referenceTo();
221 Type *arrayOf();
222 virtual Dsymbol *toDsymbol(Scope *sc);
223 virtual Type *toBasetype();
224 virtual int isBaseOf(Type *t, int *poffset);
225 virtual MATCH implicitConvTo(Type *to);
226 virtual ClassDeclaration *isClassHandle();
227 virtual Expression *getProperty(Loc loc, Identifier *ident);
228 virtual Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
229 virtual unsigned memalign(unsigned salign);
230 virtual Expression *defaultInit();
231 virtual int isZeroInit(); // if initializer is 0
232 virtual dt_t **toDt(dt_t **pdt);
233 Identifier *getTypeInfoIdent(int internal);
234 virtual MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
235 virtual void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps);
236 Expression *getInternalTypeInfo(Scope *sc);
237 Expression *getTypeInfo(Scope *sc);
238 virtual TypeInfoDeclaration *getTypeInfoDeclaration();
239 virtual int builtinTypeInfo();
240 virtual Type *reliesOnTident();
241 virtual Expression *toExpression();
242 virtual int hasPointers();
243 Type *nextOf() { return next; }
244
245 static void error(Loc loc, const char *format, ...);
246
247 // For backend
248 virtual unsigned totym();
249 virtual type *toCtype();
250 virtual type *toCParamtype();
251 virtual Symbol *toSymbol();
252
253 llvm::Type* llvmType;
254
255 // For eliminating dynamic_cast
256 virtual TypeBasic *isTypeBasic();
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, Identifier *ident, HdrGenState *hgs);
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();
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 virtual void toPrettyBracket(OutBuffer *buf, HdrGenState *hgs) = 0;
294 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
295 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
296 };
297
298 // Static array, one with a fixed dimension
299 struct TypeSArray : TypeArray
300 {
301 Expression *dim;
302
303 TypeSArray(Type *t, Expression *dim);
304 Type *syntaxCopy();
305 d_uns64 size(Loc loc);
306 unsigned alignsize();
307 Type *semantic(Loc loc, Scope *sc);
308 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps);
309 void toDecoBuffer(OutBuffer *buf);
310 void toTypeInfoBuffer(OutBuffer *buf);
311 void toPrettyBracket(OutBuffer *buf, HdrGenState *hgs);
312 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
313 int isString();
314 int isZeroInit();
315 unsigned memalign(unsigned salign);
316 MATCH implicitConvTo(Type *to);
317 Expression *defaultInit();
318 dt_t **toDt(dt_t **pdt);
319 dt_t **toDtElem(dt_t **pdt, Expression *e);
320 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
321 TypeInfoDeclaration *getTypeInfoDeclaration();
322 Expression *toExpression();
323 int hasPointers();
324
325 type *toCtype();
326 type *toCParamtype();
327 };
328
329 // Dynamic array, no dimension
330 struct TypeDArray : TypeArray
331 {
332 TypeDArray(Type *t);
333 Type *syntaxCopy();
334 d_uns64 size(Loc loc);
335 unsigned alignsize();
336 Type *semantic(Loc loc, Scope *sc);
337 void toDecoBuffer(OutBuffer *buf);
338 void toTypeInfoBuffer(OutBuffer *buf);
339 void toPrettyBracket(OutBuffer *buf, HdrGenState *hgs);
340 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
341 int isString();
342 int isZeroInit();
343 int checkBoolean();
344 MATCH implicitConvTo(Type *to);
345 Expression *defaultInit();
346 int builtinTypeInfo();
347 TypeInfoDeclaration *getTypeInfoDeclaration();
348 int hasPointers();
349
350 type *toCtype();
351 };
352
353 struct TypeAArray : TypeArray
354 {
355 Type *index; // key type for type checking
356 Type *key; // actual key type
357
358 TypeAArray(Type *t, Type *index);
359 Type *syntaxCopy();
360 d_uns64 size(Loc loc);
361 Type *semantic(Loc loc, Scope *sc);
362 void toDecoBuffer(OutBuffer *buf);
363 void toPrettyBracket(OutBuffer *buf, HdrGenState *hgs);
364 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
365 Expression *defaultInit();
366 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
367 int checkBoolean();
368 TypeInfoDeclaration *getTypeInfoDeclaration();
369 int hasPointers();
370
371 // Back end
372 Symbol *aaGetSymbol(char *func, int flags);
373
374 type *toCtype();
375 };
376
377 struct TypePointer : Type
378 {
379 TypePointer(Type *t);
380 Type *syntaxCopy();
381 Type *semantic(Loc loc, Scope *sc);
382 d_uns64 size(Loc loc);
383 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
384 MATCH implicitConvTo(Type *to);
385 int isscalar();
386 Expression *defaultInit();
387 int isZeroInit();
388 TypeInfoDeclaration *getTypeInfoDeclaration();
389 int hasPointers();
390
391 type *toCtype();
392 };
393
394 struct TypeReference : Type
395 {
396 TypeReference(Type *t);
397 Type *syntaxCopy();
398 d_uns64 size(Loc loc);
399 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
400 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
401 Expression *defaultInit();
402 int isZeroInit();
403 };
404
405 enum RET
406 {
407 RETregs = 1, // returned in registers
408 RETstack = 2, // returned on stack
409 };
410
411 struct TypeFunction : Type
412 {
413 Arguments *parameters; // function parameters
414 int varargs; // 1: T t, ...) style for variable number of arguments
415 // 2: T t ...) style for variable number of arguments
416 enum LINK linkage; // calling convention
417
418 int inuse;
419
420 TypeFunction(Arguments *parameters, Type *treturn, int varargs, enum LINK linkage);
421 Type *syntaxCopy();
422 Type *semantic(Loc loc, Scope *sc);
423 void toDecoBuffer(OutBuffer *buf);
424 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
425 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
426 TypeInfoDeclaration *getTypeInfoDeclaration();
427 Type *reliesOnTident();
428
429 int callMatch(Expressions *toargs);
430 type *toCtype();
431 enum RET retStyle();
432
433 unsigned totym();
434
435 bool llvmRetInPtr;
436 llvm::Value* llvmRetArg;
437 llvm::Instruction* llvmAllocaPoint;
438 };
439
440 struct TypeDelegate : Type
441 {
442 TypeDelegate(Type *t);
443 Type *syntaxCopy();
444 Type *semantic(Loc loc, Scope *sc);
445 d_uns64 size(Loc loc);
446 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
447 Expression *defaultInit();
448 int isZeroInit();
449 int checkBoolean();
450 TypeInfoDeclaration *getTypeInfoDeclaration();
451 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
452 int hasPointers();
453
454 type *toCtype();
455 };
456
457 struct TypeQualified : Type
458 {
459 Loc loc;
460 Array idents; // array of Identifier's representing ident.ident.ident etc.
461
462 TypeQualified(TY ty, Loc loc);
463 void syntaxCopyHelper(TypeQualified *t);
464 void addIdent(Identifier *ident);
465 void toCBuffer2Helper(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
466 d_uns64 size(Loc loc);
467 void resolveHelper(Loc loc, Scope *sc, Dsymbol *s, Dsymbol *scopesym,
468 Expression **pe, Type **pt, Dsymbol **ps);
469 };
470
471 struct TypeIdentifier : TypeQualified
472 {
473 Identifier *ident;
474
475 TypeIdentifier(Loc loc, Identifier *ident);
476 Type *syntaxCopy();
477 //char *toChars();
478 void toDecoBuffer(OutBuffer *buf);
479 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
480 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps);
481 Dsymbol *toDsymbol(Scope *sc);
482 Type *semantic(Loc loc, Scope *sc);
483 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
484 Type *reliesOnTident();
485 Expression *toExpression();
486 };
487
488 /* Similar to TypeIdentifier, but with a TemplateInstance as the root
489 */
490 struct TypeInstance : TypeQualified
491 {
492 TemplateInstance *tempinst;
493
494 TypeInstance(Loc loc, TemplateInstance *tempinst);
495 Type *syntaxCopy();
496 //char *toChars();
497 //void toDecoBuffer(OutBuffer *buf);
498 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
499 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps);
500 Type *semantic(Loc loc, Scope *sc);
501 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
502 };
503
504 struct TypeTypeof : TypeQualified
505 {
506 Expression *exp;
507
508 TypeTypeof(Loc loc, Expression *exp);
509 Type *syntaxCopy();
510 Dsymbol *toDsymbol(Scope *sc);
511 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
512 Type *semantic(Loc loc, Scope *sc);
513 d_uns64 size(Loc loc);
514 };
515
516 struct TypeStruct : Type
517 {
518 StructDeclaration *sym;
519
520 TypeStruct(StructDeclaration *sym);
521 d_uns64 size(Loc loc);
522 unsigned alignsize();
523 char *toChars();
524 Type *syntaxCopy();
525 Type *semantic(Loc loc, Scope *sc);
526 Dsymbol *toDsymbol(Scope *sc);
527 void toDecoBuffer(OutBuffer *buf);
528 void toTypeInfoBuffer(OutBuffer *buf);
529 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
530 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
531 unsigned memalign(unsigned salign);
532 Expression *defaultInit();
533 int isZeroInit();
534 int checkBoolean();
535 dt_t **toDt(dt_t **pdt);
536 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
537 TypeInfoDeclaration *getTypeInfoDeclaration();
538 int hasPointers();
539
540 type *toCtype();
541
542 llvm::Value* llvmInit;
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();
566 Expression *defaultInit();
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);
590 int isbit();
591 int isintegral();
592 int isfloating();
593 int isreal();
594 int isimaginary();
595 int iscomplex();
596 int isscalar();
597 int isunsigned();
598 int checkBoolean();
599 Type *toBasetype();
600 MATCH implicitConvTo(Type *to);
601 Expression *defaultInit();
602 int isZeroInit();
603 dt_t **toDt(dt_t **pdt);
604 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
605 TypeInfoDeclaration *getTypeInfoDeclaration();
606 int hasPointers();
607
608 type *toCtype();
609 type *toCParamtype();
610 };
611
612 struct TypeClass : Type
613 {
614 ClassDeclaration *sym;
615
616 TypeClass(ClassDeclaration *sym);
617 d_uns64 size(Loc loc);
618 char *toChars();
619 Type *syntaxCopy();
620 Type *semantic(Loc loc, Scope *sc);
621 Dsymbol *toDsymbol(Scope *sc);
622 void toDecoBuffer(OutBuffer *buf);
623 void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
624 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
625 ClassDeclaration *isClassHandle();
626 int isBaseOf(Type *t, int *poffset);
627 MATCH implicitConvTo(Type *to);
628 Expression *defaultInit();
629 int isZeroInit();
630 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
631 int isauto();
632 int checkBoolean();
633 TypeInfoDeclaration *getTypeInfoDeclaration();
634 int hasPointers();
635
636 type *toCtype();
637
638 Symbol *toSymbol();
639
640 llvm::Value* llvmInit;
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, Identifier *ident, HdrGenState *hgs);
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, Identifier *ident, HdrGenState *hgs);
669 };
670
671 /**************************************************************/
672
673 //enum InOut { None, In, Out, InOut, Lazy };
674
675 struct Argument : Object
676 {
677 //enum InOut inout;
678 unsigned storageClass;
679 Type *type;
680 Identifier *ident;
681 Expression *defaultArg;
682
683 Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg);
684 Argument *syntaxCopy();
685 Type *isLazyArray();
686 void toDecoBuffer(OutBuffer *buf);
687 static Arguments *arraySyntaxCopy(Arguments *args);
688 static char *argsTypesToChars(Arguments *args, int varargs);
689 static void argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Arguments *arguments, int varargs);
690 static void argsToDecoBuffer(OutBuffer *buf, Arguments *arguments);
691 static size_t dim(Arguments *arguments);
692 static Argument *getNth(Arguments *arguments, size_t nth, size_t *pn = NULL);
693
694 // backend
695 bool llvmCopy;
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 */