diff options
author | Devang Patel <dpatel@apple.com> | 2009-11-04 22:06:12 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-11-04 22:06:12 +0000 |
commit | 67f56f08c2057ed2e079f8ab1edfb31b29e01920 (patch) | |
tree | fc6c92b11068386b42567ee7dd24b6fa39783777 /llvm/lib/CodeGen | |
parent | f174268a1f10a6b23b9c5eb8684d185437bb4252 (diff) | |
download | bcm5719-llvm-67f56f08c2057ed2e079f8ab1edfb31b29e01920.tar.gz bcm5719-llvm-67f56f08c2057ed2e079f8ab1edfb31b29e01920.zip |
Fix DW_AT_data_member_location for bit-fields. It points to the location of annonymous field that covers respective field.
llvm-svn: 86054
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 674304e7b36..dc4c9096ab0 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1137,6 +1137,9 @@ DIE *DwarfDebug::CreateMemberDIE(CompileUnit *DW_Unit, const DIDerivedType &DT){ AddSourceLine(MemberDie, &DT); + DIEBlock *MemLocationDie = new DIEBlock(); + AddUInt(MemLocationDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst); + uint64_t Size = DT.getSizeInBits(); uint64_t FieldSize = Size; if (DT.getTypeDerivedFrom().getTag() != dwarf::DW_TAG_array_type) @@ -1157,12 +1160,16 @@ DIE *DwarfDebug::CreateMemberDIE(CompileUnit *DW_Unit, const DIDerivedType &DT){ // Maybe we need to work from the other end. if (TD->isLittleEndian()) Offset = FieldSize - (Offset + Size); AddUInt(MemberDie, dwarf::DW_AT_bit_offset, 0, Offset); - } - DIEBlock *Block = new DIEBlock(); - AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst); - AddUInt(Block, 0, dwarf::DW_FORM_udata, DT.getOffsetInBits() >> 3); - AddBlock(MemberDie, dwarf::DW_AT_data_member_location, 0, Block); + // Here WD_AT_data_member_location points to the anonymous + // field that includes this bit field. + AddUInt(MemLocationDie, 0, dwarf::DW_FORM_udata, FieldOffset >> 3); + + } else + // This is not a bitfield. + AddUInt(MemLocationDie, 0, dwarf::DW_FORM_udata, DT.getOffsetInBits() >> 3); + + AddBlock(MemberDie, dwarf::DW_AT_data_member_location, 0, MemLocationDie); if (DT.isProtected()) AddUInt(MemberDie, dwarf::DW_AT_accessibility, 0, |