Mercurial > projects > ldc
diff 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 |
line wrap: on
line diff
--- a/ir/irstruct.cpp Mon Oct 27 17:42:38 2008 +0100 +++ b/ir/irstruct.cpp Tue Oct 28 15:41:09 2008 +0100 @@ -1,8 +1,12 @@ #include "gen/llvm.h" + #include "mtype.h" #include "aggregate.h" +#include "declaration.h" + #include "ir/irstruct.h" #include "gen/irstate.h" +#include "gen/tollvm.h" IrInterface::IrInterface(BaseClass* b) { @@ -56,3 +60,15 @@ IrStruct::~IrStruct() { } + +void IrStruct::addField(VarDeclaration* v) +{ + // might already have its irField, as classes derive each other without getting copies of the VarDeclaration + if (!v->ir.irField) + { + assert(!v->ir.isSet()); + v->ir.irField = new IrField(v); + } + const LLType* _type = DtoType(v->type); + offsets.insert(std::make_pair(v->offset, IrStruct::Offset(v, _type))); +}