comparison ir/irstruct.cpp @ 737:041c1596d217

Removed warnings on ignored aligns. Only do aligment on packed structs, align(1) struct Packed { ... } Changed the way struct/class fields are added, first small part of cleaning up these... Make struct/class/union fields aware of any anonymous struct/union they might be part of, not yet really useful, but part of getting better union support.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Tue, 28 Oct 2008 15:41:09 +0100
parents 74101be2a553
children 340acf1535d0
comparison
equal deleted inserted replaced
736:e4e50f4b58cd 737:041c1596d217
1 #include "gen/llvm.h" 1 #include "gen/llvm.h"
2
2 #include "mtype.h" 3 #include "mtype.h"
3 #include "aggregate.h" 4 #include "aggregate.h"
5 #include "declaration.h"
6
4 #include "ir/irstruct.h" 7 #include "ir/irstruct.h"
5 #include "gen/irstate.h" 8 #include "gen/irstate.h"
9 #include "gen/tollvm.h"
6 10
7 IrInterface::IrInterface(BaseClass* b) 11 IrInterface::IrInterface(BaseClass* b)
8 { 12 {
9 base = b; 13 base = b;
10 decl = b->base; 14 decl = b->base;
54 } 58 }
55 59
56 IrStruct::~IrStruct() 60 IrStruct::~IrStruct()
57 { 61 {
58 } 62 }
63
64 void IrStruct::addField(VarDeclaration* v)
65 {
66 // might already have its irField, as classes derive each other without getting copies of the VarDeclaration
67 if (!v->ir.irField)
68 {
69 assert(!v->ir.isSet());
70 v->ir.irField = new IrField(v);
71 }
72 const LLType* _type = DtoType(v->type);
73 offsets.insert(std::make_pair(v->offset, IrStruct::Offset(v, _type)));
74 }