Simplify/collapse/denest a conditions/blocks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198813 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2014-01-09 00:13:35 +00:00
parent 4130da81de
commit 07ef4fda1b

View File

@ -66,13 +66,11 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) {
getDebugAbbrev()->dump(OS); getDebugAbbrev()->dump(OS);
} }
if (DumpType == DIDT_All || DumpType == DIDT_AbbrevDwo) { if (DumpType == DIDT_All || DumpType == DIDT_AbbrevDwo)
const DWARFDebugAbbrev *D = getDebugAbbrevDWO(); if (const DWARFDebugAbbrev *D = getDebugAbbrevDWO()) {
if (D) {
OS << "\n.debug_abbrev.dwo contents:\n"; OS << "\n.debug_abbrev.dwo contents:\n";
getDebugAbbrevDWO()->dump(OS); D->dump(OS);
} }
}
if (DumpType == DIDT_All || DumpType == DIDT_Info) { if (DumpType == DIDT_All || DumpType == DIDT_Info) {
OS << "\n.debug_info contents:\n"; OS << "\n.debug_info contents:\n";
@ -80,14 +78,14 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) {
getCompileUnitAtIndex(i)->dump(OS); getCompileUnitAtIndex(i)->dump(OS);
} }
if (DumpType == DIDT_All || DumpType == DIDT_InfoDwo) if ((DumpType == DIDT_All || DumpType == DIDT_InfoDwo) &&
if (getNumDWOCompileUnits()) { getNumDWOCompileUnits()) {
OS << "\n.debug_info.dwo contents:\n"; OS << "\n.debug_info.dwo contents:\n";
for (unsigned i = 0, e = getNumDWOCompileUnits(); i != e; ++i) for (unsigned i = 0, e = getNumDWOCompileUnits(); i != e; ++i)
getDWOCompileUnitAtIndex(i)->dump(OS); getDWOCompileUnitAtIndex(i)->dump(OS);
} }
if (DumpType == DIDT_All || DumpType == DIDT_Types) { if ((DumpType == DIDT_All || DumpType == DIDT_Types) && getNumTypeUnits()) {
OS << "\n.debug_types contents:\n"; OS << "\n.debug_types contents:\n";
for (unsigned i = 0, e = getNumTypeUnits(); i != e; ++i) for (unsigned i = 0, e = getNumTypeUnits(); i != e; ++i)
getTypeUnitAtIndex(i)->dump(OS); getTypeUnitAtIndex(i)->dump(OS);
@ -141,17 +139,17 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) {
} }
} }
if (DumpType == DIDT_All || DumpType == DIDT_StrDwo) if ((DumpType == DIDT_All || DumpType == DIDT_StrDwo) &&
if (!getStringDWOSection().empty()) { !getStringDWOSection().empty()) {
OS << "\n.debug_str.dwo contents:\n"; OS << "\n.debug_str.dwo contents:\n";
DataExtractor strDWOData(getStringDWOSection(), isLittleEndian(), 0); DataExtractor strDWOData(getStringDWOSection(), isLittleEndian(), 0);
offset = 0; offset = 0;
uint32_t strDWOOffset = 0; uint32_t strDWOOffset = 0;
while (const char *s = strDWOData.getCStr(&offset)) { while (const char *s = strDWOData.getCStr(&offset)) {
OS << format("0x%8.8x: \"%s\"\n", strDWOOffset, s); OS << format("0x%8.8x: \"%s\"\n", strDWOOffset, s);
strDWOOffset = offset; strDWOOffset = offset;
}
} }
}
if (DumpType == DIDT_All || DumpType == DIDT_Ranges) { if (DumpType == DIDT_All || DumpType == DIDT_Ranges) {
OS << "\n.debug_ranges contents:\n"; OS << "\n.debug_ranges contents:\n";
@ -183,17 +181,18 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) {
dumpPubSection(OS, "debug_gnu_pubtypes", getGnuPubTypesSection(), dumpPubSection(OS, "debug_gnu_pubtypes", getGnuPubTypesSection(),
isLittleEndian(), true /* GnuStyle */); isLittleEndian(), true /* GnuStyle */);
if (DumpType == DIDT_All || DumpType == DIDT_StrOffsetsDwo) if ((DumpType == DIDT_All || DumpType == DIDT_StrOffsetsDwo) &&
if (!getStringOffsetDWOSection().empty()) { !getStringOffsetDWOSection().empty()) {
OS << "\n.debug_str_offsets.dwo contents:\n"; OS << "\n.debug_str_offsets.dwo contents:\n";
DataExtractor strOffsetExt(getStringOffsetDWOSection(), isLittleEndian(), 0); DataExtractor strOffsetExt(getStringOffsetDWOSection(), isLittleEndian(),
offset = 0; 0);
uint64_t size = getStringOffsetDWOSection().size(); offset = 0;
while (offset < size) { uint64_t size = getStringOffsetDWOSection().size();
OS << format("0x%8.8x: ", offset); while (offset < size) {
OS << format("%8.8x\n", strOffsetExt.getU32(&offset)); OS << format("0x%8.8x: ", offset);
} OS << format("%8.8x\n", strOffsetExt.getU32(&offset));
} }
}
} }
const DWARFDebugAbbrev *DWARFContext::getDebugAbbrev() { const DWARFDebugAbbrev *DWARFContext::getDebugAbbrev() {