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