mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 23:50:43 +03:00
Merge branch 'master' into merge-2.075
Conflicts: runtime/druntime runtime/phobos
This commit is contained in:
commit
b085be1404
25 changed files with 543 additions and 262 deletions
|
@ -1302,42 +1302,6 @@ void DtoSetFuncDeclIntrinsicName(TemplateInstance *ti, TemplateDeclaration *td,
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool hasUnalignedFields(Type *t) {
|
||||
t = t->toBasetype();
|
||||
if (t->ty == Tsarray) {
|
||||
assert(t->nextOf()->size() % t->nextOf()->alignsize() == 0);
|
||||
return hasUnalignedFields(t->nextOf());
|
||||
}
|
||||
if (t->ty != Tstruct) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TypeStruct *ts = static_cast<TypeStruct *>(t);
|
||||
if (ts->unaligned) {
|
||||
return (ts->unaligned == 2);
|
||||
}
|
||||
|
||||
StructDeclaration *sym = ts->sym;
|
||||
|
||||
// go through all the fields and try to find something unaligned
|
||||
ts->unaligned = 2;
|
||||
for (unsigned i = 0; i < sym->fields.dim; i++) {
|
||||
VarDeclaration *f = static_cast<VarDeclaration *>(sym->fields.data[i]);
|
||||
unsigned a = f->type->alignsize() - 1;
|
||||
if (((f->offset + a) & ~a) != f->offset) {
|
||||
return true;
|
||||
}
|
||||
if (f->type->toBasetype()->ty == Tstruct && hasUnalignedFields(f->type)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ts->unaligned = 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
size_t getMemberSize(Type *type) {
|
||||
const dinteger_t dSize = type->size();
|
||||
llvm::Type *const llType = DtoType(type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue