llvm.org GIT mirror llvm / 1e7ecc8
Revert "Debug Info: One more bitfield bugfix. While yesterday's r240853 fixed" This reverts commit 240890. Breaking the gdb buildbot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240893 91177308-0d34-0410-b5e6-96231b3b80d8 Adrian Prantl 5 years ago
2 changed file(s) with 14 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
13601360 // | ... |b1|b2|b3|b4|
13611361 // +-----------+-----*-----+-----*-----+--
13621362 // | | |<-- Size ->| |
1363 // |<---- Offset --->| | |<--->|
1364 // | | | | \_ DW_AT_bit_offset (little endian)
1365 // | |<--->| |
1366 // |<--big-e.->| \_ StartBitOffset = DW_AT_bit_offset (big endian)
1367 // | ^ | = DW_AT_data_bit_offset (biendian)
1368 // | OffsetInBytes |
1369 // | v |
1370 // |<----little-endian---->|
1363 // |<---- Offset --->| |<--->|
1364 // | | | \_ DW_AT_bit_offset (little endian)
1365 // | |<--->|
1366 // |<--------->| \_ StartBitOffset = DW_AT_bit_offset (big endian)
1367 // \ = DW_AT_data_bit_offset (biendian)
1368 // \_ OffsetInBytes
13711369 uint64_t Offset = DT->getOffsetInBits();
13721370 uint64_t Align = DT->getAlignInBits() ? DT->getAlignInBits() : FieldSize;
13731371 uint64_t AlignMask = ~(Align - 1);
13741372 // The bits from the start of the storage unit to the start of the field.
13751373 uint64_t StartBitOffset = Offset - (Offset & AlignMask);
1376 // OffsetInBytes is the byte offset of the field's aligned storage unit
1377 // inside the struct.
1378 uint64_t DwarfBitOffset;
1379 if (Asm->getDataLayout().isLittleEndian()) {
1380 DwarfBitOffset = OffsetToAlignment(Offset + Size, Align);
1381 OffsetInBytes = ((Offset + Size) & AlignMask) / 8;
1382 } else {
1383 DwarfBitOffset = StartBitOffset;
1384 OffsetInBytes = (Offset - StartBitOffset) / 8;
1385 }
1374 // The endian-dependent DWARF 2 offset.
1375 uint64_t DwarfBitOffset = Asm->getDataLayout().isLittleEndian()
1376 ? OffsetToAlignment(Offset + Size, Align)
1377 : StartBitOffset;
1378
1379 // The byte offset of the field's aligned storage unit inside the struct.
1380 OffsetInBytes = (Offset - StartBitOffset) / 8;
13861381 addUInt(MemberDie, dwarf::DW_AT_bit_offset, None, DwarfBitOffset);
13871382 } else
13881383 // This is not a bitfield.
1313 ; CHECK: DW_AT_byte_size {{.*}} (0x04)
1414 ; CHECK: DW_AT_bit_size {{.*}} (0x1c)
1515 ; CHECK: DW_AT_bit_offset {{.*}} (0x18)
16 ; CHECK: DW_AT_data_member_location {{.*}}04
16 ; CHECK: DW_AT_data_member_location {{.*}}00
1717 target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
1818 target triple = "thumbv7-apple-ios"
1919