diff options
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 6 | ||||
-rw-r--r-- | llvm/test/DebugInfo/ARM/big-endian-bitfield.ll | 4 | ||||
-rw-r--r-- | llvm/test/DebugInfo/X86/bitfields-dwarf4.ll | 5 |
3 files changed, 6 insertions, 9 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); } diff --git a/llvm/test/DebugInfo/ARM/big-endian-bitfield.ll b/llvm/test/DebugInfo/ARM/big-endian-bitfield.ll index 742c50d0298..ba89b1414bf 100644 --- a/llvm/test/DebugInfo/ARM/big-endian-bitfield.ll +++ b/llvm/test/DebugInfo/ARM/big-endian-bitfield.ll @@ -29,26 +29,22 @@ target datalayout = "E-m:e-p:32:32-i64:64-v128:64:128-n32-S64" ; CHECK-NEXT: DW_AT_name{{.*}}"j" ; CHECK-NOT: DW_TAG ; CHECK: DW_AT_data_bit_offset [DW_FORM_data1] (0x00) -; CHECK: DW_AT_data_member_location [DW_FORM_data1] (0x00) !7 = !DIDerivedType(tag: DW_TAG_member, name: "j", scope: !5, file: !1, line: 2, baseType: !8, size: 5, align: 32) !8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) ; CHECK: DW_TAG_member ; CHECK-NEXT: DW_AT_name{{.*}}"k" ; CHECK-NOT: DW_TAG ; CHECK: DW_AT_data_bit_offset [DW_FORM_data1] (0x05) -; CHECK: DW_AT_data_member_location [DW_FORM_data1] (0x00) !9 = !DIDerivedType(tag: DW_TAG_member, name: "k", scope: !5, file: !1, line: 3, baseType: !8, size: 6, align: 32, offset: 5) ; CHECK: DW_TAG_member ; CHECK-NEXT: DW_AT_name{{.*}}"m" ; CHECK-NOT: DW_TAG ; CHECK: DW_AT_data_bit_offset [DW_FORM_data1] (0x0b) -; CHECK: DW_AT_data_member_location [DW_FORM_data1] (0x00) !10 = !DIDerivedType(tag: DW_TAG_member, name: "m", scope: !5, file: !1, line: 4, baseType: !8, size: 5, align: 32, offset: 11) ; CHECK: DW_TAG_member ; CHECK-NEXT: DW_AT_name{{.*}}"n" ; CHECK-NOT: DW_TAG ; CHECK: DW_AT_data_bit_offset [DW_FORM_data1] (0x10) -; CHECK: DW_AT_data_member_location [DW_FORM_data1] (0x00) !11 = !DIDerivedType(tag: DW_TAG_member, name: "n", scope: !5, file: !1, line: 5, baseType: !8, size: 8, align: 32, offset: 16) !12 = !{i32 2, !"Dwarf Version", i32 4} !13 = !{i32 2, !"Debug Info Version", i32 3} diff --git a/llvm/test/DebugInfo/X86/bitfields-dwarf4.ll b/llvm/test/DebugInfo/X86/bitfields-dwarf4.ll index 23b8bca7580..cefe61663d4 100644 --- a/llvm/test/DebugInfo/X86/bitfields-dwarf4.ll +++ b/llvm/test/DebugInfo/X86/bitfields-dwarf4.ll @@ -50,7 +50,7 @@ target triple = "x86_64-apple-macosx" ; CHECK: DW_AT_bit_size [DW_FORM_data1] (0x05) ; CHECK-NOT: DW_AT_byte_size ; CHECK-NEXT: DW_AT_data_bit_offset [DW_FORM_data1] (0x08) -; CHECK-NEXT: DW_AT_data_member_location [DW_FORM_data1] (0x00) +; CHECK-NOT: DW_AT_data_member_location !9 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !5, file: !1, line: 6, baseType: !10, size: 5, align: 32, offset: 8) !10 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint32_t", file: !11, line: 183, baseType: !12) @@ -64,7 +64,8 @@ target triple = "x86_64-apple-macosx" ; CHECK-NOT: DW_AT_byte_size ; CHECK: DW_AT_bit_size [DW_FORM_data1] (0x1b) ; CHECK-NEXT: DW_AT_data_bit_offset [DW_FORM_data1] (0x0d) -; CHECK-NEXT: DW_AT_data_member_location [DW_FORM_data1] (0x00) +; CHECK-NOT: DW_AT_data_member_location +; CHECK: DW_TAG !13 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !5, file: !1, line: 7, baseType: !10, size: 27, align: 32, offset: 13) !14 = !{i32 2, !"Dwarf Version", i32 4} |