summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-dwp/llvm-dwp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-dwp/llvm-dwp.cpp')
-rw-r--r--llvm/tools/llvm-dwp/llvm-dwp.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index ca40638d801..82b7d12fcb1 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -219,6 +219,9 @@ static void
writeIndex(MCStreamer &Out, MCSection *Section,
ArrayRef<unsigned> ContributionOffsets,
const MapVector<uint64_t, UnitIndexEntry> &IndexEntries) {
+ if (IndexEntries.empty())
+ return;
+
unsigned Columns = 0;
for (auto &C : ContributionOffsets)
if (C)
@@ -397,8 +400,9 @@ static std::error_code write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
}
}
- assert(!AbbrevSection.empty());
- assert(!InfoSection.empty());
+ if (InfoSection.empty())
+ continue;
+
if (!CurCUIndexSection.empty()) {
DWARFUnitIndex CUIndex(DW_SECT_INFO);
DataExtractor CUIndexData(CurCUIndexSection,
@@ -448,13 +452,11 @@ static std::error_code write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
return Err;
}
- if (!TypeIndexEntries.empty()) {
- // Lie about there being no info contributions so the TU index only includes
- // the type unit contribution
- ContributionOffsets[0] = 0;
- writeIndex(Out, MCOFI.getDwarfTUIndexSection(), ContributionOffsets,
- TypeIndexEntries);
- }
+ // Lie about there being no info contributions so the TU index only includes
+ // the type unit contribution
+ ContributionOffsets[0] = 0;
+ writeIndex(Out, MCOFI.getDwarfTUIndexSection(), ContributionOffsets,
+ TypeIndexEntries);
// Lie about the type contribution
ContributionOffsets[DW_SECT_TYPES - DW_SECT_INFO] = 0;
OpenPOWER on IntegriCloud