summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-dwp/llvm-dwp.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-12-05 03:41:53 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-12-05 03:41:53 +0000
commit9e51c844da9361f8ddb35f9b910468bc400d22cf (patch)
tree4ed52d9f221dc08233e0b929a839e01353a2dabf /llvm/tools/llvm-dwp/llvm-dwp.cpp
parent5bbbcbb3dc81a0e21420442b8358f285586b1e7d (diff)
downloadbcm5719-llvm-9e51c844da9361f8ddb35f9b910468bc400d22cf.tar.gz
bcm5719-llvm-9e51c844da9361f8ddb35f9b910468bc400d22cf.zip
[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
Diffstat (limited to 'llvm/tools/llvm-dwp/llvm-dwp.cpp')
-rw-r--r--llvm/tools/llvm-dwp/llvm-dwp.cpp12
1 files changed, 7 insertions, 5 deletions
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<std::string> 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;
OpenPOWER on IntegriCloud