Mercurial > projects > ldc
annotate dmd/mtype.h @ 1351:8d501abecd24
Initial (but disabled) fix for ticket #294 , the actual part that fixes the bug is in a #if 0 block as I'm afraid it will cause regressions. I'm most likely not going to be around tonight, and maybe not tomorrow as well, so I'm pushing it in case someone wants to run some serious testing/investigate the problem noted in llvmhelpers.cpp : realignOffset .
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Thu, 14 May 2009 17:20:17 +0200 |
parents | 465a77c904d4 |
children | 46f6365a50d7 |
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 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
24 #if IN_LLVM |
173
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
25 // llvm |
1184
a6dbd571d417
Moved ir/irtype.* into ir/irdtype.*.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1147
diff
changeset
|
26 #include "../ir/irdtype.h" |
1051
dc608dc33081
Make IrFuncTy a member of TypeFunction. Reset between modules compiled in the
Christian Kamm <kamm incasoftware de>
parents:
1029
diff
changeset
|
27 #include "../ir/irfuncty.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
|
28 namespace llvm { class Type; } |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
29 struct Ir; |
1192
3251ce06c820
Started seperating type resolution from the rest of codegen again, the merge had too many regressions.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1184
diff
changeset
|
30 |
3251ce06c820
Started seperating type resolution from the rest of codegen again, the merge had too many regressions.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1184
diff
changeset
|
31 class IrType; |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
32 #endif |
173
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
33 |
159 | 34 struct Scope; |
35 struct Identifier; | |
36 struct Expression; | |
37 struct StructDeclaration; | |
38 struct ClassDeclaration; | |
39 struct VarDeclaration; | |
40 struct EnumDeclaration; | |
41 struct TypedefDeclaration; | |
42 struct TypeInfoDeclaration; | |
43 struct Dsymbol; | |
44 struct TemplateInstance; | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1051
diff
changeset
|
45 struct CppMangleState; |
159 | 46 enum LINK; |
47 | |
48 struct TypeBasic; | |
49 struct HdrGenState; | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1051
diff
changeset
|
50 struct Argument; |
159 | 51 |
52 // Back end | |
53 #if IN_GCC | |
54 union tree_node; typedef union tree_node TYPE; | |
55 typedef TYPE type; | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
56 #endif |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
57 |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
58 #if IN_DMD |
159 | 59 typedef struct TYPE type; |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
60 struct Symbol; |
159 | 61 #endif |
62 | |
63 enum TY | |
64 { | |
65 Tarray, // dynamic array | |
66 Tsarray, // static array | |
67 Taarray, // associative array | |
68 Tpointer, | |
69 Treference, | |
70 Tfunction, | |
71 Tident, | |
72 Tclass, | |
73 Tstruct, | |
74 Tenum, | |
75 Ttypedef, | |
76 Tdelegate, | |
77 | |
78 Tnone, | |
79 Tvoid, | |
80 Tint8, | |
81 Tuns8, | |
82 Tint16, | |
83 Tuns16, | |
84 Tint32, | |
85 Tuns32, | |
86 Tint64, | |
87 Tuns64, | |
88 Tfloat32, | |
89 Tfloat64, | |
90 Tfloat80, | |
91 | |
92 Timaginary32, | |
93 Timaginary64, | |
94 Timaginary80, | |
95 | |
96 Tcomplex32, | |
97 Tcomplex64, | |
98 Tcomplex80, | |
99 | |
100 Tbit, | |
101 Tbool, | |
102 Tchar, | |
103 Twchar, | |
104 Tdchar, | |
105 | |
106 Terror, | |
107 Tinstance, | |
108 Ttypeof, | |
109 Ttuple, | |
110 Tslice, | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1051
diff
changeset
|
111 Treturn, |
159 | 112 TMAX |
113 }; | |
114 | |
115 #define Tascii Tchar | |
116 | |
117 extern int Tsize_t; | |
118 extern int Tptrdiff_t; | |
119 | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1051
diff
changeset
|
120 |
159 | 121 struct Type : Object |
122 { | |
123 TY ty; | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1051
diff
changeset
|
124 unsigned char mod; // modifiers MODxxxx |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1051
diff
changeset
|
125 /* pick this order of numbers so switch statements work better |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1051
diff
changeset
|
126 */ |
159 | 127 #define MODconst 1 // type is const |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1051
diff
changeset
|
128 #define MODinvariant 4 // type is invariant |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1051
diff
changeset
|
129 #define MODshared 2 // type is shared |
159 | 130 char *deco; |
131 Type *pto; // merged pointer to this type | |
132 Type *rto; // reference to this type | |
133 Type *arrayof; // array of this type | |
134 TypeInfoDeclaration *vtinfo; // TypeInfo object for this Type | |
135 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
136 #if IN_DMD |
159 | 137 type *ctype; // for back end |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
138 #endif |
159 | 139 |
140 #define tvoid basic[Tvoid] | |
141 #define tint8 basic[Tint8] | |
142 #define tuns8 basic[Tuns8] | |
143 #define tint16 basic[Tint16] | |
144 #define tuns16 basic[Tuns16] | |
145 #define tint32 basic[Tint32] | |
146 #define tuns32 basic[Tuns32] | |
147 #define tint64 basic[Tint64] | |
148 #define tuns64 basic[Tuns64] | |
149 #define tfloat32 basic[Tfloat32] | |
150 #define tfloat64 basic[Tfloat64] | |
151 #define tfloat80 basic[Tfloat80] | |
152 | |
153 #define timaginary32 basic[Timaginary32] | |
154 #define timaginary64 basic[Timaginary64] | |
155 #define timaginary80 basic[Timaginary80] | |
156 | |
157 #define tcomplex32 basic[Tcomplex32] | |
158 #define tcomplex64 basic[Tcomplex64] | |
159 #define tcomplex80 basic[Tcomplex80] | |
160 | |
161 #define tbit basic[Tbit] | |
162 #define tbool basic[Tbool] | |
163 #define tchar basic[Tchar] | |
164 #define twchar basic[Twchar] | |
165 #define tdchar basic[Tdchar] | |
166 | |
167 // Some special types | |
168 #define tshiftcnt tint32 // right side of shift expression | |
169 // #define tboolean tint32 // result of boolean expression | |
170 #define tboolean tbool // result of boolean expression | |
171 #define tindex tint32 // array/ptr index | |
172 static Type *tvoidptr; // void* | |
173 #define terror basic[Terror] // for error recovery | |
174 | |
175 #define tsize_t basic[Tsize_t] // matches size_t alias | |
176 #define tptrdiff_t basic[Tptrdiff_t] // matches ptrdiff_t alias | |
177 #define thash_t tsize_t // matches hash_t alias | |
178 | |
179 static ClassDeclaration *typeinfo; | |
180 static ClassDeclaration *typeinfoclass; | |
181 static ClassDeclaration *typeinfointerface; | |
182 static ClassDeclaration *typeinfostruct; | |
183 static ClassDeclaration *typeinfotypedef; | |
184 static ClassDeclaration *typeinfopointer; | |
185 static ClassDeclaration *typeinfoarray; | |
186 static ClassDeclaration *typeinfostaticarray; | |
187 static ClassDeclaration *typeinfoassociativearray; | |
188 static ClassDeclaration *typeinfoenum; | |
189 static ClassDeclaration *typeinfofunction; | |
190 static ClassDeclaration *typeinfodelegate; | |
191 static ClassDeclaration *typeinfotypelist; | |
192 | |
193 static Type *basic[TMAX]; | |
194 static unsigned char mangleChar[TMAX]; | |
195 static StringTable stringtable; | |
1245
465a77c904d4
Fixed all issues preventing Tango 0.99.8 to compile with `sh build-tango.sh --verbose ldc'.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1228
diff
changeset
|
196 #if IN_LLVM |
465a77c904d4
Fixed all issues preventing Tango 0.99.8 to compile with `sh build-tango.sh --verbose ldc'.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1228
diff
changeset
|
197 static StringTable deco_stringtable; |
465a77c904d4
Fixed all issues preventing Tango 0.99.8 to compile with `sh build-tango.sh --verbose ldc'.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1228
diff
changeset
|
198 #endif |
159 | 199 |
200 // These tables are for implicit conversion of binary ops; | |
201 // the indices are the type of operand one, followed by operand two. | |
202 static unsigned char impcnvResult[TMAX][TMAX]; | |
203 static unsigned char impcnvType1[TMAX][TMAX]; | |
204 static unsigned char impcnvType2[TMAX][TMAX]; | |
205 | |
206 // If !=0, give warning on implicit conversion | |
207 static unsigned char impcnvWarn[TMAX][TMAX]; | |
208 | |
209 Type(TY ty, Type *next); | |
210 virtual Type *syntaxCopy(); | |
211 int equals(Object *o); | |
212 int dyncast() { return DYNCAST_TYPE; } // kludge for template.isType() | |
213 int covariant(Type *t); | |
214 char *toChars(); | |
215 static char needThisPrefix(); | |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
216 #if IN_LLVM |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
217 static void init(Ir*); |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
218 #else |
159 | 219 static void init(); |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
220 #endif |
159 | 221 d_uns64 size(); |
222 virtual d_uns64 size(Loc loc); | |
223 virtual unsigned alignsize(); | |
224 virtual Type *semantic(Loc loc, Scope *sc); | |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
225 // append the mangleof or a string uniquely identifying this type to buf |
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
226 virtual void toDecoBuffer(OutBuffer *buf, bool mangle); |
159 | 227 Type *merge(); |
228 virtual void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
229 virtual void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
230 void toCBuffer3(OutBuffer *buf, HdrGenState *hgs, int mod); | |
231 virtual int isbit(); | |
232 virtual int isintegral(); | |
233 virtual int isfloating(); // real, imaginary, or complex | |
234 virtual int isreal(); | |
235 virtual int isimaginary(); | |
236 virtual int iscomplex(); | |
237 virtual int isscalar(); | |
238 virtual int isunsigned(); | |
239 virtual int isauto(); | |
240 virtual int isString(); | |
241 virtual int checkBoolean(); // if can be converted to boolean value | |
242 void checkDeprecated(Loc loc, Scope *sc); | |
243 Type *pointerTo(); | |
244 Type *referenceTo(); | |
245 Type *arrayOf(); | |
246 virtual Dsymbol *toDsymbol(Scope *sc); | |
247 virtual Type *toBasetype(); | |
248 virtual int isBaseOf(Type *t, int *poffset); | |
249 virtual MATCH implicitConvTo(Type *to); | |
250 virtual ClassDeclaration *isClassHandle(); | |
251 virtual Expression *getProperty(Loc loc, Identifier *ident); | |
252 virtual Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
253 virtual unsigned memalign(unsigned salign); | |
254 virtual Expression *defaultInit(Loc loc = 0); | |
255 virtual int isZeroInit(); // if initializer is 0 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
256 #if IN_DMD |
159 | 257 virtual dt_t **toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
258 #endif |
159 | 259 Identifier *getTypeInfoIdent(int internal); |
260 virtual MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
261 virtual void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
262 Expression *getInternalTypeInfo(Scope *sc); | |
263 Expression *getTypeInfo(Scope *sc); | |
264 virtual TypeInfoDeclaration *getTypeInfoDeclaration(); | |
265 virtual int builtinTypeInfo(); | |
266 virtual Type *reliesOnTident(); | |
267 virtual Expression *toExpression(); | |
268 virtual int hasPointers(); | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1051
diff
changeset
|
269 Type *next; |
159 | 270 Type *nextOf() { return next; } |
271 | |
272 static void error(Loc loc, const char *format, ...); | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1051
diff
changeset
|
273 static void warning(Loc loc, const char *format, ...); |
159 | 274 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
275 #if IN_DMD |
159 | 276 // For backend |
277 virtual unsigned totym(); | |
278 virtual type *toCtype(); | |
279 virtual type *toCParamtype(); | |
280 virtual Symbol *toSymbol(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
281 #endif |
159 | 282 |
283 // For eliminating dynamic_cast | |
284 virtual TypeBasic *isTypeBasic(); | |
173
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
285 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
286 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
658
diff
changeset
|
287 // LDC |
1184
a6dbd571d417
Moved ir/irtype.* into ir/irdtype.*.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1147
diff
changeset
|
288 IrDType ir; |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
289 static Ir* sir; |
1192
3251ce06c820
Started seperating type resolution from the rest of codegen again, the merge had too many regressions.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1184
diff
changeset
|
290 |
3251ce06c820
Started seperating type resolution from the rest of codegen again, the merge had too many regressions.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1184
diff
changeset
|
291 IrType* irtype; |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
292 #endif |
159 | 293 }; |
294 | |
295 struct TypeBasic : Type | |
296 { | |
658
50383e476c7e
Upgraded frontend to DMD 1.035
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
508
diff
changeset
|
297 const char *dstring; |
50383e476c7e
Upgraded frontend to DMD 1.035
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
508
diff
changeset
|
298 const char *cstring; |
159 | 299 unsigned flags; |
300 | |
301 TypeBasic(TY ty); | |
302 Type *syntaxCopy(); | |
303 d_uns64 size(Loc loc); | |
304 unsigned alignsize(); | |
305 Expression *getProperty(Loc loc, Identifier *ident); | |
306 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
307 char *toChars(); | |
308 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
309 int isintegral(); | |
310 int isbit(); | |
311 int isfloating(); | |
312 int isreal(); | |
313 int isimaginary(); | |
314 int iscomplex(); | |
315 int isscalar(); | |
316 int isunsigned(); | |
317 MATCH implicitConvTo(Type *to); | |
318 Expression *defaultInit(Loc loc); | |
319 int isZeroInit(); | |
320 int builtinTypeInfo(); | |
321 | |
322 // For eliminating dynamic_cast | |
323 TypeBasic *isTypeBasic(); | |
324 }; | |
325 | |
326 struct TypeArray : Type | |
327 { | |
328 TypeArray(TY ty, Type *next); | |
329 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
330 }; | |
331 | |
332 // Static array, one with a fixed dimension | |
333 struct TypeSArray : TypeArray | |
334 { | |
335 Expression *dim; | |
336 | |
337 TypeSArray(Type *t, Expression *dim); | |
338 Type *syntaxCopy(); | |
339 d_uns64 size(Loc loc); | |
340 unsigned alignsize(); | |
341 Type *semantic(Loc loc, Scope *sc); | |
342 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
343 void toDecoBuffer(OutBuffer *buf, bool mangle); |
159 | 344 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); |
345 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
346 int isString(); | |
347 int isZeroInit(); | |
348 unsigned memalign(unsigned salign); | |
349 MATCH implicitConvTo(Type *to); | |
350 Expression *defaultInit(Loc loc); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
351 #if IN_DMD |
159 | 352 dt_t **toDt(dt_t **pdt); |
353 dt_t **toDtElem(dt_t **pdt, Expression *e); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
354 #endif |
159 | 355 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); |
356 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
357 Expression *toExpression(); | |
358 int hasPointers(); | |
359 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
360 #if IN_DMD |
159 | 361 type *toCtype(); |
362 type *toCParamtype(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
363 #endif |
159 | 364 }; |
365 | |
366 // Dynamic array, no dimension | |
367 struct TypeDArray : TypeArray | |
368 { | |
369 TypeDArray(Type *t); | |
370 Type *syntaxCopy(); | |
371 d_uns64 size(Loc loc); | |
372 unsigned alignsize(); | |
373 Type *semantic(Loc loc, Scope *sc); | |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
374 void toDecoBuffer(OutBuffer *buf, bool mangle); |
159 | 375 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); |
376 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
377 int isString(); | |
378 int isZeroInit(); | |
379 int checkBoolean(); | |
380 MATCH implicitConvTo(Type *to); | |
381 Expression *defaultInit(Loc loc); | |
382 int builtinTypeInfo(); | |
383 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
384 int hasPointers(); | |
385 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
386 #if IN_DMD |
159 | 387 type *toCtype(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
388 #endif |
159 | 389 }; |
390 | |
391 struct TypeAArray : TypeArray | |
392 { | |
393 Type *index; // key type for type checking | |
394 Type *key; // actual key type | |
395 | |
396 TypeAArray(Type *t, Type *index); | |
397 Type *syntaxCopy(); | |
398 d_uns64 size(Loc loc); | |
399 Type *semantic(Loc loc, Scope *sc); | |
336 | 400 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
401 void toDecoBuffer(OutBuffer *buf, bool mangle); |
159 | 402 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); |
403 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
404 Expression *defaultInit(Loc loc); | |
405 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
|
406 int isZeroInit(); |
159 | 407 int checkBoolean(); |
408 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
409 int hasPointers(); | |
410 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
411 #if IN_DMD |
159 | 412 // 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
|
413 Symbol *aaGetSymbol(const char *func, int flags); |
159 | 414 |
415 type *toCtype(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
416 #endif |
159 | 417 }; |
418 | |
419 struct TypePointer : Type | |
420 { | |
421 TypePointer(Type *t); | |
422 Type *syntaxCopy(); | |
423 Type *semantic(Loc loc, Scope *sc); | |
424 d_uns64 size(Loc loc); | |
425 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
426 MATCH implicitConvTo(Type *to); | |
427 int isscalar(); | |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
658
diff
changeset
|
428 // 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
|
429 int isunsigned() { return TRUE; }; |
159 | 430 Expression *defaultInit(Loc loc); |
431 int isZeroInit(); | |
432 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
433 int hasPointers(); | |
434 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
435 #if IN_DMD |
159 | 436 type *toCtype(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
437 #endif |
159 | 438 }; |
439 | |
440 struct TypeReference : Type | |
441 { | |
442 TypeReference(Type *t); | |
443 Type *syntaxCopy(); | |
444 d_uns64 size(Loc loc); | |
445 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
446 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
447 Expression *defaultInit(Loc loc); | |
448 int isZeroInit(); | |
449 }; | |
450 | |
451 enum RET | |
452 { | |
453 RETregs = 1, // returned in registers | |
454 RETstack = 2, // returned on stack | |
455 }; | |
456 | |
457 struct TypeFunction : Type | |
458 { | |
459 Arguments *parameters; // function parameters | |
460 int varargs; // 1: T t, ...) style for variable number of arguments | |
461 // 2: T t ...) style for variable number of arguments | |
462 enum LINK linkage; // calling convention | |
463 | |
464 int inuse; | |
465 | |
466 TypeFunction(Arguments *parameters, Type *treturn, int varargs, enum LINK linkage); | |
467 Type *syntaxCopy(); | |
468 Type *semantic(Loc loc, Scope *sc); | |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
469 void toDecoBuffer(OutBuffer *buf, bool mangle); |
159 | 470 void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); |
471 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
472 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
473 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
474 Type *reliesOnTident(); | |
475 | |
476 int callMatch(Expressions *toargs); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
477 #if IN_DMD |
159 | 478 type *toCtype(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
479 #endif |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
480 |
159 | 481 enum RET retStyle(); |
482 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
483 #if IN_DMD |
159 | 484 unsigned totym(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
485 #elif IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
658
diff
changeset
|
486 // LDC |
1051
dc608dc33081
Make IrFuncTy a member of TypeFunction. Reset between modules compiled in the
Christian Kamm <kamm incasoftware de>
parents:
1029
diff
changeset
|
487 IrFuncTy fty; |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
488 |
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
489 FuncDeclaration* funcdecl; |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
490 #endif |
159 | 491 }; |
492 | |
493 struct TypeDelegate : Type | |
494 { | |
495 TypeDelegate(Type *t); | |
496 Type *syntaxCopy(); | |
497 Type *semantic(Loc loc, Scope *sc); | |
498 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
|
499 unsigned alignsize(); // added in LDC |
159 | 500 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); |
501 Expression *defaultInit(Loc loc); | |
502 int isZeroInit(); | |
503 int checkBoolean(); | |
504 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
505 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
506 int hasPointers(); | |
507 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
508 #if IN_DMD |
159 | 509 type *toCtype(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
510 #endif |
159 | 511 }; |
512 | |
513 struct TypeQualified : Type | |
514 { | |
515 Loc loc; | |
516 Array idents; // array of Identifier's representing ident.ident.ident etc. | |
517 | |
518 TypeQualified(TY ty, Loc loc); | |
519 void syntaxCopyHelper(TypeQualified *t); | |
520 void addIdent(Identifier *ident); | |
521 void toCBuffer2Helper(OutBuffer *buf, HdrGenState *hgs); | |
522 d_uns64 size(Loc loc); | |
523 void resolveHelper(Loc loc, Scope *sc, Dsymbol *s, Dsymbol *scopesym, | |
524 Expression **pe, Type **pt, Dsymbol **ps); | |
525 }; | |
526 | |
527 struct TypeIdentifier : TypeQualified | |
528 { | |
529 Identifier *ident; | |
530 | |
531 TypeIdentifier(Loc loc, Identifier *ident); | |
532 Type *syntaxCopy(); | |
533 //char *toChars(); | |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
534 void toDecoBuffer(OutBuffer *buf, bool mangle); |
159 | 535 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); |
536 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
537 Dsymbol *toDsymbol(Scope *sc); | |
538 Type *semantic(Loc loc, Scope *sc); | |
539 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
540 Type *reliesOnTident(); | |
541 Expression *toExpression(); | |
542 }; | |
543 | |
544 /* Similar to TypeIdentifier, but with a TemplateInstance as the root | |
545 */ | |
546 struct TypeInstance : TypeQualified | |
547 { | |
548 TemplateInstance *tempinst; | |
549 | |
550 TypeInstance(Loc loc, TemplateInstance *tempinst); | |
551 Type *syntaxCopy(); | |
552 //char *toChars(); | |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
553 //void toDecoBuffer(OutBuffer *buf, bool mangle); |
159 | 554 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); |
555 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
556 Type *semantic(Loc loc, Scope *sc); | |
875
330f999ade44
Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
797
diff
changeset
|
557 Dsymbol *toDsymbol(Scope *sc); |
159 | 558 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); |
559 }; | |
560 | |
561 struct TypeTypeof : TypeQualified | |
562 { | |
563 Expression *exp; | |
564 | |
565 TypeTypeof(Loc loc, Expression *exp); | |
566 Type *syntaxCopy(); | |
567 Dsymbol *toDsymbol(Scope *sc); | |
568 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
569 Type *semantic(Loc loc, Scope *sc); | |
570 d_uns64 size(Loc loc); | |
571 }; | |
572 | |
573 struct TypeStruct : Type | |
574 { | |
575 StructDeclaration *sym; | |
576 | |
577 TypeStruct(StructDeclaration *sym); | |
578 d_uns64 size(Loc loc); | |
579 unsigned alignsize(); | |
580 char *toChars(); | |
581 Type *syntaxCopy(); | |
582 Type *semantic(Loc loc, Scope *sc); | |
583 Dsymbol *toDsymbol(Scope *sc); | |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
584 void toDecoBuffer(OutBuffer *buf, bool mangle); |
159 | 585 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); |
586 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
587 unsigned memalign(unsigned salign); | |
588 Expression *defaultInit(Loc loc); | |
589 int isZeroInit(); | |
590 int checkBoolean(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
591 #if IN_DMD |
159 | 592 dt_t **toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
593 #endif |
159 | 594 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); |
595 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
596 int hasPointers(); | |
597 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
598 #if IN_DMD |
159 | 599 type *toCtype(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
600 #elif IN_LLVM |
1029
4d366a75d95f
Added hasUnalignedFields helper to check if a type has unaligned fields - as per request from fvbommel. Result is cached in TypeStruct.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1024
diff
changeset
|
601 // LDC |
4d366a75d95f
Added hasUnalignedFields helper to check if a type has unaligned fields - as per request from fvbommel. Result is cached in TypeStruct.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1024
diff
changeset
|
602 // cache the hasUnalignedFields check |
4d366a75d95f
Added hasUnalignedFields helper to check if a type has unaligned fields - as per request from fvbommel. Result is cached in TypeStruct.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1024
diff
changeset
|
603 // 0 = not checked, 1 = aligned, 2 = unaligned |
4d366a75d95f
Added hasUnalignedFields helper to check if a type has unaligned fields - as per request from fvbommel. Result is cached in TypeStruct.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1024
diff
changeset
|
604 int unaligned; |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
605 #endif |
159 | 606 }; |
607 | |
608 struct TypeEnum : Type | |
609 { | |
610 EnumDeclaration *sym; | |
611 | |
612 TypeEnum(EnumDeclaration *sym); | |
613 d_uns64 size(Loc loc); | |
614 unsigned alignsize(); | |
615 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
|
616 Type *syntaxCopy(); |
159 | 617 Type *semantic(Loc loc, Scope *sc); |
618 Dsymbol *toDsymbol(Scope *sc); | |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
619 void toDecoBuffer(OutBuffer *buf, bool mangle); |
159 | 620 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); |
621 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
622 Expression *getProperty(Loc loc, Identifier *ident); | |
623 int isintegral(); | |
624 int isfloating(); | |
625 int isscalar(); | |
626 int isunsigned(); | |
627 MATCH implicitConvTo(Type *to); | |
628 Type *toBasetype(); | |
629 Expression *defaultInit(Loc loc); | |
630 int isZeroInit(); | |
631 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
632 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
633 int hasPointers(); | |
634 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
635 #if IN_DMD |
159 | 636 type *toCtype(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
637 #endif |
159 | 638 }; |
639 | |
640 struct TypeTypedef : Type | |
641 { | |
642 TypedefDeclaration *sym; | |
643 | |
644 TypeTypedef(TypedefDeclaration *sym); | |
645 Type *syntaxCopy(); | |
646 d_uns64 size(Loc loc); | |
647 unsigned alignsize(); | |
648 char *toChars(); | |
649 Type *semantic(Loc loc, Scope *sc); | |
650 Dsymbol *toDsymbol(Scope *sc); | |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
651 void toDecoBuffer(OutBuffer *buf, bool mangle); |
159 | 652 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); |
653 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
654 Expression *getProperty(Loc loc, Identifier *ident); | |
655 int isbit(); | |
656 int isintegral(); | |
657 int isfloating(); | |
658 int isreal(); | |
659 int isimaginary(); | |
660 int iscomplex(); | |
661 int isscalar(); | |
662 int isunsigned(); | |
663 int checkBoolean(); | |
664 Type *toBasetype(); | |
665 MATCH implicitConvTo(Type *to); | |
666 Expression *defaultInit(Loc loc); | |
667 int isZeroInit(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
668 #if IN_DMD |
159 | 669 dt_t **toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
670 #endif |
159 | 671 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); |
672 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
673 int hasPointers(); | |
674 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
675 #if IN_DMD |
159 | 676 type *toCtype(); |
677 type *toCParamtype(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
678 #endif |
159 | 679 }; |
680 | |
681 struct TypeClass : Type | |
682 { | |
683 ClassDeclaration *sym; | |
684 | |
685 TypeClass(ClassDeclaration *sym); | |
686 d_uns64 size(Loc loc); | |
687 char *toChars(); | |
688 Type *syntaxCopy(); | |
689 Type *semantic(Loc loc, Scope *sc); | |
690 Dsymbol *toDsymbol(Scope *sc); | |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
691 void toDecoBuffer(OutBuffer *buf, bool mangle); |
159 | 692 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); |
693 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
694 ClassDeclaration *isClassHandle(); | |
695 int isBaseOf(Type *t, int *poffset); | |
696 MATCH implicitConvTo(Type *to); | |
697 Expression *defaultInit(Loc loc); | |
698 int isZeroInit(); | |
699 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
700 int isauto(); | |
701 int checkBoolean(); | |
702 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
703 int hasPointers(); | |
704 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
705 #if IN_DMD |
159 | 706 type *toCtype(); |
707 | |
708 Symbol *toSymbol(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
709 #endif |
159 | 710 }; |
711 | |
712 struct TypeTuple : Type | |
713 { | |
714 Arguments *arguments; // types making up the tuple | |
715 | |
716 TypeTuple(Arguments *arguments); | |
717 TypeTuple(Expressions *exps); | |
718 Type *syntaxCopy(); | |
719 Type *semantic(Loc loc, Scope *sc); | |
720 int equals(Object *o); | |
721 Type *reliesOnTident(); | |
722 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
723 void toDecoBuffer(OutBuffer *buf, bool mangle); |
159 | 724 Expression *getProperty(Loc loc, Identifier *ident); |
725 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
726 }; | |
727 | |
728 struct TypeSlice : Type | |
729 { | |
730 Expression *lwr; | |
731 Expression *upr; | |
732 | |
733 TypeSlice(Type *next, Expression *lwr, Expression *upr); | |
734 Type *syntaxCopy(); | |
735 Type *semantic(Loc loc, Scope *sc); | |
736 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
737 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
738 }; | |
739 | |
740 /**************************************************************/ | |
741 | |
742 //enum InOut { None, In, Out, InOut, Lazy }; | |
743 | |
744 struct Argument : Object | |
745 { | |
746 //enum InOut inout; | |
747 unsigned storageClass; | |
748 Type *type; | |
749 Identifier *ident; | |
750 Expression *defaultArg; | |
751 | |
752 Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg); | |
753 Argument *syntaxCopy(); | |
754 Type *isLazyArray(); | |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
755 void toDecoBuffer(OutBuffer *buf, bool mangle); |
159 | 756 static Arguments *arraySyntaxCopy(Arguments *args); |
757 static char *argsTypesToChars(Arguments *args, int varargs); | |
758 static void argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Arguments *arguments, int varargs); | |
1228
79758fd2f48a
Added Doxygen file.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1192
diff
changeset
|
759 static void argsToDecoBuffer(OutBuffer *buf, Arguments *arguments, bool mangle); |
159 | 760 static size_t dim(Arguments *arguments); |
761 static Argument *getNth(Arguments *arguments, size_t nth, size_t *pn = NULL); | |
762 }; | |
763 | |
764 extern int PTRSIZE; | |
765 extern int REALSIZE; | |
766 extern int REALPAD; | |
767 extern int Tsize_t; | |
768 extern int Tptrdiff_t; | |
769 | |
770 #endif /* DMD_MTYPE_H */ |