Mercurial > projects > ldc
annotate dmd/mtype.h @ 859:a719f2ca3e92
Applied modification of wilsonk's patch for AndAnd and OrOrExp for void rhs funcs.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Wed, 17 Dec 2008 21:24:17 +0100 |
parents | 340acf1535d0 |
children | 330f999ade44 |
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 |
159 | 101 TMAX |
102 }; | |
103 | |
104 #define Tascii Tchar | |
105 | |
106 extern int Tsize_t; | |
107 extern int Tptrdiff_t; | |
108 | |
109 struct Type : Object | |
110 { | |
111 TY ty; | |
112 unsigned char mod; // modifiers (MODconst, MODinvariant) | |
113 #define MODconst 1 // type is const | |
114 #define MODinvariant 2 // type is invariant | |
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 Type *merge(); | |
204 virtual void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
205 virtual void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
206 void toCBuffer3(OutBuffer *buf, HdrGenState *hgs, int mod); | |
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(Loc loc = 0); | |
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 // For eliminating dynamic_cast | |
254 virtual TypeBasic *isTypeBasic(); | |
173
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
255 |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
658
diff
changeset
|
256 // LDC |
173
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
257 IrType ir; |
159 | 258 }; |
259 | |
260 struct TypeBasic : Type | |
261 { | |
658
50383e476c7e
Upgraded frontend to DMD 1.035
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
508
diff
changeset
|
262 const char *dstring; |
50383e476c7e
Upgraded frontend to DMD 1.035
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
508
diff
changeset
|
263 const char *cstring; |
159 | 264 unsigned flags; |
265 | |
266 TypeBasic(TY ty); | |
267 Type *syntaxCopy(); | |
268 d_uns64 size(Loc loc); | |
269 unsigned alignsize(); | |
270 Expression *getProperty(Loc loc, Identifier *ident); | |
271 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
272 char *toChars(); | |
273 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
274 int isintegral(); | |
275 int isbit(); | |
276 int isfloating(); | |
277 int isreal(); | |
278 int isimaginary(); | |
279 int iscomplex(); | |
280 int isscalar(); | |
281 int isunsigned(); | |
282 MATCH implicitConvTo(Type *to); | |
283 Expression *defaultInit(Loc loc); | |
284 int isZeroInit(); | |
285 int builtinTypeInfo(); | |
286 | |
287 // For eliminating dynamic_cast | |
288 TypeBasic *isTypeBasic(); | |
289 }; | |
290 | |
291 struct TypeArray : Type | |
292 { | |
293 TypeArray(TY ty, Type *next); | |
294 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
295 }; | |
296 | |
297 // Static array, one with a fixed dimension | |
298 struct TypeSArray : TypeArray | |
299 { | |
300 Expression *dim; | |
301 | |
302 TypeSArray(Type *t, Expression *dim); | |
303 Type *syntaxCopy(); | |
304 d_uns64 size(Loc loc); | |
305 unsigned alignsize(); | |
306 Type *semantic(Loc loc, Scope *sc); | |
307 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
308 void toDecoBuffer(OutBuffer *buf); | |
309 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
310 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
311 int isString(); | |
312 int isZeroInit(); | |
313 unsigned memalign(unsigned salign); | |
314 MATCH implicitConvTo(Type *to); | |
315 Expression *defaultInit(Loc loc); | |
316 dt_t **toDt(dt_t **pdt); | |
317 dt_t **toDtElem(dt_t **pdt, Expression *e); | |
318 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
319 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
320 Expression *toExpression(); | |
321 int hasPointers(); | |
322 | |
323 type *toCtype(); | |
324 type *toCParamtype(); | |
325 }; | |
326 | |
327 // Dynamic array, no dimension | |
328 struct TypeDArray : TypeArray | |
329 { | |
330 TypeDArray(Type *t); | |
331 Type *syntaxCopy(); | |
332 d_uns64 size(Loc loc); | |
333 unsigned alignsize(); | |
334 Type *semantic(Loc loc, Scope *sc); | |
335 void toDecoBuffer(OutBuffer *buf); | |
336 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
337 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
338 int isString(); | |
339 int isZeroInit(); | |
340 int checkBoolean(); | |
341 MATCH implicitConvTo(Type *to); | |
342 Expression *defaultInit(Loc loc); | |
343 int builtinTypeInfo(); | |
344 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
345 int hasPointers(); | |
346 | |
347 type *toCtype(); | |
348 }; | |
349 | |
350 struct TypeAArray : TypeArray | |
351 { | |
352 Type *index; // key type for type checking | |
353 Type *key; // actual key type | |
354 | |
355 TypeAArray(Type *t, Type *index); | |
356 Type *syntaxCopy(); | |
357 d_uns64 size(Loc loc); | |
358 Type *semantic(Loc loc, Scope *sc); | |
336 | 359 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); |
159 | 360 void toDecoBuffer(OutBuffer *buf); |
361 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
362 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
363 Expression *defaultInit(Loc loc); | |
364 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
|
365 int isZeroInit(); |
159 | 366 int checkBoolean(); |
367 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
368 int hasPointers(); | |
369 | |
370 // Back end | |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
723
diff
changeset
|
371 Symbol *aaGetSymbol(const char *func, int flags); |
159 | 372 |
373 type *toCtype(); | |
374 }; | |
375 | |
376 struct TypePointer : Type | |
377 { | |
378 TypePointer(Type *t); | |
379 Type *syntaxCopy(); | |
380 Type *semantic(Loc loc, Scope *sc); | |
381 d_uns64 size(Loc loc); | |
382 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
383 MATCH implicitConvTo(Type *to); | |
384 int isscalar(); | |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
658
diff
changeset
|
385 // LDC: pointers are unsigned |
411
3545f9eddbfc
Switch TypePointer::isunsigned from false to true, so CmpExp::toElem chooses the right operand for pointer comparisons.
Christian Kamm <kamm incasoftware de>
parents:
379
diff
changeset
|
386 int isunsigned() { return TRUE; }; |
159 | 387 Expression *defaultInit(Loc loc); |
388 int isZeroInit(); | |
389 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
390 int hasPointers(); | |
391 | |
392 type *toCtype(); | |
393 }; | |
394 | |
395 struct TypeReference : Type | |
396 { | |
397 TypeReference(Type *t); | |
398 Type *syntaxCopy(); | |
399 d_uns64 size(Loc loc); | |
400 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
401 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
402 Expression *defaultInit(Loc loc); | |
403 int isZeroInit(); | |
404 }; | |
405 | |
406 enum RET | |
407 { | |
408 RETregs = 1, // returned in registers | |
409 RETstack = 2, // returned on stack | |
410 }; | |
411 | |
412 struct TypeFunction : Type | |
413 { | |
414 Arguments *parameters; // function parameters | |
415 int varargs; // 1: T t, ...) style for variable number of arguments | |
416 // 2: T t ...) style for variable number of arguments | |
417 enum LINK linkage; // calling convention | |
418 | |
419 int inuse; | |
420 | |
421 TypeFunction(Arguments *parameters, Type *treturn, int varargs, enum LINK linkage); | |
422 Type *syntaxCopy(); | |
423 Type *semantic(Loc loc, Scope *sc); | |
424 void toDecoBuffer(OutBuffer *buf); | |
425 void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
426 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
427 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
428 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
429 Type *reliesOnTident(); | |
430 | |
431 int callMatch(Expressions *toargs); | |
432 type *toCtype(); | |
433 enum RET retStyle(); | |
434 | |
435 unsigned totym(); | |
436 | |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
658
diff
changeset
|
437 // LDC |
486
a34078905d01
Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
445
diff
changeset
|
438 bool retInPtr; |
a34078905d01
Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
445
diff
changeset
|
439 bool usesThis; |
a34078905d01
Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
445
diff
changeset
|
440 bool usesNest; |
a34078905d01
Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
445
diff
changeset
|
441 unsigned retAttrs; |
720
e177ae483f8e
Added inreg attribute where appropriate on x86 to follow ABI docs.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
715
diff
changeset
|
442 unsigned thisAttrs; // also used for nest |
723
55f6c2e454d7
Implemented correct parameter order according to x86-32 ABI documentation.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
720
diff
changeset
|
443 |
55f6c2e454d7
Implemented correct parameter order according to x86-32 ABI documentation.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
720
diff
changeset
|
444 bool reverseParams; |
55f6c2e454d7
Implemented correct parameter order according to x86-32 ABI documentation.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
720
diff
changeset
|
445 size_t reverseIndex; |
159 | 446 }; |
447 | |
448 struct TypeDelegate : Type | |
449 { | |
450 TypeDelegate(Type *t); | |
451 Type *syntaxCopy(); | |
452 Type *semantic(Loc loc, Scope *sc); | |
453 d_uns64 size(Loc loc); | |
797
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
758
diff
changeset
|
454 unsigned alignsize(); // added in LDC |
159 | 455 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); |
456 Expression *defaultInit(Loc loc); | |
457 int isZeroInit(); | |
458 int checkBoolean(); | |
459 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
460 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
461 int hasPointers(); | |
462 | |
463 type *toCtype(); | |
464 }; | |
465 | |
466 struct TypeQualified : Type | |
467 { | |
468 Loc loc; | |
469 Array idents; // array of Identifier's representing ident.ident.ident etc. | |
470 | |
471 TypeQualified(TY ty, Loc loc); | |
472 void syntaxCopyHelper(TypeQualified *t); | |
473 void addIdent(Identifier *ident); | |
474 void toCBuffer2Helper(OutBuffer *buf, HdrGenState *hgs); | |
475 d_uns64 size(Loc loc); | |
476 void resolveHelper(Loc loc, Scope *sc, Dsymbol *s, Dsymbol *scopesym, | |
477 Expression **pe, Type **pt, Dsymbol **ps); | |
478 }; | |
479 | |
480 struct TypeIdentifier : TypeQualified | |
481 { | |
482 Identifier *ident; | |
483 | |
484 TypeIdentifier(Loc loc, Identifier *ident); | |
485 Type *syntaxCopy(); | |
486 //char *toChars(); | |
487 void toDecoBuffer(OutBuffer *buf); | |
488 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
489 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
490 Dsymbol *toDsymbol(Scope *sc); | |
491 Type *semantic(Loc loc, Scope *sc); | |
492 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
493 Type *reliesOnTident(); | |
494 Expression *toExpression(); | |
495 }; | |
496 | |
497 /* Similar to TypeIdentifier, but with a TemplateInstance as the root | |
498 */ | |
499 struct TypeInstance : TypeQualified | |
500 { | |
501 TemplateInstance *tempinst; | |
502 | |
503 TypeInstance(Loc loc, TemplateInstance *tempinst); | |
504 Type *syntaxCopy(); | |
505 //char *toChars(); | |
506 //void toDecoBuffer(OutBuffer *buf); | |
507 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
508 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
509 Type *semantic(Loc loc, Scope *sc); | |
510 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
511 }; | |
512 | |
513 struct TypeTypeof : TypeQualified | |
514 { | |
515 Expression *exp; | |
516 | |
517 TypeTypeof(Loc loc, Expression *exp); | |
518 Type *syntaxCopy(); | |
519 Dsymbol *toDsymbol(Scope *sc); | |
520 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
521 Type *semantic(Loc loc, Scope *sc); | |
522 d_uns64 size(Loc loc); | |
523 }; | |
524 | |
525 struct TypeStruct : Type | |
526 { | |
527 StructDeclaration *sym; | |
528 | |
529 TypeStruct(StructDeclaration *sym); | |
530 d_uns64 size(Loc loc); | |
531 unsigned alignsize(); | |
532 char *toChars(); | |
533 Type *syntaxCopy(); | |
534 Type *semantic(Loc loc, Scope *sc); | |
535 Dsymbol *toDsymbol(Scope *sc); | |
536 void toDecoBuffer(OutBuffer *buf); | |
537 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
538 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
539 unsigned memalign(unsigned salign); | |
540 Expression *defaultInit(Loc loc); | |
541 int isZeroInit(); | |
542 int checkBoolean(); | |
543 dt_t **toDt(dt_t **pdt); | |
544 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
545 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
546 int hasPointers(); | |
547 | |
548 type *toCtype(); | |
549 }; | |
550 | |
551 struct TypeEnum : Type | |
552 { | |
553 EnumDeclaration *sym; | |
554 | |
555 TypeEnum(EnumDeclaration *sym); | |
556 d_uns64 size(Loc loc); | |
557 unsigned alignsize(); | |
558 char *toChars(); | |
486
a34078905d01
Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
445
diff
changeset
|
559 Type *syntaxCopy(); |
159 | 560 Type *semantic(Loc loc, Scope *sc); |
561 Dsymbol *toDsymbol(Scope *sc); | |
562 void toDecoBuffer(OutBuffer *buf); | |
563 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
564 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
565 Expression *getProperty(Loc loc, Identifier *ident); | |
566 int isintegral(); | |
567 int isfloating(); | |
568 int isscalar(); | |
569 int isunsigned(); | |
570 MATCH implicitConvTo(Type *to); | |
571 Type *toBasetype(); | |
572 Expression *defaultInit(Loc loc); | |
573 int isZeroInit(); | |
574 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
575 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
576 int hasPointers(); | |
577 | |
578 type *toCtype(); | |
579 }; | |
580 | |
581 struct TypeTypedef : Type | |
582 { | |
583 TypedefDeclaration *sym; | |
584 | |
585 TypeTypedef(TypedefDeclaration *sym); | |
586 Type *syntaxCopy(); | |
587 d_uns64 size(Loc loc); | |
588 unsigned alignsize(); | |
589 char *toChars(); | |
590 Type *semantic(Loc loc, Scope *sc); | |
591 Dsymbol *toDsymbol(Scope *sc); | |
592 void toDecoBuffer(OutBuffer *buf); | |
593 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
594 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
595 Expression *getProperty(Loc loc, Identifier *ident); | |
596 int isbit(); | |
597 int isintegral(); | |
598 int isfloating(); | |
599 int isreal(); | |
600 int isimaginary(); | |
601 int iscomplex(); | |
602 int isscalar(); | |
603 int isunsigned(); | |
604 int checkBoolean(); | |
605 Type *toBasetype(); | |
606 MATCH implicitConvTo(Type *to); | |
607 Expression *defaultInit(Loc loc); | |
608 int isZeroInit(); | |
609 dt_t **toDt(dt_t **pdt); | |
610 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
611 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
612 int hasPointers(); | |
613 | |
614 type *toCtype(); | |
615 type *toCParamtype(); | |
616 }; | |
617 | |
618 struct TypeClass : Type | |
619 { | |
620 ClassDeclaration *sym; | |
621 | |
622 TypeClass(ClassDeclaration *sym); | |
623 d_uns64 size(Loc loc); | |
624 char *toChars(); | |
625 Type *syntaxCopy(); | |
626 Type *semantic(Loc loc, Scope *sc); | |
627 Dsymbol *toDsymbol(Scope *sc); | |
628 void toDecoBuffer(OutBuffer *buf); | |
629 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
630 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
631 ClassDeclaration *isClassHandle(); | |
632 int isBaseOf(Type *t, int *poffset); | |
633 MATCH implicitConvTo(Type *to); | |
634 Expression *defaultInit(Loc loc); | |
635 int isZeroInit(); | |
636 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
637 int isauto(); | |
638 int checkBoolean(); | |
639 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
640 int hasPointers(); | |
641 | |
642 type *toCtype(); | |
643 | |
644 Symbol *toSymbol(); | |
645 }; | |
646 | |
647 struct TypeTuple : Type | |
648 { | |
649 Arguments *arguments; // types making up the tuple | |
650 | |
651 TypeTuple(Arguments *arguments); | |
652 TypeTuple(Expressions *exps); | |
653 Type *syntaxCopy(); | |
654 Type *semantic(Loc loc, Scope *sc); | |
655 int equals(Object *o); | |
656 Type *reliesOnTident(); | |
657 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
658 void toDecoBuffer(OutBuffer *buf); | |
659 Expression *getProperty(Loc loc, Identifier *ident); | |
660 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
661 }; | |
662 | |
663 struct TypeSlice : Type | |
664 { | |
665 Expression *lwr; | |
666 Expression *upr; | |
667 | |
668 TypeSlice(Type *next, Expression *lwr, Expression *upr); | |
669 Type *syntaxCopy(); | |
670 Type *semantic(Loc loc, Scope *sc); | |
671 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
672 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
673 }; | |
674 | |
675 /**************************************************************/ | |
676 | |
677 //enum InOut { None, In, Out, InOut, Lazy }; | |
678 | |
679 struct Argument : Object | |
680 { | |
681 //enum InOut inout; | |
682 unsigned storageClass; | |
683 Type *type; | |
684 Identifier *ident; | |
685 Expression *defaultArg; | |
686 | |
687 Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg); | |
688 Argument *syntaxCopy(); | |
689 Type *isLazyArray(); | |
690 void toDecoBuffer(OutBuffer *buf); | |
691 static Arguments *arraySyntaxCopy(Arguments *args); | |
692 static char *argsTypesToChars(Arguments *args, int varargs); | |
693 static void argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Arguments *arguments, int varargs); | |
694 static void argsToDecoBuffer(OutBuffer *buf, Arguments *arguments); | |
695 static size_t dim(Arguments *arguments); | |
696 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
|
697 |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
658
diff
changeset
|
698 // LDC |
445
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
411
diff
changeset
|
699 unsigned llvmAttrs; |
159 | 700 }; |
701 | |
702 extern int PTRSIZE; | |
703 extern int REALSIZE; | |
704 extern int REALPAD; | |
705 extern int Tsize_t; | |
706 extern int Tptrdiff_t; | |
707 | |
708 #endif /* DMD_MTYPE_H */ |