mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 16:11:08 +03:00
Add debug info for all class fields, including those from super classes...
This commit is contained in:
parent
e2ba08388f
commit
2690f3cfd8
1 changed files with 36 additions and 7 deletions
|
@ -215,6 +215,28 @@ static llvm::DIDerivedType dwarfMemberType(unsigned linnum, Type* type, llvm::DI
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void add_base_fields(
|
||||
ClassDeclaration* sd,
|
||||
llvm::DICompileUnit compileUnit,
|
||||
llvm::DICompileUnit definedCU,
|
||||
std::vector<LLConstant*>& elems)
|
||||
{
|
||||
if (sd->baseClass)
|
||||
{
|
||||
add_base_fields(sd->baseClass, compileUnit, definedCU, elems);
|
||||
}
|
||||
|
||||
ArrayIter<VarDeclaration> it(sd->fields);
|
||||
size_t narr = sd->fields.dim;
|
||||
elems.reserve(narr);
|
||||
for (; !it.done(); it.next())
|
||||
{
|
||||
VarDeclaration* vd = it.get();
|
||||
LLGlobalVariable* ptr = dwarfMemberType(vd->loc.linnum, vd->type, compileUnit, definedCU, vd->toChars(), vd->offset).getGV();
|
||||
elems.push_back(DBG_CAST(ptr));
|
||||
}
|
||||
}
|
||||
|
||||
//FIXME: This does not use llvm's DIFactory as it can't
|
||||
// handle recursive types properly.
|
||||
static llvm::DICompositeType dwarfCompositeType(Type* type, llvm::DICompileUnit compileUnit)
|
||||
|
@ -301,14 +323,21 @@ static llvm::DICompositeType dwarfCompositeType(Type* type, llvm::DICompileUnit
|
|||
std::vector<LLConstant*> elems;
|
||||
if (!ir->aggrdecl->isInterfaceDeclaration()) // plain interfaces don't have one
|
||||
{
|
||||
ArrayIter<VarDeclaration> it(sd->fields);
|
||||
size_t narr = sd->fields.dim;
|
||||
elems.reserve(narr);
|
||||
for (; !it.done(); it.next())
|
||||
if (t->ty == Tstruct)
|
||||
{
|
||||
VarDeclaration* vd = it.get();
|
||||
LLGlobalVariable* ptr = dwarfMemberType(vd->loc.linnum, vd->type, compileUnit, definedCU, vd->toChars(), vd->offset).getGV();
|
||||
elems.push_back(DBG_CAST(ptr));
|
||||
ArrayIter<VarDeclaration> it(sd->fields);
|
||||
size_t narr = sd->fields.dim;
|
||||
elems.reserve(narr);
|
||||
for (; !it.done(); it.next())
|
||||
{
|
||||
VarDeclaration* vd = it.get();
|
||||
LLGlobalVariable* ptr = dwarfMemberType(vd->loc.linnum, vd->type, compileUnit, definedCU, vd->toChars(), vd->offset).getGV();
|
||||
elems.push_back(DBG_CAST(ptr));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
add_base_fields(ir->aggrdecl->isClassDeclaration(), compileUnit, definedCU, elems);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue