comparison gen/structs.h @ 797:340acf1535d0

Removed KDevelop3 project files, CMake can generate them just fine! Fixed function literals in static initializers. Changed alignment of delegates from 2*PTRSIZE to just PTRSIZE. Changed errors to go to stderr instead of stdout. Fairly major rewriting of struct/union/class handling, STILL A BIT BUGGY !!!
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Sat, 29 Nov 2008 21:25:43 +0100
parents 5a2983f97498
children af7a6faf9406
comparison
equal deleted inserted replaced
796:6e7a4c3b64d2 797:340acf1535d0
31 LLValue* DtoStructEquals(TOK op, DValue* lhs, DValue* rhs); 31 LLValue* DtoStructEquals(TOK op, DValue* lhs, DValue* rhs);
32 32
33 // index a struct one level 33 // index a struct one level
34 LLValue* DtoIndexStruct(LLValue* src, StructDeclaration* sd, VarDeclaration* vd); 34 LLValue* DtoIndexStruct(LLValue* src, StructDeclaration* sd, VarDeclaration* vd);
35 35
36 struct DUnionField
37 {
38 unsigned offset;
39 size_t size;
40 std::vector<const LLType*> types;
41 LLConstant* init;
42 size_t initsize;
43
44 DUnionField() {
45 offset = 0;
46 size = 0;
47 init = NULL;
48 initsize = 0;
49 }
50 };
51
52 struct DUnionIdx
53 {
54 unsigned idx,idxos;
55 LLConstant* c;
56
57 DUnionIdx()
58 : idx(0), c(0) {}
59 DUnionIdx(unsigned _idx, unsigned _idxos, LLConstant* _c)
60 : idx(_idx), idxos(_idxos), c(_c) {}
61 bool operator<(const DUnionIdx& i) const {
62 return (idx < i.idx) || (idx == i.idx && idxos < i.idxos);
63 }
64 };
65
66 class DUnion
67 {
68 std::vector<DUnionField> fields;
69 bool ispacked;
70 public:
71 DUnion();
72 LLConstant* getConst(std::vector<DUnionIdx>& in);
73 };
74
75 #endif 36 #endif