Reverting r193835 due to weirdness with Go...
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfUnit.cpp
index 17eb5037d4e9b94b95d39bf0e693fd34347d19a7..93df498377c349833ba322f2f37c17ab8057cda5 100644 (file)
@@ -1875,9 +1875,6 @@ void DwarfUnit::constructMemberDIE(DIE &Buffer, DIDerivedType DT) {
 
   addSourceLine(MemberDie, DT);
 
-  DIEBlock *MemLocationDie = new (DIEValueAllocator) DIEBlock();
-  addUInt(MemLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
-
   if (DT.getTag() == dwarf::DW_TAG_inheritance && DT.isVirtual()) {
 
     // For C++, virtual base classes are not at fixed offset. Use following
@@ -1922,7 +1919,11 @@ void DwarfUnit::constructMemberDIE(DIE &Buffer, DIDerivedType DT) {
     } else
       // This is not a bitfield.
       OffsetInBytes = DT.getOffsetInBits() >> 3;
-    addUInt(MemberDie, dwarf::DW_AT_data_member_location, None, OffsetInBytes);
+
+    DIEBlock *MemLocationDie = new (DIEValueAllocator) DIEBlock();
+    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);
   }
 
   if (DT.isProtected())