summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2016-05-16 22:45:10 +0000
committerAdrian Prantl <aprantl@apple.com>2016-05-16 22:45:10 +0000
commite7d833defb62c1e4a1944cbad740f540c0ab44d2 (patch)
tree8879ad66559a854ebbeef2669ea2d6bf9cd55ade /llvm/lib/CodeGen/AsmPrinter
parent85df931dea607ef0c411ce6c01fe60afb5aa8d6a (diff)
downloadbcm5719-llvm-e7d833defb62c1e4a1944cbad740f540c0ab44d2.tar.gz
bcm5719-llvm-e7d833defb62c1e4a1944cbad740f540c0ab44d2.zip
Debug info: Don't emit a DW_AT_byte_size when emitting a DWARF4 bit field.
The DWARF spec clearly states that a bit field member should have either a DW_AT_byte_size or a DW_AT_bit_size, but not both. Also the DW_AT_byte_size is redundant with the size of the type of the member. This fixes a bug found in PR 27758. llvm-svn: 269714
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 51f25ec0fe6..4011934c26f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1393,7 +1393,8 @@ void DwarfUnit::constructMemberDIE(DIE &Buffer, const DIDerivedType *DT) {
if (FieldSize && Size != FieldSize) {
// Handle bitfield, assume bytes are 8 bits.
- addUInt(MemberDie, dwarf::DW_AT_byte_size, None, FieldSize/8);
+ if (DD->getDwarfVersion() < 4)
+ addUInt(MemberDie, dwarf::DW_AT_byte_size, None, FieldSize/8);
addUInt(MemberDie, dwarf::DW_AT_bit_size, None, Size);
uint64_t Offset = DT->getOffsetInBits();
OpenPOWER on IntegriCloud