mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 16:11:08 +03:00
Debug info: move the IrTypeAggr::diCompositeType field into IrAggr to get it reset when emitting a new module
diCompositeType might contain references to another compile unit, so has to be re-created for each module.
This commit is contained in:
parent
02eb4058fa
commit
a62a94fa43
3 changed files with 11 additions and 12 deletions
|
@ -506,11 +506,10 @@ ldc::DIType ldc::DIBuilder::CreateCompositeType(Type *type) {
|
|||
LLType *T = DtoType(ad->type);
|
||||
if (t->ty == Tclass)
|
||||
T = T->getPointerElementType();
|
||||
IrTypeAggr *ir = ad->type->ctype->isAggr();
|
||||
assert(ir);
|
||||
IrAggr *irAggr = getIrAggr(ad, true);
|
||||
|
||||
if (static_cast<llvm::MDNode *>(ir->diCompositeType) != nullptr) {
|
||||
return ir->diCompositeType;
|
||||
if (static_cast<llvm::MDNode *>(irAggr->diCompositeType) != nullptr) {
|
||||
return irAggr->diCompositeType;
|
||||
}
|
||||
|
||||
const llvm::StringRef name = ad->ident->toChars();
|
||||
|
@ -534,7 +533,7 @@ ldc::DIType ldc::DIBuilder::CreateCompositeType(Type *type) {
|
|||
// set diCompositeType to handle recursive types properly
|
||||
unsigned tag = (t->ty == Tstruct) ? llvm::dwarf::DW_TAG_structure_type
|
||||
: llvm::dwarf::DW_TAG_class_type;
|
||||
ir->diCompositeType = DBuilder.createReplaceableCompositeType(
|
||||
irAggr->diCompositeType = DBuilder.createReplaceableCompositeType(
|
||||
tag, name, scope, file, linnum);
|
||||
|
||||
if (!ad->isInterfaceDeclaration()) // plain interfaces don't have one
|
||||
|
@ -602,9 +601,9 @@ ldc::DIType ldc::DIBuilder::CreateCompositeType(Type *type) {
|
|||
uniqueIdent(t)); // UniqueIdentifier
|
||||
}
|
||||
|
||||
ir->diCompositeType = DBuilder.replaceTemporary(
|
||||
llvm::TempDINode(ir->diCompositeType), static_cast<llvm::DIType *>(ret));
|
||||
ir->diCompositeType = ret;
|
||||
irAggr->diCompositeType = DBuilder.replaceTemporary(
|
||||
llvm::TempDINode(irAggr->diCompositeType), static_cast<llvm::DIType *>(ret));
|
||||
irAggr->diCompositeType = ret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue