mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-30 07:00:46 +03:00
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:
parent
58c4b8bdae
commit
5f46c65ab5
5 changed files with 37 additions and 39 deletions
|
@ -39,6 +39,7 @@
|
|||
#include "ir/irfunction.h"
|
||||
#include "ir/irmodule.h"
|
||||
#include "ir/irtypeaggr.h"
|
||||
#include "ir/irtypeclass.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/ManagedStatic.h"
|
||||
|
@ -1895,16 +1896,12 @@ DLValue *DtoIndexAggregate(LLValue *src, AggregateDeclaration *ad,
|
|||
// Cast the pointer we got to the canonical struct type the indices are
|
||||
// based on.
|
||||
LLType *st = nullptr;
|
||||
LLType *pst = nullptr;
|
||||
if (ad->isClassDeclaration()) {
|
||||
st = getIrAggr(ad)->getLLStructType();
|
||||
pst = DtoType(ad->type);
|
||||
if (auto irtc = irTypeAggr->isClass()) {
|
||||
st = irtc->getMemoryLLType();
|
||||
} else {
|
||||
st = irTypeAggr->getLLType();
|
||||
}
|
||||
else {
|
||||
st = DtoType(ad->type);
|
||||
pst = getPtrToType(st);
|
||||
}
|
||||
ptr = DtoBitCast(ptr, pst);
|
||||
ptr = DtoBitCast(ptr, st->getPointerTo());
|
||||
ptr = DtoGEP(st, ptr, 0, off);
|
||||
ty = isaStruct(st)->getElementType(off);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue