Fix v1.31 regression wrt. unresolved IrAggr (#4312)

And use `IrTypeClass::getVtblType()` to get the vtable LLVM array
type, instead of deriving it from the `IrClass::getVtblSymbol()`
global (invoking that function may define the vtable!).

I've hit some compiler crashes for the Symmetry code base, on
Windows only. I guess the problem surfaced due to
`-link-defaultlib-shared`, which on Windows causes some vtables of
instantiated classes to be defined whenever accessing the vtable
symbol. I don't have a reduced test case unfortunately.
This commit is contained in:
Martin Kinkelin 2023-02-06 17:02:07 +01:00 committed by GitHub
parent 58c4b8bdae
commit 5f46c65ab5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 39 deletions

View file

@ -441,9 +441,8 @@ void buildTypeInfo(TypeInfoDeclaration *decl) {
assert(isBuiltin && "existing global expected to be the init symbol of a "
"built-in TypeInfo");
} else {
DtoType(decl->type);
TypeClass *tclass = decl->type->isTypeClass();
LLType *type = getIrType(tclass)->isClass()->getMemoryLLType();
TypeClass *tc = decl->type->isTypeClass();
LLType *type = getIrType(tc->sym->type, true)->isClass()->getMemoryLLType();
// We need to keep the symbol mutable as the type is not declared as
// immutable on the D side, and e.g. synchronized() can be used on the
// implicit monitor.