summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 4011934c26f..f8c3f489ca4 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1390,8 +1390,8 @@ void DwarfUnit::constructMemberDIE(DIE &Buffer, const DIDerivedType *DT) {
uint64_t Size = DT->getSizeInBits();
uint64_t FieldSize = getBaseTypeSize(DD, DT);
uint64_t OffsetInBytes;
-
- if (FieldSize && Size != FieldSize) {
+ bool IsBitfield = FieldSize && Size != FieldSize;
+ if (IsBitfield) {
// Handle bitfield, assume bytes are 8 bits.
if (DD->getDwarfVersion() < 4)
addUInt(MemberDie, dwarf::DW_AT_byte_size, None, FieldSize/8);
@@ -1428,7 +1428,7 @@ void DwarfUnit::constructMemberDIE(DIE &Buffer, const DIDerivedType *DT) {
addUInt(*MemLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
addUInt(*MemLocationDie, dwarf::DW_FORM_udata, OffsetInBytes);
addBlock(MemberDie, dwarf::DW_AT_data_member_location, MemLocationDie);
- } else
+ } else if (!IsBitfield || DD->getDwarfVersion() < 4)
addUInt(MemberDie, dwarf::DW_AT_data_member_location, None,
OffsetInBytes);
}
OpenPOWER on IntegriCloud