From 9e51c844da9361f8ddb35f9b910468bc400d22cf Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Sat, 5 Dec 2015 03:41:53 +0000 Subject: [llvm-dwp] Add coverage for both the presence and absence of type units, and fix/remove the emission of a broken tu_index when no type units are present llvm-svn: 254833 --- llvm/tools/llvm-dwp/llvm-dwp.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'llvm/tools/llvm-dwp/llvm-dwp.cpp') diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp index 2583e2e2081..9a9440574e8 100644 --- a/llvm/tools/llvm-dwp/llvm-dwp.cpp +++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp @@ -310,11 +310,13 @@ static std::error_code write(MCStreamer &Out, ArrayRef Inputs) { return Err; } - // 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); + 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 the type contribution ContributionOffsets[DW_SECT_TYPES - DW_SECT_INFO] = 0; -- cgit v1.2.3