[fix: handle unsized IR field types]

This commit is contained in:
Martin Kinkelin 2022-08-03 19:24:09 +02:00
parent bd5fab1f06
commit 372d6b4983
3 changed files with 7 additions and 24 deletions

View file

@ -1321,24 +1321,6 @@ void DtoSetFuncDeclIntrinsicName(TemplateInstance *ti, TemplateDeclaration *td,
////////////////////////////////////////////////////////////////////////////////
size_t getMemberSize(Type *type) {
const dinteger_t dSize = type->size();
llvm::Type *const llType = DtoType(type);
if (!llType->isSized()) {
// Forward reference in a cycle or similar, we need to trust the D type.
return dSize;
}
const uint64_t llSize = gDataLayout->getTypeAllocSize(llType);
assert(llSize <= dSize &&
"LLVM type is bigger than the corresponding D type, "
"might lead to aggregate layout mismatch.");
return llSize;
}
////////////////////////////////////////////////////////////////////////////////
Type *stripModifiers(Type *type, bool transitive) {
if (type->ty == TY::Tfunction) {
return type;