Mercurial > projects > ldc
annotate dmd/mtype.h @ 650:aa6a0b7968f7
Added test case for bug #100
Removed dubious check for not emitting static private global in other modules without access. This should be handled properly somewhere else, it's causing unresolved global errors for stuff that should work (in MiniD)
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Sun, 05 Oct 2008 17:28:15 +0200 |
parents | af9bdd69a7ec |
children | 50383e476c7e |
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(); | |
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
|
392 // LLVMDC: pointers are unsigned |
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
|
393 int isunsigned() { return TRUE; }; |
159 | 394 Expression *defaultInit(Loc loc); |
395 int isZeroInit(); | |
396 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
397 int hasPointers(); | |
398 | |
399 type *toCtype(); | |
400 }; | |
401 | |
402 struct TypeReference : Type | |
403 { | |
404 TypeReference(Type *t); | |
405 Type *syntaxCopy(); | |
406 d_uns64 size(Loc loc); | |
407 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
408 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
409 Expression *defaultInit(Loc loc); | |
410 int isZeroInit(); | |
411 }; | |
412 | |
413 enum RET | |
414 { | |
415 RETregs = 1, // returned in registers | |
416 RETstack = 2, // returned on stack | |
417 }; | |
418 | |
419 struct TypeFunction : Type | |
420 { | |
421 Arguments *parameters; // function parameters | |
422 int varargs; // 1: T t, ...) style for variable number of arguments | |
423 // 2: T t ...) style for variable number of arguments | |
424 enum LINK linkage; // calling convention | |
425 | |
426 int inuse; | |
427 | |
428 TypeFunction(Arguments *parameters, Type *treturn, int varargs, enum LINK linkage); | |
429 Type *syntaxCopy(); | |
430 Type *semantic(Loc loc, Scope *sc); | |
431 void toDecoBuffer(OutBuffer *buf); | |
432 void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
433 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
434 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
435 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
436 Type *reliesOnTident(); | |
437 | |
438 int callMatch(Expressions *toargs); | |
439 type *toCtype(); | |
440 enum RET retStyle(); | |
441 | |
442 unsigned totym(); | |
443 | |
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
|
444 // LLVMDC |
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
|
445 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
|
446 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
|
447 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
|
448 unsigned retAttrs; |
159 | 449 }; |
450 | |
451 struct TypeDelegate : Type | |
452 { | |
453 TypeDelegate(Type *t); | |
454 Type *syntaxCopy(); | |
455 Type *semantic(Loc loc, Scope *sc); | |
456 d_uns64 size(Loc loc); | |
457 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
458 Expression *defaultInit(Loc loc); | |
459 int isZeroInit(); | |
460 int checkBoolean(); | |
461 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
462 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
463 int hasPointers(); | |
464 | |
465 type *toCtype(); | |
466 }; | |
467 | |
468 struct TypeQualified : Type | |
469 { | |
470 Loc loc; | |
471 Array idents; // array of Identifier's representing ident.ident.ident etc. | |
472 | |
473 TypeQualified(TY ty, Loc loc); | |
474 void syntaxCopyHelper(TypeQualified *t); | |
475 void addIdent(Identifier *ident); | |
476 void toCBuffer2Helper(OutBuffer *buf, HdrGenState *hgs); | |
477 d_uns64 size(Loc loc); | |
478 void resolveHelper(Loc loc, Scope *sc, Dsymbol *s, Dsymbol *scopesym, | |
479 Expression **pe, Type **pt, Dsymbol **ps); | |
480 }; | |
481 | |
482 struct TypeIdentifier : TypeQualified | |
483 { | |
484 Identifier *ident; | |
485 | |
486 TypeIdentifier(Loc loc, Identifier *ident); | |
487 Type *syntaxCopy(); | |
488 //char *toChars(); | |
489 void toDecoBuffer(OutBuffer *buf); | |
490 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
491 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
492 Dsymbol *toDsymbol(Scope *sc); | |
493 Type *semantic(Loc loc, Scope *sc); | |
494 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
495 Type *reliesOnTident(); | |
496 Expression *toExpression(); | |
497 }; | |
498 | |
499 /* Similar to TypeIdentifier, but with a TemplateInstance as the root | |
500 */ | |
501 struct TypeInstance : TypeQualified | |
502 { | |
503 TemplateInstance *tempinst; | |
504 | |
505 TypeInstance(Loc loc, TemplateInstance *tempinst); | |
506 Type *syntaxCopy(); | |
507 //char *toChars(); | |
508 //void toDecoBuffer(OutBuffer *buf); | |
509 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
510 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
511 Type *semantic(Loc loc, Scope *sc); | |
512 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
513 }; | |
514 | |
515 struct TypeTypeof : TypeQualified | |
516 { | |
517 Expression *exp; | |
518 | |
519 TypeTypeof(Loc loc, Expression *exp); | |
520 Type *syntaxCopy(); | |
521 Dsymbol *toDsymbol(Scope *sc); | |
522 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
523 Type *semantic(Loc loc, Scope *sc); | |
524 d_uns64 size(Loc loc); | |
525 }; | |
526 | |
527 struct TypeStruct : Type | |
528 { | |
529 StructDeclaration *sym; | |
530 | |
531 TypeStruct(StructDeclaration *sym); | |
532 d_uns64 size(Loc loc); | |
533 unsigned alignsize(); | |
534 char *toChars(); | |
535 Type *syntaxCopy(); | |
536 Type *semantic(Loc loc, Scope *sc); | |
537 Dsymbol *toDsymbol(Scope *sc); | |
538 void toDecoBuffer(OutBuffer *buf); | |
539 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
540 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
541 unsigned memalign(unsigned salign); | |
542 Expression *defaultInit(Loc loc); | |
543 int isZeroInit(); | |
544 int checkBoolean(); | |
545 dt_t **toDt(dt_t **pdt); | |
546 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
547 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
548 int hasPointers(); | |
549 | |
550 type *toCtype(); | |
551 }; | |
552 | |
553 struct TypeEnum : Type | |
554 { | |
555 EnumDeclaration *sym; | |
556 | |
557 TypeEnum(EnumDeclaration *sym); | |
558 d_uns64 size(Loc loc); | |
559 unsigned alignsize(); | |
560 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
|
561 Type *syntaxCopy(); |
159 | 562 Type *semantic(Loc loc, Scope *sc); |
563 Dsymbol *toDsymbol(Scope *sc); | |
564 void toDecoBuffer(OutBuffer *buf); | |
565 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
566 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
567 Expression *getProperty(Loc loc, Identifier *ident); | |
568 int isintegral(); | |
569 int isfloating(); | |
570 int isscalar(); | |
571 int isunsigned(); | |
572 MATCH implicitConvTo(Type *to); | |
573 Type *toBasetype(); | |
574 Expression *defaultInit(Loc loc); | |
575 int isZeroInit(); | |
576 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
577 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
578 int hasPointers(); | |
579 | |
580 type *toCtype(); | |
581 }; | |
582 | |
583 struct TypeTypedef : Type | |
584 { | |
585 TypedefDeclaration *sym; | |
586 | |
587 TypeTypedef(TypedefDeclaration *sym); | |
588 Type *syntaxCopy(); | |
589 d_uns64 size(Loc loc); | |
590 unsigned alignsize(); | |
591 char *toChars(); | |
592 Type *semantic(Loc loc, Scope *sc); | |
593 Dsymbol *toDsymbol(Scope *sc); | |
594 void toDecoBuffer(OutBuffer *buf); | |
595 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
596 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
597 Expression *getProperty(Loc loc, Identifier *ident); | |
598 int isbit(); | |
599 int isintegral(); | |
600 int isfloating(); | |
601 int isreal(); | |
602 int isimaginary(); | |
603 int iscomplex(); | |
604 int isscalar(); | |
605 int isunsigned(); | |
606 int checkBoolean(); | |
607 Type *toBasetype(); | |
608 MATCH implicitConvTo(Type *to); | |
609 Expression *defaultInit(Loc loc); | |
610 int isZeroInit(); | |
611 dt_t **toDt(dt_t **pdt); | |
612 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
613 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
614 int hasPointers(); | |
615 | |
616 type *toCtype(); | |
617 type *toCParamtype(); | |
618 }; | |
619 | |
620 struct TypeClass : Type | |
621 { | |
622 ClassDeclaration *sym; | |
623 | |
624 TypeClass(ClassDeclaration *sym); | |
625 d_uns64 size(Loc loc); | |
626 char *toChars(); | |
627 Type *syntaxCopy(); | |
628 Type *semantic(Loc loc, Scope *sc); | |
629 Dsymbol *toDsymbol(Scope *sc); | |
630 void toDecoBuffer(OutBuffer *buf); | |
631 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
632 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
633 ClassDeclaration *isClassHandle(); | |
634 int isBaseOf(Type *t, int *poffset); | |
635 MATCH implicitConvTo(Type *to); | |
636 Expression *defaultInit(Loc loc); | |
637 int isZeroInit(); | |
638 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
639 int isauto(); | |
640 int checkBoolean(); | |
641 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
642 int hasPointers(); | |
643 | |
644 type *toCtype(); | |
645 | |
646 Symbol *toSymbol(); | |
647 }; | |
648 | |
649 struct TypeTuple : Type | |
650 { | |
651 Arguments *arguments; // types making up the tuple | |
652 | |
653 TypeTuple(Arguments *arguments); | |
654 TypeTuple(Expressions *exps); | |
655 Type *syntaxCopy(); | |
656 Type *semantic(Loc loc, Scope *sc); | |
657 int equals(Object *o); | |
658 Type *reliesOnTident(); | |
659 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
660 void toDecoBuffer(OutBuffer *buf); | |
661 Expression *getProperty(Loc loc, Identifier *ident); | |
662 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
663 }; | |
664 | |
665 struct TypeSlice : Type | |
666 { | |
667 Expression *lwr; | |
668 Expression *upr; | |
669 | |
670 TypeSlice(Type *next, Expression *lwr, Expression *upr); | |
671 Type *syntaxCopy(); | |
672 Type *semantic(Loc loc, Scope *sc); | |
673 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
674 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
675 }; | |
676 | |
379
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
677 //LLVMDC |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
678 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
|
679 { |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
680 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
|
681 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
|
682 }; |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
683 |
159 | 684 /**************************************************************/ |
685 | |
686 //enum InOut { None, In, Out, InOut, Lazy }; | |
687 | |
688 struct Argument : Object | |
689 { | |
690 //enum InOut inout; | |
691 unsigned storageClass; | |
692 Type *type; | |
693 Identifier *ident; | |
694 Expression *defaultArg; | |
695 | |
696 Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg); | |
697 Argument *syntaxCopy(); | |
698 Type *isLazyArray(); | |
699 void toDecoBuffer(OutBuffer *buf); | |
700 static Arguments *arraySyntaxCopy(Arguments *args); | |
701 static char *argsTypesToChars(Arguments *args, int varargs); | |
702 static void argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Arguments *arguments, int varargs); | |
703 static void argsToDecoBuffer(OutBuffer *buf, Arguments *arguments); | |
704 static size_t dim(Arguments *arguments); | |
705 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
|
706 |
0806379a5eca
[svn r233] Added: -oq command line option for writing fully qualified object names.
lindquist
parents:
211
diff
changeset
|
707 // LLVMDC |
445
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
411
diff
changeset
|
708 unsigned llvmAttrs; |
159 | 709 }; |
710 | |
711 extern int PTRSIZE; | |
712 extern int REALSIZE; | |
713 extern int REALPAD; | |
714 extern int Tsize_t; | |
715 extern int Tptrdiff_t; | |
716 | |
717 #endif /* DMD_MTYPE_H */ |