[llvm-commits] [llvm] r62610 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
Devang Patel
dpatel at apple.com
Tue Jan 20 13:02:02 PST 2009
Author: dpatel
Date: Tue Jan 20 15:02:02 2009
New Revision: 62610
URL: http://llvm.org/viewvc/llvm-project?rev=62610&view=rev
Log:
Fix struct member's debug info.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=62610&r1=62609&r2=62610&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Tue Jan 20 15:02:02 2009
@@ -1802,13 +1802,9 @@
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 @@
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,
More information about the llvm-commits
mailing list