summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-01-27 00:45:04 +0000
committerDevang Patel <dpatel@apple.com>2009-01-27 00:45:04 +0000
commit45c899cd1519c7b796290dc8875ff987cfb5be83 (patch)
tree958e00211088fa7efcfad030ea4a6c2bd065261e /llvm/lib
parent8738997c11e6bd7ba1347a307c94f75334fedd38 (diff)
downloadbcm5719-llvm-45c899cd1519c7b796290dc8875ff987cfb5be83.tar.gz
bcm5719-llvm-45c899cd1519c7b796290dc8875ff987cfb5be83.zip
Assorted debug info fixes.
- DW_AT_bit_size is only suitable for bitfields. - Encode source location info for derived types. - Source location and type size info is not useful for subroutine_type (info is included in respective DISubprogram) and array_type. llvm-svn: 63077
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
index c651cb66ceb..19edd951468 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
@@ -1733,8 +1733,8 @@ private:
// Add source line info if available and TyDesc is not a forward
// declaration.
- // FIXME - Enable this. if (!DTy.isForwardDecl())
- // FIXME - Enable this. AddSourceLine(&Buffer, *DTy);
+ if (!DTy.isForwardDecl())
+ AddSourceLine(&Buffer, &DTy);
}
/// ConstructTypeDIE - Construct type DIE from DICompositeType.
@@ -1815,20 +1815,23 @@ private:
// Add name if not anonymous or intermediate type.
if (!Name.empty()) AddString(&Buffer, DW_AT_name, DW_FORM_string, Name);
- // Add size if non-zero (derived types might be zero-sized.)
- if (Size)
- AddUInt(&Buffer, DW_AT_byte_size, 0, Size);
- else {
- // Add zero size if it is not a forward declaration.
- if (CTy.isForwardDecl())
- AddUInt(&Buffer, DW_AT_declaration, DW_FORM_flag, 1);
- else
- AddUInt(&Buffer, DW_AT_byte_size, 0, 0);
+ if (Tag == DW_TAG_enumeration_type || Tag == DW_TAG_structure_type
+ || Tag == DW_TAG_union_type) {
+ // Add size if non-zero (derived types might be zero-sized.)
+ if (Size)
+ AddUInt(&Buffer, DW_AT_byte_size, 0, Size);
+ else {
+ // Add zero size if it is not a forward declaration.
+ if (CTy.isForwardDecl())
+ AddUInt(&Buffer, DW_AT_declaration, DW_FORM_flag, 1);
+ else
+ AddUInt(&Buffer, DW_AT_byte_size, 0, 0);
+ }
+
+ // Add source line info if available.
+ if (!CTy.isForwardDecl())
+ AddSourceLine(&Buffer, &CTy);
}
-
- // Add source line info if available.
- if (!CTy.isForwardDecl())
- AddSourceLine(&Buffer, &CTy);
}
// ConstructSubrangeDIE - Construct subrange DIE from DISubrange.
@@ -1853,7 +1856,6 @@ private:
AddUInt(&Buffer, DW_AT_GNU_vector, DW_FORM_flag, 1);
DIArray Elements = CTy->getTypeArray();
- AddType(DW_Unit, &Buffer, CTy->getTypeDerivedFrom());
// Construct an anonymous type for index type.
DIE IdxBuffer(DW_TAG_base_type);
@@ -1906,7 +1908,7 @@ private:
AddSourceLine(MemberDie, &DT);
- AddUInt(MemberDie, DW_AT_bit_size, 0, DT.getSizeInBits());
+ // FIXME _ Handle bitfields
DIEBlock *Block = new DIEBlock();
AddUInt(Block, 0, DW_FORM_data1, DW_OP_plus_uconst);
AddUInt(Block, 0, DW_FORM_udata, DT.getOffsetInBits() >> 3);
OpenPOWER on IntegriCloud