Fix struct member's debug info.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62610 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2009-01-20 21:02:02 +00:00
parent c99031b02a
commit 2be5893a04

View File

@ -1802,13 +1802,9 @@ private:
else if (Element.getTag() == dwarf::DW_TAG_variable) // ???
ElemDie = CreateGlobalVariableDIE(DW_Unit,
DIGlobalVariable(Element.getGV()));
else {
DIDerivedType DT = DIDerivedType(Element.getGV());
assert (DT.isDerivedType(DT.getTag())
&& "Unexpected struct element type");
ElemDie = new DIE(DT.getTag());
AddType(DW_Unit, ElemDie, DT);
}
else
ElemDie = CreateMemberDIE(DW_Unit,
DIDerivedType(Element.getGV()));
Buffer.AddChild(ElemDie);
}
}
@ -1903,6 +1899,27 @@ private:
return GVDie;
}
/// CreateMemberDIE - Create new member DIE.
DIE *CreateMemberDIE(CompileUnit *DW_Unit, const DIDerivedType &DT) {
DIE *MemberDie = new DIE(DT.getTag());
std::string Name = DT.getName();
if (!Name.empty())
AddString(MemberDie, DW_AT_name, DW_FORM_string, Name);
AddType(DW_Unit, MemberDie, DT.getTypeDerivedFrom());
AddSourceLine(MemberDie, &DT);
AddUInt(MemberDie, DW_AT_bit_size, 0, DT.getSizeInBits());
DIEBlock *Block = new DIEBlock();
AddUInt(Block, 0, DW_FORM_data1, DW_OP_plus_uconst);
AddUInt(Block, 0, DW_FORM_udata, DT.getOffsetInBits() >> 3);
AddBlock(MemberDie, DW_AT_data_member_location, 0, Block);
// FIXME - Handle DW_AT_accessibility
return MemberDie;
}
/// CreateSubprogramDIE - Create new DIE using SP.
DIE *CreateSubprogramDIE(CompileUnit *DW_Unit,
const DISubprogram &SP,