Mercurial > projects > ldc
comparison gen/llvmhelpers.cpp @ 1044:39f12f5aa515
Fix hasUnalignedFields(): take static arrays into account too.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Wed, 04 Mar 2009 23:17:32 +0100 |
parents | 4d366a75d95f |
children | 7ce8355fbcc6 |
comparison
equal
deleted
inserted
replaced
1043:0485751a40ae | 1044:39f12f5aa515 |
---|---|
1569 ////////////////////////////////////////////////////////////////////////////////////////// | 1569 ////////////////////////////////////////////////////////////////////////////////////////// |
1570 | 1570 |
1571 bool hasUnalignedFields(Type* t) | 1571 bool hasUnalignedFields(Type* t) |
1572 { | 1572 { |
1573 t = t->toBasetype(); | 1573 t = t->toBasetype(); |
1574 if (t->ty != Tstruct) | 1574 if (t->ty == Tsarray) { |
1575 assert(t->next->size() % t->next->alignsize() == 0); | |
1576 return hasUnalignedFields(t->next); | |
1577 } else if (t->ty != Tstruct) | |
1575 return false; | 1578 return false; |
1576 | 1579 |
1577 TypeStruct* ts = (TypeStruct*)t; | 1580 TypeStruct* ts = (TypeStruct*)t; |
1578 if (ts->unaligned) | 1581 if (ts->unaligned) |
1579 return (ts->unaligned == 2); | 1582 return (ts->unaligned == 2); |