Mercurial > projects > ldc
annotate dmd/mtype.h @ 984:4c0df37d0421
Removing ldc.conf. (IMPORTANT: run 'cmake .' after pull)
Added it to .hgignore.
This gets rid of spurious differences caused by CMake regenerating it differently.
Just run 'cmake .' to get it back in your local checkout.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Thu, 19 Feb 2009 13:50:05 +0100 |
parents | a904cc9bc064 |
children | 9167d492cbc2 |
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" |
938
a904cc9bc064
Convert struct arg to integer when passing inreg to make sure LLVM doesn't
Christian Kamm <kamm incasoftware de>
parents:
930
diff
changeset
|
26 namespace llvm { class Type; } |
173
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
27 |
159 | 28 struct Scope; |
29 struct Identifier; | |
30 struct Expression; | |
31 struct StructDeclaration; | |
32 struct ClassDeclaration; | |
33 struct VarDeclaration; | |
34 struct EnumDeclaration; | |
35 struct TypedefDeclaration; | |
36 struct TypeInfoDeclaration; | |
37 struct Dsymbol; | |
38 struct TemplateInstance; | |
39 enum LINK; | |
40 | |
41 struct TypeBasic; | |
42 struct HdrGenState; | |
43 | |
44 // Back end | |
45 #if IN_GCC | |
46 union tree_node; typedef union tree_node TYPE; | |
47 typedef TYPE type; | |
48 #else | |
49 typedef struct TYPE type; | |
50 #endif | |
51 struct Symbol; | |
52 | |
53 enum TY | |
54 { | |
55 Tarray, // dynamic array | |
56 Tsarray, // static array | |
57 Taarray, // associative array | |
58 Tpointer, | |
59 Treference, | |
60 Tfunction, | |
61 Tident, | |
62 Tclass, | |
63 Tstruct, | |
64 Tenum, | |
65 Ttypedef, | |
66 Tdelegate, | |
67 | |
68 Tnone, | |
69 Tvoid, | |
70 Tint8, | |
71 Tuns8, | |
72 Tint16, | |
73 Tuns16, | |
74 Tint32, | |
75 Tuns32, | |
76 Tint64, | |
77 Tuns64, | |
78 Tfloat32, | |
79 Tfloat64, | |
80 Tfloat80, | |
81 | |
82 Timaginary32, | |
83 Timaginary64, | |
84 Timaginary80, | |
85 | |
86 Tcomplex32, | |
87 Tcomplex64, | |
88 Tcomplex80, | |
89 | |
90 Tbit, | |
91 Tbool, | |
92 Tchar, | |
93 Twchar, | |
94 Tdchar, | |
95 | |
96 Terror, | |
97 Tinstance, | |
98 Ttypeof, | |
99 Ttuple, | |
100 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
|
101 |
159 | 102 TMAX |
103 }; | |
104 | |
105 #define Tascii Tchar | |
106 | |
107 extern int Tsize_t; | |
108 extern int Tptrdiff_t; | |
109 | |
110 struct Type : Object | |
111 { | |
112 TY ty; | |
113 unsigned char mod; // modifiers (MODconst, MODinvariant) | |
114 #define MODconst 1 // type is const | |
115 #define MODinvariant 2 // type is invariant | |
116 Type *next; | |
117 char *deco; | |
118 Type *pto; // merged pointer to this type | |
119 Type *rto; // reference to this type | |
120 Type *arrayof; // array of this type | |
121 TypeInfoDeclaration *vtinfo; // TypeInfo object for this Type | |
122 | |
123 type *ctype; // for back end | |
124 | |
125 #define tvoid basic[Tvoid] | |
126 #define tint8 basic[Tint8] | |
127 #define tuns8 basic[Tuns8] | |
128 #define tint16 basic[Tint16] | |
129 #define tuns16 basic[Tuns16] | |
130 #define tint32 basic[Tint32] | |
131 #define tuns32 basic[Tuns32] | |
132 #define tint64 basic[Tint64] | |
133 #define tuns64 basic[Tuns64] | |
134 #define tfloat32 basic[Tfloat32] | |
135 #define tfloat64 basic[Tfloat64] | |
136 #define tfloat80 basic[Tfloat80] | |
137 | |
138 #define timaginary32 basic[Timaginary32] | |
139 #define timaginary64 basic[Timaginary64] | |
140 #define timaginary80 basic[Timaginary80] | |
141 | |
142 #define tcomplex32 basic[Tcomplex32] | |
143 #define tcomplex64 basic[Tcomplex64] | |
144 #define tcomplex80 basic[Tcomplex80] | |
145 | |
146 #define tbit basic[Tbit] | |
147 #define tbool basic[Tbool] | |
148 #define tchar basic[Tchar] | |
149 #define twchar basic[Twchar] | |
150 #define tdchar basic[Tdchar] | |
151 | |
152 // Some special types | |
153 #define tshiftcnt tint32 // right side of shift expression | |
154 // #define tboolean tint32 // result of boolean expression | |
155 #define tboolean tbool // result of boolean expression | |
156 #define tindex tint32 // array/ptr index | |
157 static Type *tvoidptr; // void* | |
158 #define terror basic[Terror] // for error recovery | |
159 | |
160 #define tsize_t basic[Tsize_t] // matches size_t alias | |
161 #define tptrdiff_t basic[Tptrdiff_t] // matches ptrdiff_t alias | |
162 #define thash_t tsize_t // matches hash_t alias | |
163 | |
164 static ClassDeclaration *typeinfo; | |
165 static ClassDeclaration *typeinfoclass; | |
166 static ClassDeclaration *typeinfointerface; | |
167 static ClassDeclaration *typeinfostruct; | |
168 static ClassDeclaration *typeinfotypedef; | |
169 static ClassDeclaration *typeinfopointer; | |
170 static ClassDeclaration *typeinfoarray; | |
171 static ClassDeclaration *typeinfostaticarray; | |
172 static ClassDeclaration *typeinfoassociativearray; | |
173 static ClassDeclaration *typeinfoenum; | |
174 static ClassDeclaration *typeinfofunction; | |
175 static ClassDeclaration *typeinfodelegate; | |
176 static ClassDeclaration *typeinfotypelist; | |
177 | |
178 static Type *basic[TMAX]; | |
179 static unsigned char mangleChar[TMAX]; | |
180 static StringTable stringtable; | |
181 | |
182 // These tables are for implicit conversion of binary ops; | |
183 // the indices are the type of operand one, followed by operand two. | |
184 static unsigned char impcnvResult[TMAX][TMAX]; | |
185 static unsigned char impcnvType1[TMAX][TMAX]; | |
186 static unsigned char impcnvType2[TMAX][TMAX]; | |
187 | |
188 // If !=0, give warning on implicit conversion | |
189 static unsigned char impcnvWarn[TMAX][TMAX]; | |
190 | |
191 Type(TY ty, Type *next); | |
192 virtual Type *syntaxCopy(); | |
193 int equals(Object *o); | |
194 int dyncast() { return DYNCAST_TYPE; } // kludge for template.isType() | |
195 int covariant(Type *t); | |
196 char *toChars(); | |
197 static char needThisPrefix(); | |
198 static void init(); | |
199 d_uns64 size(); | |
200 virtual d_uns64 size(Loc loc); | |
201 virtual unsigned alignsize(); | |
202 virtual Type *semantic(Loc loc, Scope *sc); | |
203 virtual void toDecoBuffer(OutBuffer *buf); | |
204 Type *merge(); | |
205 virtual void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
206 virtual void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
207 void toCBuffer3(OutBuffer *buf, HdrGenState *hgs, int mod); | |
208 virtual int isbit(); | |
209 virtual int isintegral(); | |
210 virtual int isfloating(); // real, imaginary, or complex | |
211 virtual int isreal(); | |
212 virtual int isimaginary(); | |
213 virtual int iscomplex(); | |
214 virtual int isscalar(); | |
215 virtual int isunsigned(); | |
216 virtual int isauto(); | |
217 virtual int isString(); | |
218 virtual int checkBoolean(); // if can be converted to boolean value | |
219 void checkDeprecated(Loc loc, Scope *sc); | |
220 Type *pointerTo(); | |
221 Type *referenceTo(); | |
222 Type *arrayOf(); | |
223 virtual Dsymbol *toDsymbol(Scope *sc); | |
224 virtual Type *toBasetype(); | |
225 virtual int isBaseOf(Type *t, int *poffset); | |
226 virtual MATCH implicitConvTo(Type *to); | |
227 virtual ClassDeclaration *isClassHandle(); | |
228 virtual Expression *getProperty(Loc loc, Identifier *ident); | |
229 virtual Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
230 virtual unsigned memalign(unsigned salign); | |
231 virtual Expression *defaultInit(Loc loc = 0); | |
232 virtual int isZeroInit(); // if initializer is 0 | |
233 virtual dt_t **toDt(dt_t **pdt); | |
234 Identifier *getTypeInfoIdent(int internal); | |
235 virtual MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
236 virtual void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
237 Expression *getInternalTypeInfo(Scope *sc); | |
238 Expression *getTypeInfo(Scope *sc); | |
239 virtual TypeInfoDeclaration *getTypeInfoDeclaration(); | |
240 virtual int builtinTypeInfo(); | |
241 virtual Type *reliesOnTident(); | |
242 virtual Expression *toExpression(); | |
243 virtual int hasPointers(); | |
244 Type *nextOf() { return next; } | |
245 | |
246 static void error(Loc loc, const char *format, ...); | |
247 | |
248 // For backend | |
249 virtual unsigned totym(); | |
250 virtual type *toCtype(); | |
251 virtual type *toCParamtype(); | |
252 virtual Symbol *toSymbol(); | |
253 | |
254 // For eliminating dynamic_cast | |
255 virtual TypeBasic *isTypeBasic(); | |
173
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
256 |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
658
diff
changeset
|
257 // LDC |
173
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
258 IrType ir; |
159 | 259 }; |
260 | |
261 struct TypeBasic : Type | |
262 { | |
658
50383e476c7e
Upgraded frontend to DMD 1.035
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
508
diff
changeset
|
263 const char *dstring; |
50383e476c7e
Upgraded frontend to DMD 1.035
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
508
diff
changeset
|
264 const char *cstring; |
159 | 265 unsigned flags; |
266 | |
267 TypeBasic(TY ty); | |
268 Type *syntaxCopy(); | |
269 d_uns64 size(Loc loc); | |
270 unsigned alignsize(); | |
271 Expression *getProperty(Loc loc, Identifier *ident); | |
272 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
273 char *toChars(); | |
274 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
275 int isintegral(); | |
276 int isbit(); | |
277 int isfloating(); | |
278 int isreal(); | |
279 int isimaginary(); | |
280 int iscomplex(); | |
281 int isscalar(); | |
282 int isunsigned(); | |
283 MATCH implicitConvTo(Type *to); | |
284 Expression *defaultInit(Loc loc); | |
285 int isZeroInit(); | |
286 int builtinTypeInfo(); | |
287 | |
288 // For eliminating dynamic_cast | |
289 TypeBasic *isTypeBasic(); | |
290 }; | |
291 | |
292 struct TypeArray : Type | |
293 { | |
294 TypeArray(TY ty, Type *next); | |
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 toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
311 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
312 int isString(); | |
313 int isZeroInit(); | |
314 unsigned memalign(unsigned salign); | |
315 MATCH implicitConvTo(Type *to); | |
316 Expression *defaultInit(Loc loc); | |
317 dt_t **toDt(dt_t **pdt); | |
318 dt_t **toDtElem(dt_t **pdt, Expression *e); | |
319 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
320 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
321 Expression *toExpression(); | |
322 int hasPointers(); | |
323 | |
324 type *toCtype(); | |
325 type *toCParamtype(); | |
326 }; | |
327 | |
328 // Dynamic array, no dimension | |
329 struct TypeDArray : TypeArray | |
330 { | |
331 TypeDArray(Type *t); | |
332 Type *syntaxCopy(); | |
333 d_uns64 size(Loc loc); | |
334 unsigned alignsize(); | |
335 Type *semantic(Loc loc, Scope *sc); | |
336 void toDecoBuffer(OutBuffer *buf); | |
337 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
338 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
339 int isString(); | |
340 int isZeroInit(); | |
341 int checkBoolean(); | |
342 MATCH implicitConvTo(Type *to); | |
343 Expression *defaultInit(Loc loc); | |
344 int builtinTypeInfo(); | |
345 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
346 int hasPointers(); | |
347 | |
348 type *toCtype(); | |
349 }; | |
350 | |
351 struct TypeAArray : TypeArray | |
352 { | |
353 Type *index; // key type for type checking | |
354 Type *key; // actual key type | |
355 | |
356 TypeAArray(Type *t, Type *index); | |
357 Type *syntaxCopy(); | |
358 d_uns64 size(Loc loc); | |
359 Type *semantic(Loc loc, Scope *sc); | |
336 | 360 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); |
159 | 361 void toDecoBuffer(OutBuffer *buf); |
362 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
363 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
364 Expression *defaultInit(Loc loc); | |
365 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
|
366 int isZeroInit(); |
159 | 367 int checkBoolean(); |
368 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
369 int hasPointers(); | |
370 | |
371 // 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
|
372 Symbol *aaGetSymbol(const char *func, int flags); |
159 | 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, HdrGenState *hgs, int mod); | |
384 MATCH implicitConvTo(Type *to); | |
385 int isscalar(); | |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
658
diff
changeset
|
386 // 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
|
387 int isunsigned() { return TRUE; }; |
159 | 388 Expression *defaultInit(Loc loc); |
389 int isZeroInit(); | |
390 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
391 int hasPointers(); | |
392 | |
393 type *toCtype(); | |
394 }; | |
395 | |
396 struct TypeReference : Type | |
397 { | |
398 TypeReference(Type *t); | |
399 Type *syntaxCopy(); | |
400 d_uns64 size(Loc loc); | |
401 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
402 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
403 Expression *defaultInit(Loc loc); | |
404 int isZeroInit(); | |
405 }; | |
406 | |
407 enum RET | |
408 { | |
409 RETregs = 1, // returned in registers | |
410 RETstack = 2, // returned on stack | |
411 }; | |
412 | |
413 struct TypeFunction : Type | |
414 { | |
415 Arguments *parameters; // function parameters | |
416 int varargs; // 1: T t, ...) style for variable number of arguments | |
417 // 2: T t ...) style for variable number of arguments | |
418 enum LINK linkage; // calling convention | |
419 | |
420 int inuse; | |
421 | |
422 TypeFunction(Arguments *parameters, Type *treturn, int varargs, enum LINK linkage); | |
423 Type *syntaxCopy(); | |
424 Type *semantic(Loc loc, Scope *sc); | |
425 void toDecoBuffer(OutBuffer *buf); | |
426 void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
427 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
428 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
429 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
430 Type *reliesOnTident(); | |
431 | |
432 int callMatch(Expressions *toargs); | |
433 type *toCtype(); | |
434 enum RET retStyle(); | |
435 | |
436 unsigned totym(); | |
437 | |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
658
diff
changeset
|
438 // 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
|
439 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
|
440 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
|
441 bool usesNest; |
938
a904cc9bc064
Convert struct arg to integer when passing inreg to make sure LLVM doesn't
Christian Kamm <kamm incasoftware de>
parents:
930
diff
changeset
|
442 // when the last arg is a struct and passed in EAX, this holds its real type |
a904cc9bc064
Convert struct arg to integer when passing inreg to make sure LLVM doesn't
Christian Kamm <kamm incasoftware de>
parents:
930
diff
changeset
|
443 const llvm::Type* structInregArg; |
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 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
|
445 unsigned thisAttrs; // also used for nest |
930
7985bb036db4
Follow the D ABI and pass the last arg in a register if it is a struct that fits.
Christian Kamm <kamm incasoftware de>
parents:
875
diff
changeset
|
446 // parameter index in the llvm function that contains the first not-implicit arg |
7985bb036db4
Follow the D ABI and pass the last arg in a register if it is a struct that fits.
Christian Kamm <kamm incasoftware de>
parents:
875
diff
changeset
|
447 size_t firstRealArg; |
723
55f6c2e454d7
Implemented correct parameter order according to x86-32 ABI documentation.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
720
diff
changeset
|
448 |
55f6c2e454d7
Implemented correct parameter order according to x86-32 ABI documentation.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
720
diff
changeset
|
449 bool reverseParams; |
159 | 450 }; |
451 | |
452 struct TypeDelegate : Type | |
453 { | |
454 TypeDelegate(Type *t); | |
455 Type *syntaxCopy(); | |
456 Type *semantic(Loc loc, Scope *sc); | |
457 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
|
458 unsigned alignsize(); // added in LDC |
159 | 459 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); |
460 Expression *defaultInit(Loc loc); | |
461 int isZeroInit(); | |
462 int checkBoolean(); | |
463 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
464 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
465 int hasPointers(); | |
466 | |
467 type *toCtype(); | |
468 }; | |
469 | |
470 struct TypeQualified : Type | |
471 { | |
472 Loc loc; | |
473 Array idents; // array of Identifier's representing ident.ident.ident etc. | |
474 | |
475 TypeQualified(TY ty, Loc loc); | |
476 void syntaxCopyHelper(TypeQualified *t); | |
477 void addIdent(Identifier *ident); | |
478 void toCBuffer2Helper(OutBuffer *buf, HdrGenState *hgs); | |
479 d_uns64 size(Loc loc); | |
480 void resolveHelper(Loc loc, Scope *sc, Dsymbol *s, Dsymbol *scopesym, | |
481 Expression **pe, Type **pt, Dsymbol **ps); | |
482 }; | |
483 | |
484 struct TypeIdentifier : TypeQualified | |
485 { | |
486 Identifier *ident; | |
487 | |
488 TypeIdentifier(Loc loc, Identifier *ident); | |
489 Type *syntaxCopy(); | |
490 //char *toChars(); | |
491 void toDecoBuffer(OutBuffer *buf); | |
492 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
493 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
494 Dsymbol *toDsymbol(Scope *sc); | |
495 Type *semantic(Loc loc, Scope *sc); | |
496 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
497 Type *reliesOnTident(); | |
498 Expression *toExpression(); | |
499 }; | |
500 | |
501 /* Similar to TypeIdentifier, but with a TemplateInstance as the root | |
502 */ | |
503 struct TypeInstance : TypeQualified | |
504 { | |
505 TemplateInstance *tempinst; | |
506 | |
507 TypeInstance(Loc loc, TemplateInstance *tempinst); | |
508 Type *syntaxCopy(); | |
509 //char *toChars(); | |
510 //void toDecoBuffer(OutBuffer *buf); | |
511 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
512 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
513 Type *semantic(Loc loc, Scope *sc); | |
875
330f999ade44
Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
797
diff
changeset
|
514 Dsymbol *toDsymbol(Scope *sc); |
159 | 515 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); |
516 }; | |
517 | |
518 struct TypeTypeof : TypeQualified | |
519 { | |
520 Expression *exp; | |
521 | |
522 TypeTypeof(Loc loc, Expression *exp); | |
523 Type *syntaxCopy(); | |
524 Dsymbol *toDsymbol(Scope *sc); | |
525 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
526 Type *semantic(Loc loc, Scope *sc); | |
527 d_uns64 size(Loc loc); | |
528 }; | |
529 | |
530 struct TypeStruct : Type | |
531 { | |
532 StructDeclaration *sym; | |
533 | |
534 TypeStruct(StructDeclaration *sym); | |
535 d_uns64 size(Loc loc); | |
536 unsigned alignsize(); | |
537 char *toChars(); | |
538 Type *syntaxCopy(); | |
539 Type *semantic(Loc loc, Scope *sc); | |
540 Dsymbol *toDsymbol(Scope *sc); | |
541 void toDecoBuffer(OutBuffer *buf); | |
542 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
543 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
544 unsigned memalign(unsigned salign); | |
545 Expression *defaultInit(Loc loc); | |
546 int isZeroInit(); | |
547 int checkBoolean(); | |
548 dt_t **toDt(dt_t **pdt); | |
549 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
550 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
551 int hasPointers(); | |
552 | |
553 type *toCtype(); | |
554 }; | |
555 | |
556 struct TypeEnum : Type | |
557 { | |
558 EnumDeclaration *sym; | |
559 | |
560 TypeEnum(EnumDeclaration *sym); | |
561 d_uns64 size(Loc loc); | |
562 unsigned alignsize(); | |
563 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
|
564 Type *syntaxCopy(); |
159 | 565 Type *semantic(Loc loc, Scope *sc); |
566 Dsymbol *toDsymbol(Scope *sc); | |
567 void toDecoBuffer(OutBuffer *buf); | |
568 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
569 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
570 Expression *getProperty(Loc loc, Identifier *ident); | |
571 int isintegral(); | |
572 int isfloating(); | |
573 int isscalar(); | |
574 int isunsigned(); | |
575 MATCH implicitConvTo(Type *to); | |
576 Type *toBasetype(); | |
577 Expression *defaultInit(Loc loc); | |
578 int isZeroInit(); | |
579 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
580 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
581 int hasPointers(); | |
582 | |
583 type *toCtype(); | |
584 }; | |
585 | |
586 struct TypeTypedef : Type | |
587 { | |
588 TypedefDeclaration *sym; | |
589 | |
590 TypeTypedef(TypedefDeclaration *sym); | |
591 Type *syntaxCopy(); | |
592 d_uns64 size(Loc loc); | |
593 unsigned alignsize(); | |
594 char *toChars(); | |
595 Type *semantic(Loc loc, Scope *sc); | |
596 Dsymbol *toDsymbol(Scope *sc); | |
597 void toDecoBuffer(OutBuffer *buf); | |
598 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
599 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
600 Expression *getProperty(Loc loc, Identifier *ident); | |
601 int isbit(); | |
602 int isintegral(); | |
603 int isfloating(); | |
604 int isreal(); | |
605 int isimaginary(); | |
606 int iscomplex(); | |
607 int isscalar(); | |
608 int isunsigned(); | |
609 int checkBoolean(); | |
610 Type *toBasetype(); | |
611 MATCH implicitConvTo(Type *to); | |
612 Expression *defaultInit(Loc loc); | |
613 int isZeroInit(); | |
614 dt_t **toDt(dt_t **pdt); | |
615 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
616 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
617 int hasPointers(); | |
618 | |
619 type *toCtype(); | |
620 type *toCParamtype(); | |
621 }; | |
622 | |
623 struct TypeClass : Type | |
624 { | |
625 ClassDeclaration *sym; | |
626 | |
627 TypeClass(ClassDeclaration *sym); | |
628 d_uns64 size(Loc loc); | |
629 char *toChars(); | |
630 Type *syntaxCopy(); | |
631 Type *semantic(Loc loc, Scope *sc); | |
632 Dsymbol *toDsymbol(Scope *sc); | |
633 void toDecoBuffer(OutBuffer *buf); | |
634 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
635 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
636 ClassDeclaration *isClassHandle(); | |
637 int isBaseOf(Type *t, int *poffset); | |
638 MATCH implicitConvTo(Type *to); | |
639 Expression *defaultInit(Loc loc); | |
640 int isZeroInit(); | |
641 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
642 int isauto(); | |
643 int checkBoolean(); | |
644 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
645 int hasPointers(); | |
646 | |
647 type *toCtype(); | |
648 | |
649 Symbol *toSymbol(); | |
650 }; | |
651 | |
652 struct TypeTuple : Type | |
653 { | |
654 Arguments *arguments; // types making up the tuple | |
655 | |
656 TypeTuple(Arguments *arguments); | |
657 TypeTuple(Expressions *exps); | |
658 Type *syntaxCopy(); | |
659 Type *semantic(Loc loc, Scope *sc); | |
660 int equals(Object *o); | |
661 Type *reliesOnTident(); | |
662 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
663 void toDecoBuffer(OutBuffer *buf); | |
664 Expression *getProperty(Loc loc, Identifier *ident); | |
665 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
666 }; | |
667 | |
668 struct TypeSlice : Type | |
669 { | |
670 Expression *lwr; | |
671 Expression *upr; | |
672 | |
673 TypeSlice(Type *next, Expression *lwr, Expression *upr); | |
674 Type *syntaxCopy(); | |
675 Type *semantic(Loc loc, Scope *sc); | |
676 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
677 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
678 }; | |
679 | |
680 /**************************************************************/ | |
681 | |
682 //enum InOut { None, In, Out, InOut, Lazy }; | |
683 | |
684 struct Argument : Object | |
685 { | |
686 //enum InOut inout; | |
687 unsigned storageClass; | |
688 Type *type; | |
689 Identifier *ident; | |
690 Expression *defaultArg; | |
691 | |
692 Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg); | |
693 Argument *syntaxCopy(); | |
694 Type *isLazyArray(); | |
695 void toDecoBuffer(OutBuffer *buf); | |
696 static Arguments *arraySyntaxCopy(Arguments *args); | |
697 static char *argsTypesToChars(Arguments *args, int varargs); | |
698 static void argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Arguments *arguments, int varargs); | |
699 static void argsToDecoBuffer(OutBuffer *buf, Arguments *arguments); | |
700 static size_t dim(Arguments *arguments); | |
701 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
|
702 |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
658
diff
changeset
|
703 // LDC |
445
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
411
diff
changeset
|
704 unsigned llvmAttrs; |
159 | 705 }; |
706 | |
707 extern int PTRSIZE; | |
708 extern int REALSIZE; | |
709 extern int REALPAD; | |
710 extern int Tsize_t; | |
711 extern int Tptrdiff_t; | |
712 | |
713 #endif /* DMD_MTYPE_H */ |