Mercurial > projects > ldc
annotate dmd/mtype.h @ 715:30b42a283c8e
Removed TypeOpaque from DMD.
Changed runtime functions taking opaque[] to void[].
Implemented proper type painting, to avoid "resizing" array casts in runtime calls that previously took opaque[].
Implemented dynamic arrays as first class types, this implements proper ABI for these types on x86.
Added dwarf region end after call to assert function, fixes some problems with llvm not allowing this to be missing.
Reverted change to WithStatement from rev [704] it breaks MiniD, mini/with2.d needs to be fixed some other way...
Fixed tango bug 1339 in runtime, problem with _adReverseChar on invalid UTF-8.
Disabled .bc generation in the compiler runtime part, genobj.d triggers some llvm bug when using debug info. the .o seems to work fine.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 22 Oct 2008 14:55:33 +0200 |
parents | 6aaa3d3c1183 |
children | e177ae483f8e |
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 | |
371 Symbol *aaGetSymbol(char *func, int flags); | |
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; |
159 | 442 }; |
443 | |
444 struct TypeDelegate : Type | |
445 { | |
446 TypeDelegate(Type *t); | |
447 Type *syntaxCopy(); | |
448 Type *semantic(Loc loc, Scope *sc); | |
449 d_uns64 size(Loc loc); | |
450 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
451 Expression *defaultInit(Loc loc); | |
452 int isZeroInit(); | |
453 int checkBoolean(); | |
454 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
455 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
456 int hasPointers(); | |
457 | |
458 type *toCtype(); | |
459 }; | |
460 | |
461 struct TypeQualified : Type | |
462 { | |
463 Loc loc; | |
464 Array idents; // array of Identifier's representing ident.ident.ident etc. | |
465 | |
466 TypeQualified(TY ty, Loc loc); | |
467 void syntaxCopyHelper(TypeQualified *t); | |
468 void addIdent(Identifier *ident); | |
469 void toCBuffer2Helper(OutBuffer *buf, HdrGenState *hgs); | |
470 d_uns64 size(Loc loc); | |
471 void resolveHelper(Loc loc, Scope *sc, Dsymbol *s, Dsymbol *scopesym, | |
472 Expression **pe, Type **pt, Dsymbol **ps); | |
473 }; | |
474 | |
475 struct TypeIdentifier : TypeQualified | |
476 { | |
477 Identifier *ident; | |
478 | |
479 TypeIdentifier(Loc loc, Identifier *ident); | |
480 Type *syntaxCopy(); | |
481 //char *toChars(); | |
482 void toDecoBuffer(OutBuffer *buf); | |
483 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
484 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
485 Dsymbol *toDsymbol(Scope *sc); | |
486 Type *semantic(Loc loc, Scope *sc); | |
487 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
488 Type *reliesOnTident(); | |
489 Expression *toExpression(); | |
490 }; | |
491 | |
492 /* Similar to TypeIdentifier, but with a TemplateInstance as the root | |
493 */ | |
494 struct TypeInstance : TypeQualified | |
495 { | |
496 TemplateInstance *tempinst; | |
497 | |
498 TypeInstance(Loc loc, TemplateInstance *tempinst); | |
499 Type *syntaxCopy(); | |
500 //char *toChars(); | |
501 //void toDecoBuffer(OutBuffer *buf); | |
502 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
503 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
504 Type *semantic(Loc loc, Scope *sc); | |
505 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
506 }; | |
507 | |
508 struct TypeTypeof : TypeQualified | |
509 { | |
510 Expression *exp; | |
511 | |
512 TypeTypeof(Loc loc, Expression *exp); | |
513 Type *syntaxCopy(); | |
514 Dsymbol *toDsymbol(Scope *sc); | |
515 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
516 Type *semantic(Loc loc, Scope *sc); | |
517 d_uns64 size(Loc loc); | |
518 }; | |
519 | |
520 struct TypeStruct : Type | |
521 { | |
522 StructDeclaration *sym; | |
523 | |
524 TypeStruct(StructDeclaration *sym); | |
525 d_uns64 size(Loc loc); | |
526 unsigned alignsize(); | |
527 char *toChars(); | |
528 Type *syntaxCopy(); | |
529 Type *semantic(Loc loc, Scope *sc); | |
530 Dsymbol *toDsymbol(Scope *sc); | |
531 void toDecoBuffer(OutBuffer *buf); | |
532 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
533 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
534 unsigned memalign(unsigned salign); | |
535 Expression *defaultInit(Loc loc); | |
536 int isZeroInit(); | |
537 int checkBoolean(); | |
538 dt_t **toDt(dt_t **pdt); | |
539 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
540 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
541 int hasPointers(); | |
542 | |
543 type *toCtype(); | |
544 }; | |
545 | |
546 struct TypeEnum : Type | |
547 { | |
548 EnumDeclaration *sym; | |
549 | |
550 TypeEnum(EnumDeclaration *sym); | |
551 d_uns64 size(Loc loc); | |
552 unsigned alignsize(); | |
553 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
|
554 Type *syntaxCopy(); |
159 | 555 Type *semantic(Loc loc, Scope *sc); |
556 Dsymbol *toDsymbol(Scope *sc); | |
557 void toDecoBuffer(OutBuffer *buf); | |
558 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
559 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
560 Expression *getProperty(Loc loc, Identifier *ident); | |
561 int isintegral(); | |
562 int isfloating(); | |
563 int isscalar(); | |
564 int isunsigned(); | |
565 MATCH implicitConvTo(Type *to); | |
566 Type *toBasetype(); | |
567 Expression *defaultInit(Loc loc); | |
568 int isZeroInit(); | |
569 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
570 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
571 int hasPointers(); | |
572 | |
573 type *toCtype(); | |
574 }; | |
575 | |
576 struct TypeTypedef : Type | |
577 { | |
578 TypedefDeclaration *sym; | |
579 | |
580 TypeTypedef(TypedefDeclaration *sym); | |
581 Type *syntaxCopy(); | |
582 d_uns64 size(Loc loc); | |
583 unsigned alignsize(); | |
584 char *toChars(); | |
585 Type *semantic(Loc loc, Scope *sc); | |
586 Dsymbol *toDsymbol(Scope *sc); | |
587 void toDecoBuffer(OutBuffer *buf); | |
588 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
589 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
590 Expression *getProperty(Loc loc, Identifier *ident); | |
591 int isbit(); | |
592 int isintegral(); | |
593 int isfloating(); | |
594 int isreal(); | |
595 int isimaginary(); | |
596 int iscomplex(); | |
597 int isscalar(); | |
598 int isunsigned(); | |
599 int checkBoolean(); | |
600 Type *toBasetype(); | |
601 MATCH implicitConvTo(Type *to); | |
602 Expression *defaultInit(Loc loc); | |
603 int isZeroInit(); | |
604 dt_t **toDt(dt_t **pdt); | |
605 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
606 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
607 int hasPointers(); | |
608 | |
609 type *toCtype(); | |
610 type *toCParamtype(); | |
611 }; | |
612 | |
613 struct TypeClass : Type | |
614 { | |
615 ClassDeclaration *sym; | |
616 | |
617 TypeClass(ClassDeclaration *sym); | |
618 d_uns64 size(Loc loc); | |
619 char *toChars(); | |
620 Type *syntaxCopy(); | |
621 Type *semantic(Loc loc, Scope *sc); | |
622 Dsymbol *toDsymbol(Scope *sc); | |
623 void toDecoBuffer(OutBuffer *buf); | |
624 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
625 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
626 ClassDeclaration *isClassHandle(); | |
627 int isBaseOf(Type *t, int *poffset); | |
628 MATCH implicitConvTo(Type *to); | |
629 Expression *defaultInit(Loc loc); | |
630 int isZeroInit(); | |
631 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
632 int isauto(); | |
633 int checkBoolean(); | |
634 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
635 int hasPointers(); | |
636 | |
637 type *toCtype(); | |
638 | |
639 Symbol *toSymbol(); | |
640 }; | |
641 | |
642 struct TypeTuple : Type | |
643 { | |
644 Arguments *arguments; // types making up the tuple | |
645 | |
646 TypeTuple(Arguments *arguments); | |
647 TypeTuple(Expressions *exps); | |
648 Type *syntaxCopy(); | |
649 Type *semantic(Loc loc, Scope *sc); | |
650 int equals(Object *o); | |
651 Type *reliesOnTident(); | |
652 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
653 void toDecoBuffer(OutBuffer *buf); | |
654 Expression *getProperty(Loc loc, Identifier *ident); | |
655 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
656 }; | |
657 | |
658 struct TypeSlice : Type | |
659 { | |
660 Expression *lwr; | |
661 Expression *upr; | |
662 | |
663 TypeSlice(Type *next, Expression *lwr, Expression *upr); | |
664 Type *syntaxCopy(); | |
665 Type *semantic(Loc loc, Scope *sc); | |
666 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
667 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
668 }; | |
669 | |
670 /**************************************************************/ | |
671 | |
672 //enum InOut { None, In, Out, InOut, Lazy }; | |
673 | |
674 struct Argument : Object | |
675 { | |
676 //enum InOut inout; | |
677 unsigned storageClass; | |
678 Type *type; | |
679 Identifier *ident; | |
680 Expression *defaultArg; | |
681 | |
682 Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg); | |
683 Argument *syntaxCopy(); | |
684 Type *isLazyArray(); | |
685 void toDecoBuffer(OutBuffer *buf); | |
686 static Arguments *arraySyntaxCopy(Arguments *args); | |
687 static char *argsTypesToChars(Arguments *args, int varargs); | |
688 static void argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Arguments *arguments, int varargs); | |
689 static void argsToDecoBuffer(OutBuffer *buf, Arguments *arguments); | |
690 static size_t dim(Arguments *arguments); | |
691 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
|
692 |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
658
diff
changeset
|
693 // LDC |
445
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
411
diff
changeset
|
694 unsigned llvmAttrs; |
159 | 695 }; |
696 | |
697 extern int PTRSIZE; | |
698 extern int REALSIZE; | |
699 extern int REALPAD; | |
700 extern int Tsize_t; | |
701 extern int Tptrdiff_t; | |
702 | |
703 #endif /* DMD_MTYPE_H */ |